Hacker News new | past | comments | ask | show | jobs | submit login

> Nope. C/C++ think it's OK to use fma when you didn't ask for it with default compiler settings.

No, it doesn't. You have to request #pragma STDC FP_CONTRACT ON explicitly, or use -ffp-contract flag-equivalent (implied by -ffast-math or -Ofast) on most compilers. icc is the only major compiler that actually defaults to fast-math flags.

> Also, with default settings, GCC is willing to replace single precision math with double precision math if it feels like it.

I'm less familiar with gcc than I am with LLVM, but I strongly doubt that this is the case. There is a provision in C/C++ for FLT_EVAL_METHOD, which indicates what the internal precision of arithmetic expressions (which excludes assignments and casts) is, and this is set to 2 on 32-bit x86, because x87 internally operates on all numbers as long double precision, only explicitly rounding to float/double when you tell it to in an extension. But on 64-bit x86, FLT_EVAL_METHOD is 0 (everybody executes according to their own type), because SSE can operate on single- or double-precision numbers directly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: