`strictfp` is a keyword in the Java programming language that restricts floating-point calculations to ensure portability. It was introduced into Java with JVM version 1.2
strictfp
is a keyword in the java programming language that restricts floating-point calculations to ensure portability. It was introduced into Java with JVM version 1.2. Prior to JVM 1.2, floating-point calculations were strict; that is, all intermediate floating-point results were represented as IEEE single or double precisions only. As a consequence, errors of calculation (round-off errors), overflows and underflows, would occur with greater frequency than in architectures which did intermediate calculations in greater precision. Since JVM 1.2, intermediate computations are not limited to the standard 32- and 64-bit precisions. On platforms that can handle other representations, e.g. 80-bit double extended on x86 or x86-64 platforms, those representations can be used, helping to prevent round-off errors and overflows, thereby increasing precision. For some applications, a programmer might need every platform to have precisely the same floating-point behavior, even on platforms that could handle greater precision. The strictfp modifier accomplishes this by truncating all intermediate values to IEEE single- and double-precision, as occurred in earlier versions of the JVM.