Mail Archives: djgpp-workers/1997/06/19/19:16:01
[Submitted as bug report #000162]
This is a followup to a user's post on the newsgroup regarding problems
reading and writing long doubles in C++ programs. I asked her to send
me sample code, which I include here:
#include <iostream.h>
int main( void )
{
long double x;
cout << "x = ";
cin >> x;
cout << "\nYou entered " << x << endl;
return 0;
}
When this code is run, it results in either a NaN or a SIGFPE in the
cout statement. Further work traced it to the cin statement, since
replacing this with scanf( "%Lf", &x ); makes the code work correctly.
There is no current bug report about this, nor any information in the
mailing list archives or the docs for iostream.h.
Any ideas?
--
---------------------------------------------------------------------
| John M. Aldrich | "It may be better to be a live jackal|
| aka Fighteer I | than a dead lion, but it is better |
| mailto:fighteer AT cs DOT com | still to be a live lion." |
| http://www.cs.com/fighteer | - Lazarus Long |
---------------------------------------------------------------------
- Raw text -