How can I set a variable to divide and round up to 0 decimal places?
@lulala Another root of all evil: cherry-picking results.
Run your benchmark multiple times. I get the following:
user system total real
0.120000 0.000000 0.120000 ( 0.119281)
0.120000 0.000000 0.120000 ( 0.123431)
Which is a tie.
user system total real
0.110000 0.000000 0.110000 ( 0.118602)
0.130000 0.000000 0.130000 ( 0.127195)
Which suggests that float_op
is faster.
user system total real
0.150000 0.000000 0.150000 ( 0.151104)
0.120000 0.000000 0.120000 ( 0.123836)
Which suggests that integer_op
us faster.
Edited following a comment
number_total = (records / per_page.to_f).ceil