comp.lang.ada
 help / color / mirror / Atom feed
* Another ammunition
@ 2002-12-31 10:23 Jean-Pierre Rosen
  2002-12-31 11:43 ` Eric G. Miller
  2003-01-01  9:05 ` Michael Erdmann
  0 siblings, 2 replies; 23+ messages in thread
From: Jean-Pierre Rosen @ 2002-12-31 10:23 UTC (permalink / raw)


I know I'm preaching to the choir, but here is another story Ada fans can tell to the other guys who say that "language doesn't
matter"...

My son was recently doing an assignment in C, which involved lots of floating point computations, and he kept getting inconsistent
results. After lots of searching, he discovered that NaNs were generated in various places. There seemed to be no consistency in the
appearing of NaNs: changing optimization options, adding intermediate variables in computations, etc. all changed the way NaNs were
produced.

Here is what happened: A C function was returning a float, but in some place was declared as returning an int. In gcc, a function
that returns a float leaves the result on the coprocessor stack, NOT on the regular stack. Therefore, the return value of the
function was not popped off the coprocessor stack. And when the coprocessor's stack is full, every floating point operation results
in NaN....

It took a week to understand what was happenning. Would not have passed the first compilation in Ada.
FWIW...

--
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr





^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2003-01-14  1:24 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-31 10:23 Another ammunition Jean-Pierre Rosen
2002-12-31 11:43 ` Eric G. Miller
2002-12-31 12:57   ` Jean-Pierre Rosen
2002-12-31 16:23     ` Alexander Schreiber
2003-01-02  6:55       ` AG
2003-01-01 16:58         ` Alexander Schreiber
2003-01-07 12:54           ` Peter Hermann
2003-01-07 13:21           ` Richard Riehle
2003-01-11 18:29             ` Alexander Schreiber
2003-01-13  2:11               ` u.r. faust
2003-01-12 12:44                 ` Larry Kilgallen
2003-01-14  1:24                   ` Georg Bauhaus
2003-01-03  9:50         ` Jean-Pierre Rosen
2003-01-03 15:24         ` Stephen Leake
2002-12-31 16:40     ` Warren W. Gay VE3WWG
2003-01-04 20:17       ` David Thompson
2003-01-06 17:39         ` Warren W. Gay VE3WWG
2003-01-06 20:50           ` Stephen Leake
2003-01-06 22:16             ` Warren W. Gay VE3WWG
2003-01-07 18:37               ` Stephen Leake
2003-01-07 21:55                 ` Warren W. Gay VE3WWG
2003-01-01  9:05 ` Michael Erdmann
2003-01-07 13:03   ` Peter Hermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox