Consider the following code:
float value = float.MinValue;
decimal dec = (decimal) value;
Unhandled exception. System.OverflowException: Value was either too large or too small for a Decimal.
The same applies for float.MinValue
, float.MaxValue
, double.MinValue
, and double.MaxValue
.
If float
is 32-bit and double
is 64-bit, why don't their min/max values fit inside a decimal
which is 128-bit?