Using the pow() function with integers in C

Pow is a double function, not an integer. As such, it has small rounding errors, and probably calculates 99.999999996375 or so. When you assign it to an int, you lose all data behind the decimal point.

Use doubles for your values, and print doubles (”%lf”), and it will work.

Browse More Popular Posts

Leave a Comment