Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: Variables are automatically rounded off in perl

by syphilis (Archbishop)
on Feb 11, 2019 at 11:23 UTC ( #1229759=note: print w/replies, xml ) Need Help??


in reply to Re^4: Variables are automatically rounded off in perl
in thread Variables are automatically rounded off in perl

Someone else might be able to provide more definitive advice about that

As regards the operation $m % $n, the perlop documentation ( see perdoc perlop ) states:

<quote>
If the operands $m and $n are floating point values and the absolute value of $n (that is "abs($n)") is less than "(UV_MAX + 1)", only the integer portion of $m and $n will be used in the operation
(Note: here "UV_MAX" means the maximum of the unsigned integer type).
</quote>

So perl's calculation of 3335.99999999995 % 3330 ( == 5) is being done as documented.

Cheers,
Not "someone else"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1229759]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2023-03-26 12:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (63 votes). Check out past polls.

    Notices?