java - what are the uses of by making strictfp class or method? -


marking class strictfp means method code in class conform ieee 754 standard rules floating points.

what means? don't it.

some processors have capabilities more accurate arithmetic - e.g. 80 bits instead of 64 bits. likewise on processors may faster use double arithmetic logically float arithmetic used. example:

float foo(float x, float y) {     x = x * 1.2345f;     y = y * 2.3456f;     return x * y; } 

here intermediate operations potentially optimized use 80-bit arithmetic throughout, falling 32-bit value when it's returned... though operation described in source code each multiplication theoretically 32-bit multiplication.

when use strictfp, turn off potential optimizations. it's necessary, means you're guaranteed exact same set of arithmetic operations - when given exact same set of inputs - give exact same set of results regardless of implementation.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -