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
, depending on what you're expecting.