summaryrefslogtreecommitdiff
path: root/c/float.c
blob: f02a177f4cfd3e471a7763484b607eb97cea8ae7 (plain)
1
2
3
4
5
6
7
8
9
10
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);
}