| Author |
loss of precision error
|
Puneet N Vyas
Ranch Hand
Joined: Sep 20, 2007
Posts: 61
|
|
when we compile this it gives possible loss of precision which is obvious,but why this same code runs in other language c/c++,i run it on linux based gcc compiler,can any one tell why this happens
|
 |
Ronald Schild
Ranch Hand
Joined: Jun 09, 2008
Posts: 117
|
|
It compiles in other languages because there are differences between java and say, c++. However, with c=(c+i) you assign an integer to a char which is a downcast that you need to make explicit. All numbers are implicitly widened to an int when used in a calculation. The result is also at least an int.
|
Java hobbyist.
|
 |
 |
|
|
subject: loss of precision error
|
|
|