Re: Integerizing a rat involves truncating its tail

2008-03-31 Thread TSa
HaloO, Darren Duncan wrote: Or maybe your question is more about what method to use by default if users don't explicitly choose one? Yes. I thought we have gone over this in the div/mod discussion that ended with specifying floor semantics for %. I sort of hoped for a synopsis update with

Re: Integerizing a rat involves truncating its tail

2008-03-31 Thread TSa
HaloO, I asked: just re-reading S03 I saw that it defines the Rat to Int conversion as truncation. Hmm, does assuming floor semantics reveal the availability of the tail function for Nums? (-1.25).tail == 0.75 Can it also be used as an lvalue? my Rat $x = -5/4; # note that this is

Integerizing a rat involves truncating its tail

2008-03-28 Thread TSa
HaloO, just re-reading S03 I saw that it defines the Rat to Int conversion as truncation. Why not floor semantics like in %? Actually I would recommend floor semantics whenever an integer is coerced. With the sole exception of Num propably using rounding. Regards, TSa. -- The Angel of Geometry

Re: Integerizing a rat involves truncating its tail

2008-03-28 Thread mark . a . biggar
I think nearest makes more sense. People will be really surprised when /1 turns into 0. -- Mark Biggar [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] -- Original message -- From: TSa [EMAIL PROTECTED] HaloO, just re-reading S03 I saw

Re: Integerizing a rat involves truncating its tail

2008-03-28 Thread Darren Duncan
TSa wrote: just re-reading S03 I saw that it defines the Rat to Int conversion as truncation. Why not floor semantics like in %? Actually I would recommend floor semantics whenever an integer is coerced. With the sole exception of Num propably using rounding. If the difference matters to

Re: Integerizing a rat involves truncating its tail

2008-03-28 Thread Mark J. Reed
The choice of floor vs ceiling is essentially arbitrary, as long as its consistent; using truncation or rounding is mathematically unsound. Most implementations use floor, though. So in general I would expect these to hold: x div y = floor(x/y) x mod y = x - y * floor(x/y) Most importantly,

Re: Integerizing a rat involves truncating its tail

2008-03-28 Thread Mark J. Reed
On Fri, Mar 28, 2008 at 3:47 PM, [EMAIL PROTECTED] wrote: I think nearest makes more sense. People will be really surprised when /1 turns into 0. They shouldn't be, if they're asking for an integer specifically. That's what happens now in Perl 5... If you have a rational