Re: Indeterminate forms for the Num type.

2006-01-18 Thread Larry Wall
On Wed, Jan 18, 2006 at 09:38:04AM +0800, Audrey Tang wrote: : Also, would you be happy with different treatments of Int/Int versus : Num/Num? : : 0/0 # fail "illegal division by zero" : 0.0/0.0 # NaN I'd like to point out that there's no reason in principle that a failure undef c

Re: Indeterminate forms for the Num type.

2006-01-18 Thread Doug McNutt
At 09:38 +0800 1/18/06, Audrey Tang wrote: >Also, would you be happy with different treatments of Int/Int versus >Num/Num? > > 0/0 # fail "illegal division by zero" > 0.0/0.0 # NaN I plead guilty. I was not aware that perl6 was going to allow types to be defined like int and float

Re: Indeterminate forms for the Num type.

2006-01-17 Thread Darren Duncan
At 9:50 AM +0800 1/18/06, Audrey Tang wrote: However, I think one of P6's idea is that the user should not have to care between 0 and 0.0's behaviours, so maybe it makes sense to do the same thing (be it NaN or exception) both ways. I'm not sure that IEEE 754/854 still applies if we want to merg

Re: Indeterminate forms for the Num type.

2006-01-17 Thread Audrey Tang
Audrey Tang wrote: > That seems to follow from the standard (ruby, ocaml, mzscheme currently > does that), but some may also argue for NaN bothways (ghc, js) or an > exception bothways (perl5, python). Er, wait, ghc also raises an exception for (div 0 0), because it distinguishes integer (div) wit

Re: Indeterminate forms for the Num type.

2006-01-17 Thread Audrey Tang
Luke Palmer wrote: > I believe we've been through this before. We go with a standard, > probably IEEE, horridly mathematically unappealing though it may be. > It will be easier to implement and it will be more predictable, both > because most other language follow standards, too. "The good thing

Re: Indeterminate forms for the Num type.

2006-01-17 Thread Luke Palmer
On 1/17/06, Audrey Tang <[EMAIL PROTECTED]> wrote: > I personally like having 0/0 be NaN and 1/0 be Inf (as in JavaScript), > but all of Python/Perl/Ruby/Scheme/OCaml throws exceptions for them... I believe we've been through this before. We go with a standard, probably IEEE, horridly mathematica

Re: Indeterminate forms for the Num type.

2006-01-17 Thread Rob Kinyon
On 1/17/06, Audrey Tang <[EMAIL PROTECTED]> wrote: > But putter on #perl6 reports "1" on his amd64. I'd be happy we spec it > has to have to return 1 always for boxed Num types, even though it means > additional cycles for boxed numeric types. Isn't the point of boxing to provide a hardware-indep

Re: Indeterminate forms for the Num type.

2006-01-17 Thread Audrey Tang
Doug McNutt wrote: >> - - 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. This question arises as different platform answer things differently for the native calculation of eg. 1**Inf. > >> At this

Re: Indeterminate forms for the Num type.

2006-01-17 Thread Doug McNutt
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 was

Re: Indeterminate forms for the Num type.

2006-01-17 Thread Jonathan Lang
Audrey Tang wrote: > Assuming "num" uses the underlying floating point semantic (which may > turn 0/0 into NaN without raising exception), what should the default > "Num" do on these forms? > > 0/0 > 0*Inf > Inf/Inf > Inf-Inf > 0**0 > Inf**0 >

Indeterminate forms for the Num type.

2006-01-17 Thread Audrey Tang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Assuming "num" uses the underlying floating point semantic (which may turn 0/0 into NaN without raising exception), what should the default "Num" do on these forms? 0/0 0*Inf Inf/Inf Inf-Inf 0**0 Inf**0