Difference between Java's `Double.MIN_NORMAL` and `Double.MIN_VALUE`?

后端 未结 3 1524
星月不相逢
星月不相逢 2020-12-05 12:46

What\'s the difference between Double.MIN_NORMAL (introduced in Java 1.6) and Double.MIN_VALUE?

3条回答
  •  情歌与酒
    2020-12-05 13:24

    The answer can be found in the IEEE specification of floating point representation:

    For the single format, the difference between a normal number and a subnormal number is that the leading bit of the significand (the bit to left of the binary point) of a normal number is 1, whereas the leading bit of the significand of a subnormal number is 0. Single-format subnormal numbers were called single-format denormalized numbers in IEEE Standard 754.

    In other words, Double.MIN_NORMAL is the smallest possible number you can represent, provided that you have a 1 in front of the binary point (what is referred to as decimal point in a decimal system). While Double.MIN_VALUE is basically the smallest number you can represent without this constraint.

提交回复
热议问题