Created
March 24, 2021 01:55
-
-
Save Costava/2a223021b720b453070c9584dbf9fbcb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Example compilation: | |
// gcc print_double.c -std=c99 -Wall -Wextra | |
#include <stdio.h> | |
int main(void) { | |
double num; | |
num = 0.25; printf("%f %a\n", num, num);// 0.250000 0x1p-2 | |
num = 0.50; printf("%f %a\n", num, num);// 0.500000 0x1p-1 | |
num = 0.75; printf("%f %a\n", num, num);// 0.750000 0x1.8p-1 | |
num = 0.10; printf("%f %a\n", num, num);// 0.100000 0x1.999999999999ap-4 | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment