www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/06/19/19:16:01

Message-ID: <33A9841B.5BC7@cs.com>
Date: Thu, 19 Jun 1997 19:10:19 +0000
From: "John M. Aldrich" <fighteer AT cs DOT com>
Reply-To: fighteer AT cs DOT com
Organization: Two pounds of chaos and a pinch of salt
MIME-Version: 1.0
To: DJGPP Workers Mailing List <djgpp-workers AT delorie DOT com>
Subject: Possible bug in 'cin' support for long double.

[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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019