4 ms·
"all calculations are performed on doubles" is only true for traditional C. ANSI C permits single precision arithmetic if there are no double precision terms i
by emkemp 14y ago
"all calculations are performed on doubles" is only true for traditional C. ANSI C permits single precision arithmetic if there are no double precision terms involved.
Of course, C89 only provided standard math functions with double precision arguments, but C99 corrected that.
- acqq 14y agoYou are very correct, "permits." In practice the programmer must really be specific in the code, how he writes the constants (doubles are default) which functions he calls (doubles are default) and how he configures compiler (double intermediates were traditionally faster and defaults). There's a nice article on that topic: http://news.ycombinator.com/item?id=5138351 http://news.ycombinator.com/item?id=5138351 And it's just a part of the whole series of the nice FP articles.