Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Woe unto any user that doesn't know that "pow" is a standard library function in C. The C standard allows this inconsistent behavior, sadly (Section 7.1.3 of N1124). I think C++ is better, at least based on how GCC behaves.
#include <stdio.h>
double pow(double x, double y)
{
return x + y;
}
int main()
{
volatile int y = 1;
printf("%f\n", pow(10, y)); // prints 11.000000
printf("%f\n", pow(10, 1)); // prints 10.000000
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.