c - pow() cast to integer, unexpected result -
i have problems using integer cast pow()
function in c programming language. compiler i'm using tiny c compiler (tcc version 0.9.24) windows platform. when executing following code, outputs unexpected result 100, 99
:
#include <stdio.h> #include <math.h> int main(void) { printf("%d, ", (int) pow(10, 2)); printf("%d", (int) pow(10, 2)); return 0; }
however, @ this online compiler output expected: 100, 100
. don't know causing behavior. thoughts? programming error me, compiler bug?
you found bug in tcc. that. patch has been commited repository. included in next release, might take while. can of course pull source , build yourself. patch here
http://repo.or.cz/w/tinycc.git/commitdiff/73faaea227a53e365dd75f1dba7a5071c7b5e541
Comments
Post a Comment