Physicist here. One who believes -2**2 is negative.

At 23:26 +0800 1/17/06, Audrey Tang wrote:
>Several options:
>- - Use whatever the underlying "num" semantics available

That's likely to be in hardware. It might even be hard to detect without 
looking at the NaN returned and that would be a waste of time. Some formulas 
can accept a NaN argument and still provide a correct result. At the worst they 
return a NaN to be tested for later

>- - Always "fail"
>- - Always "die"

Those are non-conforming options See below.

>- - Specify them to return some definite value.

Only on a machine that doesn't do it in hardware or in some special perl 
function that's unlikely.

>At this moment, Pugs defines them ad-hocly to:
>
>       0/0       == die "Illegal division by zero" <--- wrong. 1/0 should not 
> die either.
>       0*Inf     == NaN <--- reasonable but don't re-invent the NaN bit pattern
>       Inf/Inf   == NaN <--- reasonable but don't re-invent the NaN bit pattern
>       Inf-Inf   == NaN <--- reasonable but don't re-invent the NaN bit pattern

>       0**0      == 1 <--- Not indeterminate. Answer is correct.
>       Inf**0    == 1 <--- Not indeterminate. Answer is correct.
>       1**Inf    == 1 <--- Not indeterminate. Answer is correct.

<http://stevehollasch.com/cgindex/coding/ieeefloat.html>


<http://en.wikipedia.org/wiki/Divide_by_zero>
>The IEEE floating-point standard, supported by almost all modern processors, 
>specifies that every floating point arithmetic operation, including division 
>by zero, has a well-defined result.

I can't seem to find the actual assigned NaN bit patterns for the above cases,
<http://docs.sun.com/source/816-2465/iapgCreference.html>
is helpful but doesn't get there. There may be multiple inf/inf returns in some 
cases depending on just which inf is involved. There are also NaN's for 
functions implemented in hardware like atan and exp.

-- 

--> In Christianity, man can have only one wife. This is known as monotony. <--

Reply via email to