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
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
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
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
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
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,
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