简体   繁体   中英

Floating point precision with Time - multiply vs divide

Will these statements execute with exactly the same results across different platforms?

    currentTime = System . nanoTime ( ) * 0.000000001f ; // 01

    currentTime = System . nanoTime ( ) / 1000000000f ; // 02

The concern is loss of precision using a small floating point value.

Just leave it as a long. No loss of precision and perfect Determinism across the board.

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