0

In JVM float value stores in binary system. But how it exactly stored? In example.

int value = Math.pow(10,8) + 1;

float f = value;

int back = (int)f;

back value is equal to 10^8. Where is 1

  • https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.3.1 – SBI Feb 24 '17 at 12:01
  • You should read IEEE 758 https://en.wikipedia.org/wiki/IEEE_floating_point – Aubin Feb 24 '17 at 12:01
  • Do study the 3 links above. As near as dammit is to swearing, a `float` can only store 7 significant figures of data. Hence `1` is not significant in a number with magnitude 10e8. As for how it's stored, study the first link. – Bathsheba Feb 24 '17 at 12:10

0 Answers0