Created
April 19, 2016 15:04
-
-
Save emilaxelsson/51310b3353f96914cd9bdb18b10b3103 to your computer and use it in GitHub Desktop.
Test of tgmath.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file demonstrates that if `tgmath.h` is included, it doesn't matter if | |
// `math.h` is also included and which order the include statements appear. | |
#include <stdio.h> | |
#include <tgmath.h> | |
#include <math.h> | |
int main() { | |
printf("%.20f\n", sinf((float) 5.0)); | |
printf("%.20f\n", sin((double) 5.0)); | |
printf("%.20f\n", sin((float) 5.0)); | |
} | |
// The first two lines print the same result regardless of the includes. The | |
// last line behaves like `sinf` if and only if `tgmath.h` is included. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment