Article View: gnu.gcc.help
Article #51959gcc on a 486sx (floating point problems)
From: Timothy C Hagman
Date: Mon, 01 Mar 1993 07:28
Date: Mon, 01 Mar 1993 07:28
81 lines
2558 bytes
2558 bytes
Hardware-- i486sx-25Mhz clone running 4dos v4.01 or DOS 5.00, 4 megs
RAM, plenty of disk space.
Software-- djgpp (v2.2.2) and either Q387 (v3.3), or the math
coprocessor included with the djgpp package (emu387),
himem.sys v3.00 and emm386.exe
Quick synopsis of problem-- can't seem to do anything with
floating-point variables (doubles, floats, long floats, etc.)
Details-- (see code below) -- this program, which is about as simple
as I know how to write, returns the following output:
3
NaN
NaN
4
NaN
NaN
-23424234
NaN
NaN
-3
NaN
NaN
3.14
NaN
NaN
NaN
NaN
NaN
(ad infinitum)
when using Q387 as the math coprocessor emulator.
When using emu387 as the math coprocessor emulater, I get
3
0.0000000
0.0000000
4
0.0000000
0.0000000
-23424234
-7077843188750241(then 286 0s, then).0000000
0.0000000
-3
80387 Exception: invalid operation!
SW: 0x7d81 top-7 cc=1101 CW: 0x077e
st(0) - .ffff ebff ffe7 c000 e+16385 Special
3.14
0.0000000
(repeated ad infinitum)
These results were found while running the program in a DOS shell -- the
results are very nearly identical when running
A) from a straight DOS prompt
B) from an MSDOS prompt
C) with all TSRs removed (except himem.sys, emm386.exe, and
the math coprocessor emulator)
D) After sacrificing to Odin.
E) When compiling with the -m486 flag.
F) When changing program's name to test.cc and using
cin and cout
G) After promising my first-born son to whatever deity saw
fit to help me out of this mess.
Either E-mail to hagman@cps.msu.edu or follow-up to this group-- if I
get E-mail, I will summarize and post here.
Actual code:
#include <stdio.h>
main ()
{
long double xr;
while (1)
{
scanf ("%Lf",&xr);
printf("%Lf\n",&xr);
printf("%Lf\n",xr);
}
}
Technical Details
Message-ID:
<1msdv5$h5t@msuinfo.cl.msu.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!agate!spool.mu.edu!uwm.edu!msuinfo!caspian.cps.msu.edu!hagmanShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,d37fac8f4474a128,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-03-01 08:36:15 PST Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!agate!spool.mu.edu!uwm.edu!msuinfo!caspian.cps.msu.edu!hagman From: hagman@cps.msu.edu (Timothy C Hagman) Newsgroups: gnu.gcc.help Subject: gcc on a 486sx (floating point problems) Followup-To: gnu.gcc.help Date: 1 Mar 1993 07:28:37 GMT Organization: Dept. of Computer Science, Michigan State University Lines: 81 Message-ID: <1msdv5$h5t@msuinfo.cl.msu.edu> Reply-To: hagman@cps.msu.edu (Timothy C Hagman) NNTP-Posting-Host: caspian.cps.msu.edu Keywords: gcc, 486sx, float Originator: hagman@caspian.cps.msu.edu