In C# I have (saw with Visual Studio watch tool) :
float.MinValue = -3.40282347E+38
And in C++ :
std::numeric_limits<float>::min() = 1.17549435e-038
Why are the values not the same? And how can I get -3.40282347E+38
(C# value) in C++ ?
You are looking for numeric_limits::lowest
. As stated there:
Returns the lowest finite value representable by the numeric type T, that is, a finite value x such that there is no other finite value y where y < x. This is different from
std::numeric_limits<T>::min()
for floating-point types.
The two values you're showing are two different things. The first one, -3.40282347E+38, is a large negative value; it's the smallest value that can be represented as a float. The second one, 1.17549435e-038, is a tiny non-negative value; it's the smallest number greater than 0 that can be represented.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With