Results 1 to 2 of 2
- 01-19-2011, 05:08 PM #1
Senior Member
- Join Date
- Jan 2011
- Location
- Bangalore, India
- Posts
- 102
- Rep Power
- 0
ERROR : possible loss of precision
Hi all,
I tried to initialize a decimal value as shown below
It gives compiler error "possible loss of precision"Java Code:float a = 30.9;
But when I did typecasting as shown below it worked
Seems like it is interpreting 30.9 as double.Java Code:float a = (float)30.9;
In C and C++ it is okay to declare float variables as above.
How is this different in Java? Could anyone please help.
- 01-19-2011, 05:17 PM #2
Senior Member
- Join Date
- Nov 2010
- Posts
- 210
- Rep Power
- 3
Similar Threads
-
Possible Loss of Precision?
By jwb4291 in forum New To JavaReplies: 6Last Post: 12-02-2010, 04:28 AM -
Possible loss of precision
By jankidudel in forum New To JavaReplies: 2Last Post: 08-07-2010, 10:15 AM -
possible loss of precision?
By gandalf5166 in forum New To JavaReplies: 6Last Post: 04-13-2010, 08:21 PM -
help me- loss of precision error??
By j2vdk in forum New To JavaReplies: 6Last Post: 09-01-2008, 09:23 AM -
Connection Loss
By CrazyShells Slam in forum New To JavaReplies: 0Last Post: 05-15-2008, 02:56 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks