[Bug libstdc++/20431] New: Out of range float inputs to cin get spurious values

david dot moore at intel dot com gcc-bugzilla@gcc.gnu.org
Fri Mar 11 21:02:00 GMT 2005


Large values (that should produce inf, produce a bogus result instead.

For example, 1.0e+309 produces 1.39065e-309 on gcc 3.4.3!

Here is the trivial program:

#include <iostream>
#include <stdio.h>

using namespace std;

int main()
{
  double a,b;

  cout << "Enter a (Using cin):";
  cin >> a;

  printf ("Enter b (Using scanf):");
  scanf ("%lf",&b);
  
  cout <<"a = "<< a << "\tb = "<< b <<endl;
  return 0;
}

-- 
           Summary: Out of range float inputs to cin get spurious values
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: david dot moore at intel dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20431



More information about the Gcc-bugs mailing list