Disclaimer: This question may not be of practical value, it is more a matter of puzzle / curiosity.
In Java, I can write the following code to programmatically find the size of an int:
public static void main(String[] args) { int x = 1; int count = 1; while((x = x << 1) != 0) { count++; System.out.println("x: " + x + ", " + count); } System.out.println("size: " + count); }
Is there a similar way to programmatically find the size of floating Java?
source share