Article View: gnu.gcc.bug
Article #2422sun4-os4 1.34 double truncated to float
From: meyering
Date: Sun, 19 Mar 1989 05:07
Date: Sun, 19 Mar 1989 05:07
23 lines
981 bytes
981 bytes
gcc-1.34 (with -W patches posted by Paul Hudson)
config.gcc sun4-os4
Sun4/280 OS 4.0
The program below generates the output "1.0000002381857"
The correct result is simply "1" -- Any one of several minor
modifications to the code will cause it to give the correct result:
1) remove the statement that assigns to y[i]
2) make "x[i]" a scalar
3) remove for-loop, and set i=0
main()
{
double x[2],y[2];
int i;
for (i=0; i<1; i++) {
x[i] = 1.0e0;
printf("%.14g\n", x[i]);
y[i] = 2.0e0;
}
}
Jim Meyering meyering@cs.utexas.edu
Technical Details
Message-ID:
<8903190507.AA08790@ai.cs.utexas.edu>Path:
arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!CS.UTEXAS.EDU!meyeringShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!CS.UTEXAS.EDU!meyering From: meyering@CS.UTEXAS.EDU Newsgroups: gnu.gcc.bug Subject: sun4-os4 1.34 double truncated to float Message-ID: <8903190507.AA08790@ai.cs.utexas.edu> Date: 19 Mar 89 05:07:40 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 23