develooper Front page | perl.perl5.porters | Postings from July 2001

Re: [DOC PATCH bleadperl] detypo Math::BigInt docs

Thread Previous | Thread Next
From:
Philip Newton
Date:
July 10, 2001 13:08
Subject:
Re: [DOC PATCH bleadperl] detypo Math::BigInt docs
Message ID:
perl.perl5.porters-40120@nntp.perl.org
On 10 Jul 01, at 15:52, John Peacock wrote:

> 0 cannot ever be positive or negative by itself (that is truly the definition 
> of positive {>0} and negative {<0} ).

True; however, as I understand it, IEEE floating-point arithmetic 
allows for there to be positive and negative zero since it uses a sign-
magnitude representation. And Math::Big* objects also store the sign 
separately, so they can (potentially) have positive and negative 
zeroes.

> Therefore 0/0==0 is a sensible default (since 0/num == 0 for all
> other num). 

On the other hand, if a/b==c, then b*c == a. This holds for 10/5==2 --> 
5*2==10, but not if you posit 0/0==0, since 0*0==0, but 5*0==0 as well, 
so one could argue that 0/0 should be 5. This argument holds for any 
possible result. So if 0/0 has any one value, it has to be one that's 
specially defined; NaN makes sense to me for this.

(And what do you think is 0**0? 0**n == 0 for all positive n, but n**0 
== 1 for all positive n.... Presumably, 0**0 is also NaN, then.)

Cheers,
Philip
-- 
Philip Newton <Philip.Newton@gmx.net>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About