C# rounding differently depending on platform?

后端 未结 4 1628
花落未央
花落未央 2020-12-01 18:29

I have this tiny piece of code

double s = -2.6114289999999998;
double s7 = Math.Round(s, 7);
double s5 = Math.Round(s, 5);
double s6 = Math.Round(s, 6);
         


        
4条回答
  •  自闭症患者
    2020-12-01 18:56

    Answered here : https://stackoverflow.com/a/19978623/4891523

    x64 managed code will use SSE for double/float computation instead of x87 FPU when using x86 managed code.

提交回复
热议问题