diff options
| author | pants <niklasjo2004@gmail.com> | 2026-09-21 14:17:03 -0700 |
|---|---|---|
| committer | pants <niklasjo2004@gmail.com> | 2026-09-21 14:17:03 -0700 |
| commit | 7b21727285e50b0b050c4ddd70d07542229c5366 (patch) | |
| tree | 5d369153c5df5b41f3750d25479a68f20169c8ff /c/float.c | |
init
Diffstat (limited to 'c/float.c')
| -rw-r--r-- | c/float.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/c/float.c b/c/float.c new file mode 100644 index 0000000..f02a177 --- /dev/null +++ b/c/float.c @@ -0,0 +1,11 @@ +#include <stdio.h> +#include <float.h> + +// this showcases floating point innaccuracy due to needing to represent them in binary + +void main() { + float ye = 6.28; + printf("%.4f\n", ye); + printf("%.8f\n", ye); + printf("%.12f\n", ye); +} |
