On 8/28/2013 5:06 AM, David Mertens wrote:
Hey everyone -
I found this question from somebody use tcc v0.9.24:
http://stackoverflow.com/questions/18417788/pow-cast-to-integer-unexpected-result
The basic question is, "Why does tcc's compilation output (100,
99) whereas other compilers output (100, 100)?"
|#include <stdio.h>
#include <math.h>
int main(void)
{
printf("%d,", (int) pow(10, 2));
printf("%d", (int) pow(10, 2));
return 0;
}|
More useful would be the exact double output from pow(), or dump
the raw bytes too. I'm guessing it's almost 100. Anything that use
native instructions might experience non-exact results because of
the way pow() is calculated. Even old library calls might produce
that.
Most C libs guarantee exact results where the number do not
overflow the available digits of precision by testing and
special-casing for integers.
--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel