strictfp in Java 2
By: Baski
Java 2 adds a new keyword to the Java language, called strictfp. With the creation of Java 2, the floating point computation model was relaxed slightly to make certain floating point computations faster for certain processors, such as the Pentium. Specifically, the new model does not require the truncation of certain intermediate values that occur during a computation. By modifying a class or a method with strictfp, you ensure that floating point calculations (and thus all truncations) take place precisely as they did in earlier versions of Java. The truncation affects only the exponent of certain operations. When a class is modified by strictfp, all the methods in the class are also modified by strictfp automatically.
For example, the following fragment tells Java to use the original floating point model for calculations in all methods defined within MyClass:
strictfp class MyClass { //...
Frankly, most programmers never need to use strictfp, because it affects only a very small class of problems.
Archived Comments
1. How to sort an Arraylist in some given order? Say, if an arraylist contains some custid(Integer) and
View Tutorial By: Arunava Chatterjee at 2015-03-07 04:17:51
2. because equals method compares on object references not their values and in refrence in this case is
View Tutorial By: mohit s. at 2011-12-24 06:29:35
3. float f=1.2351111f;
System.out.println(String.format("%1.2f", f));
View Tutorial By: jack at 2011-11-10 11:49:00
4. if the two StringBuffer object contain same String then why the equals() method should not return tr
View Tutorial By: Avinash kumar at 2011-11-09 11:16:19
5. Hello,
I would like to know how will take place rounding of value in case of strictfp
View Tutorial By: Jeff at 2011-02-02 23:05:17
6. Hi, It is not clear from the answer. What I understand is only to make fast floating point computati
View Tutorial By: amar at 2010-12-25 08:02:39
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
Program using concept of byte long short and int in java
Update contents of a file within a jar file
Tomcat and httpd configured in port 8080 and 80
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
MultiLevel Inheritance sample in Java