Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: Undefined evaluation order
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dave Berry <dave@k...>
Subject: RE: Undefined evaluation order
David,

Thanks for your reply.  Are you saying that if (a * b) would result in a NaN
then you always want (a * b * 0.0) to return a NaN, so that you are aware of
the potential problem? 

Dave.

> -----Original Message-----
> From: David McClain [mailto:dmcclain@azstarnet.com]
> Sent: Thursday, October 12, 2000 6:06 PM
> To: caml-list@inria.fr
> Subject: Re: Undefined evaluation order
> 
> 
> ... but the same would be true the other way too... (0.0 * a * b).  I am a
> numeric programmer and these things are unavoidable no matter how you
choose
> to order the evaluations.
> 
> If (a * b) raises a NaN then what would be the value of 0.0 times that?
The
> IEEE spec would say the result would have to continue to be a NaN.
> 
> I normally perform all arithmetic with exception processing supressed or
> deferred. The only time an exception is useful to me is if there is some
> remedial action that could be taken. I want my NaN's and INF's to appear
in
> my answers. In particular, if something should go awry at one point out of
> millions I don't want that one point to hose my entire calculation. (Note
> that I do not look kindly at the Fortran way of aborting an entire program
> for one bad point...) In signal and image processing, especially in a
> real-time environment, you just drop the bad points on the floor and
> continue running.
> 
> - DM