• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

strictfp

 
Jitendra Jha
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is strictfp?
where is it used?Please suggest a case where we can use it!!

Thanks in advance:
 
Gavin Tranter
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, it forces floating point numbers to adhere to an IEEE 754 standard, that is independent of platform.
It is a modifer, for classes and methods, but NOT for variables.

You should be able to find details of it within JavaDoc, and details of the standard itself from the IEEE.

You would use it when you would want to ensure consistant floating point operation/evaluation across platforms.

G
[ February 21, 2007: Message edited by: Gavin Tranter ]
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
strictfp is a modifier used on classes and methods that requires all calculations within the class or method to adhere to IEEE 754.
 
Jitendra Jha
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is IEEE 754?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IEEE 754 is a standard for performing binary floating point calculations: Wikipedia: IEEE 754
 
fred rosenberger
lowercase baba
Bartender
Posts: 12186
34
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jitendra,

You may want to read our FAQ on How To Ask Questions. Finding what IEEE 754 standard is something that would have taken about 5 seconds to find with google.

Once you find it, if you don't understand it then feel free to ask about that. However simply posting a question without even attempting to find the answer wastes a lot of people's time.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With non-strict floating point arithmetic (the standard in Java), you can get slightly different results on different platforms.

As a contrived example, as a result of a complex expression you could get 1.23456789 on one platform, but 1.23456788 on another.

If you need the exact same results on all platforms, you use strictfp. Doing so can reduce performance on some platforms, though.
 
Jitendra Jha
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Ilja Preuss"

Thanks for help.That solved my doubt!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic