-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from futurecore/fix_print_large_float_crash
Deal explicitly with fix(NaN).
- Loading branch information
Showing
10 changed files
with
233 additions
and
50 deletions.
There are no files selected for viewing
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* Some floating point corner cases. */ | ||
#include <float.h> | ||
#include <stdio.h> | ||
#include <stdint.h> | ||
|
||
int main() { | ||
int val_i = 0xffffffff; | ||
float val_f = 0xffffffff; | ||
float convert_f = (float)val_i; | ||
int convert_i = (int)val_f; | ||
printf("Signed integer value = %d, %x\n", val_i, val_i); | ||
printf("Float value = %.*e\n", DECIMAL_DIG, val_f); | ||
printf("Convert float to signed integer: %d, %x\n", convert_i, convert_i); | ||
printf("Convert signed integer to float = %.*e\n", DECIMAL_DIG, convert_f); | ||
return 0; | ||
} |
Binary file not shown.
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
Binary file not shown.
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
Binary file not shown.
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
Oops, something went wrong.