• Post Reply Bookmark Topic Watch Topic
  • New Topic

Loss of precision  RSS feed

 
asha ganapathy
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When compile this piece of code..


I get this compile error.."Possible loss of precision"
though i am explicitly casting a long variable to an int.
If i use float instead of long then there is no compile error.
Can anyone explain me about this issue.

Thanks in advance
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16028
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by asha ganapathy:
I get this compile error.."Possible loss of precision"

Are you sure? I copied and pasted your code, compiled it (using JDK 6) and I did not get any compile errors, nor warnings.

Which Java version are you using?
 
asha ganapathy
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using jdk 1.5, i have not tried in 6.
 
asha ganapathy
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh!! i tried this today..i am not getting the error.
No idea how i got that error yesterday :roll:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!