Matematicas de Java

Here is an example of a widening conversion that loses precision:

class Test {
public static void main(String[] args) {
int big = 1234567890;
float approx = big;
System.out.println(big – (int)approx);
}
}

which prints:

-46

thus indicating that information was lost during the conversion from type int to type float because values of type float are not precise to nine significant digits.

No hay comentarios »

RSS feed de los comentarios de este post. TrackBack URI

Comentar

Captcha
Enter the letters you see above.

Entradas y comentarios feeds. 19 queries. 0.245 seconds.

60920 pages viewed, 15 today
29269 visits, 10 today
FireStats icon Powered by FireStats