Numerics, NaNs, IEEE 754 and C99
Nick Maclaren
nmm1 at cus.cam.ac.uk
Thu Jun 15 12:44:09 EDT 2006
In article <129300g5np02c8a at corp.supernews.com>,
Grant Edwards <grante at visi.com> writes:
|>
|> > which IEEE 754 assumes that the code will test and take
|> > appropriate action (which can be anything, including aborting
|> > the program and replacing it by a NaN). See
|> > http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf
|>
|> IEEE Std 754-1985, subclause 7.2 - Division by Zero
|>
|> "If the divisor is zero and the dividend is a finite nonzero
|> number, then the division by zero shall be signaled. The
|> result, when no trap occurs, shall be a correctly signed
|> (infinity symbol)(6.3)."
|>
|> To me it looks like the spec specifically allows for a case
|> where "no trap occurrs" and the result is Inf.
That is correct. And it is a mandatory case. But it does NOT say what
the software should then do with the exception.
Regards,
Nick Maclaren.
More information about the Python-list
mailing list