Now I would like it rounded to 151.65 since the decimal increments by 5 units in my country.
So, to make it clear:
If the returned value is 151.672, it should be rounded as 151.65
If the returned value is 151.678, it should be rounded as 151.70
In the above example, 151.675 is the cutoff. If the returned value is below the cutoff, it is rounded as 151.65 and above cutoff, it is rounded as 151.70
// tmp is the number to process (151.672 or 151.70 or...)
rem = mod(tmp, 0.05) // calculates remainder
if rem < 0.25,
num_rnd = tmp - rem
else
num_rnd = tmp + (0.05-rem)
end
So when tmp= 151.678, rem = 0.028, and for 151.672, rem = 0.022. When you plug this into the if statement, you get your rounded number to the 0.05 level.