i have seen this following math method called:
Math.round(d*10000) / (double) 10000;
and i don't know what it means. can someone please explain me ? thank you
i have seen this following math method called:
Math.round(d*10000) / (double) 10000;
and i don't know what it means. can someone please explain me ? thank you
Assuming d
is a double
or float
. It multiplies d
with 10000
. Rounds to the nearest whole number, and divides by 10000
If effect, it returns the original number with '4 digits as decimal fraction' (without resorting to formatting to String and parsing)