像这样转换浮点数的任何聪明方法:
float f = 711989.98f;
变成十进制(或双精度)而不失精度?
我试过了:
decimal d = (decimal)f; decimal d1 = (decimal)(Math.Round(f,2)); decimal d2 = Convert.ToDecimal(f);
c# floating-point precision
c# ×1
floating-point ×1
precision ×1