Number of precision digits for double in C++ different in windows and Linux. Why? Linux shows more than 20 non-zero precision digits

后端 未结 4 1616
[愿得一人]
[愿得一人] 2021-01-12 20:24

Just did this:

double val1=numeric_limits::max();
cout.precision(70);
cout<<\"\\nVal1: \"<

In Windows I sta

4条回答
  •  不思量自难忘°
    2021-01-12 20:50

    Once you get past the number of digits contained in a double, you're at the mercy of your compiler's library implementation. Different algorithms for converting from binary to decimal will result in different output. Neither can be more accurate than the other.

提交回复
热议问题