A possible explanation could be that Java just used the same naming convention as C++, which again inherited the names from C.
Java was influenced by C++, which shares the same confusing naming pattern. In C++, the analogy of Float.MIN_VALUE
is std::numeric_limits<T>::min(), which is defined as:
Minimum finite value.
For floating types with denormalization (variable number of exponent bits): minimum positive normalized value.
In C++ that is a potential source of bugs in template code, so later in C++11, they added std::numeric_limits<T>::lowest()
, which is defined as:
Minimum finite value. (since C++11)
For integral types: the same as min().
For floating-point types: implementation-dependent; generally, the negative of max().
But C++ was not the first language. It all goes back to C, which defines FLT_MIN the minimal floating point value.
So, why did C choose to define the minimums of floating point numbers and integers inconsistently?
Not sure, but it could have to do with symmetry (see this answer). For floats, you can use -FLT_MAX (or -Float.MAX_VALUE
). For integers, negating the maximum value is not portable. In fact, it is generally wrong on all modern architectures (where -INT_MAX == INT_MIN + 1
should hold).