Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: finding the correct integer

by perlfan (Vicar)
on Nov 30, 2020 at 18:06 UTC ( #11124407=note: print w/replies, xml ) Need Help??


in reply to finding the correct integer

What precision are you expecting? Math::BigFloat may assist, but it doesn't seem like you're needing that hammer. Documentation on int states, You should not use this function for rounding: one because it truncates towards 0, and two because machine representations of floating-point numbers can sometimes produce counterintuitive results. Furthermore, Usually, the sprintf, printf, or the POSIX::floor and POSIX::ceil functions will serve you better than will int. You're already using POSIX so take a look at ceil or floor, depending on what you're expecting.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2021-04-18 02:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?