aboutsummaryrefslogtreecommitdiff
path: root/tests/core/test_floatvars.in
blob: b6c94c822edd684de2103990d16df30c2cedf5d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>

// headers test, see issue #1013
#include <cfloat>
#include <cmath>

int main(int argc, char **argv) {
  float x = 1.234, y = 3.5, q = 0.00000001;
  y *= 3;
  int z = x < y;
  printf("*%d,%d,%.1f,%d,%.4f,%.2f*\n", z, int(y), y, (int)x, x, q);

  printf("%.2f, %.2f, %.2f, %.2f\n", fmin(0.5, 3.3), fmin(NAN, 3.3),
         fmax(0.5, 3.3), fmax(NAN, 3.3));

  printf("small: %.10f\n", argc * 0.000001);

  /*
  // Rounding behavior
  float fs[6] = { -2.75, -2.50, -2.25, 2.25, 2.50, 2.75 };
  double ds[6] = { -2.75, -2.50, -2.25, 2.25, 2.50, 2.75 };
  for (int i = 0; i < 6; i++)
    printf("*int(%.2f)=%d,%d*\n", fs[i], int(fs[i]), int(ds[i]));
  */

  return 0;
}