简体   繁体   中英

Can someone explain me what this math's method does?

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM