• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

strictfp

 
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from kathy ............

page no 46........

it can modify a class or method declaration, and that a variable can never be declared strictfp............


but in examlab.........the answer say..........strictfp can be used for instance variable and class.....


which one is correct
 
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

phil sohar wrote:from kathy ............

page no 46........

it can modify a class or method declaration, and that a variable can never be declared strictfp............



It's correct, If it is used for a method or a class, Strictfp ensures that you get exactly the same results from your floating point calculations on every platform. If you don't use strictfp, the JVM implementation is free to use extra precision where available.

phil sohar wrote:
but in examlab.........the answer say..........strictfp can be used for instance variable and class.....
which one is correct



Definitely strictfp can't be used for variable, I've done ExamLab, but I don't remember this answer, let see, what Devaka say.....
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This wiki link should help -> http://en.wikipedia.org/wiki/Strictfp#Usage

Did you try to add strictfp to a variable ? What happens ?

 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Abimaran Kugathasan wrote:
Strictfp ensures that you get exactly the same results from your floating point calculations on every platform. If you don't use strictfp, the JVM implementation is free to use extra precision where available.




i didnot understand this.........please make it clear
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

phil sohar wrote:
i didnot understand this.........please make it clear



It's a IEEE(IEEE 754) standard to restrict floating point calculations. If you are a IEEE member, go here and login for further details. Normally floating point calculations are depends on platform, where you make calculations, but if you want to restrict those calculation to be same in all platforms, then you should go for strictfp, it's make those calculation in a standard way.

What Every Computer Scientist should know about floating point arithmetic

Anyway have Googling, you'll get better result than this
 
Greenhorn
Posts: 19
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

phil sohar wrote:from kathy ............

page no 46........

it can modify a class or method declaration, and that a variable can never be declared strictfp............


but in examlab.........the answer say..........strictfp can be used for instance variable and class.....


which one is correct

Another Interesting point is an Interface can be declared with strictfp but no interface can have strictfp declared method.
An Interface can be strictfp but not its methods.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

kavitha yogaraj wrote:Another Interesting point is an Interface can be declared with strictfp but no interface can have strictfp declared method.
An Interface can be strictfp but not its methods.



If we declare strictfp to an interface, all the method will behave according to FP standards, we can't use abstract and strictfp together, it doesn't matter whether it's a class(abstract class) or interface.

But, there is a exception, for interface declaration only, we can use strictfp and abstract keywords together! Further details, look the Spec here
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic