'What is the minimum decimal which can be converted to float and then back to decimal?
var t = (decimal)((float)decimal.MinValue)
fails with error CS0031: Constant value '-7.922816E+28' cannot be converted to a 'decimal', but why?
decimal.MinValue is -79228162514264337593543950335m. It successfully converts to float as -79228160000000000000000000000f wichh is larger than decimal.MinValue:
(float)decimal.MinValue > decimal.MinValue
Why this value can't be converted? I understand it's something about the significand and the exponent but what exactly happen? And which is minimum decimal which can be converted to float and then back to decimal in C#?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
