programmatically finding the size of float

Viewed 2826

Disclaimer: this question may not have practical value, it's more of a puzzle/curiosity question.

In Java I can write the following code to programmatically find the size of 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 Java's float?

3 Answers
Related