float: floating point, with byte number 4,32bit, Value range -3.4e38~3.4e38 (7 significant digits)
Double: dual precision, with a byte number of 8,64bit numeric range -1.7e308~1.7e308 (15 significant digits)
Decimal: Digital type, 128bit, no loss of precision, commonly used in bank account calculation. (28 significant digits)
float F = 345.98756f;//The result is displayed as 345.9876, showing only 7 significant digits, rounded to the last digit.
The double d=345.975423578631442d;//result is displayed as 345.975423578631, showing only 15 significant digits, rounded to the last one.
Note: The multiplication of float and double, digital overflow will not error, there will be a loss of precision.
The decimal dd=345.545454879.....//can support 28-bit, rounded to the last one.
Note: When working with the decimal type, the value will be an error due to overflow.
Float,double and decimal types