by
3 8
0
3
199k
1
Top 1% !
Pearl of Wisdom
Specified
Popularity: 8226th place

Published on:

No tags for this snippet yet.
LanguageC
SourceGitHub

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.

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.: 
pow_wtf.c
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/627116/Woe-unto-any-user-that-doesn-t-know-that?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
#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; }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus