Quick question:
-1.9.floor gives you -1, while "-1.9".floor gives you -2. Is it supposed to be so? Seems a bit inconsistent to me.
> say -1.9.floor
-1
> say "-1.9".floor
-2
Documentation says "rounds it downwards to the nearest integer". Should both be -2?
Thanks!!!
Seems to be some operator precedence. Make the number a variable and use floor on the variable it looks ok.
my $i = -1.9;
say $i.floor; #-2
I your example it makes: .9.floor ==> 0 and then -1.0 ==> -1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With