Why does gcc compiler output pow(10,2) as 99 not 100? [duplicate]

Because of integer truncation. pow() returns a floating point value, and due to floating point arithmetic, it is probably ~ 99.999...; however, due to integer truncation, even 99.999... gets truncated down to 99.

Leave a Comment