Nazerke
Nazerke

Reputation: 2098

returning incorrect floating point value

I have a method getFar() which should return 5.1f:

 float far = 5.1f;

 public float getFar()
 {return far;}

But when I call it from another class

  System.out.println("Far: "+ mRenderer.getFar());

it returns different values every time. In one run it can be 5.25..., in another 5.78..., etc

How can I return 5.1f?

Upvotes: 2

Views: 98

Answers (1)

Kelly S. French
Kelly S. French

Reputation: 12344

Are you sure that mRenderer.getFar() is calling your getFar()? Is it an overload or override of a method from a parent class? Is mRenderer being reassigned to a different instance with a different value for far?

Upvotes: 1

Related Questions