• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is ur idea of STRICTFP?  RSS feed

 
Cyrus Serrano
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all, just wondering what is strictfp.... thanks
Cyrus
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java technically uses the IEEE 754 floating-point math specification. This is a very detailed spec which dictates the precise results of every possible mathematical computation, down to the individual bits. To get the correct, exact, results, you have to compute with 32 bit floats and 64 bit doubles.
Intel processors have extended-precision, 80-bit floating point registers. If the JVM uses these registers for computation, the results will be fast but won't exactly match the IEEE 754 specification. Most JVMs use them as 80-bit registers -- indeed, virtually all software uses them this way. As a result, the numeric results from a Java program might not be exactly portable (note that we're generally talking about differences in the 7th decimal place for floats, or 13th for doubles.)
"strictfp" says that the JVM should follow the specification precisely, even if it's slower and/or "less accurate."
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!