Re: [轉錄]Re: [問題]請問如何四捨五入...
※ 引述《Donnie ( XD)》之銘言:
: ※ 引述《yellowfishie (喵喵喵喵~~~)》之銘言:
: : linux:
: : ori: 3.595e+06
: : cast_i: 3594998
: : cast_floor_i: 3594998
: : cast_ceil_i: 3594999
: : solaris:
: : ori: 3.595e+06
: : cast_i: 3594998
: : cast_floor_i: 3594998
: : cast_ceil_i: 3594998
: 我剛發現 ntuplace 在 Intel 和 AMD 的 x86 上結果不同....
http://gcc.gnu.org/ml/gcc/2003-08/msg01183.html
In the process of revamping the non-bugs section of the bug reporting
instructions I came across a problem with the excess precision of the
x86 FPU:
I wanted to construct a very extreme case where rounding leads to
unexpected behaviour and came up with the following example:
============================================
int main()
{
double x=sqrt(2.0);
volatile double y=x;
if (x!=y) printf("Uh oh!\n");
return 0;
}
============================================
Compiling this with GCC 3.3.1 and using -O2 I get the output:
"Uh oh!"
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.5.74
→
03/30 15:25, , 1F
03/30 15:25, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 9 之 10 篇):