aboutsummaryrefslogtreecommitdiff
path: root/tests/core/test_rounding.in
blob: af7d90998efe034a08c5cf808ae000949960dce5 (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
#include <stdio.h>
#include <math.h>

int main() {
  printf("%.1f ", round(1.4));
  printf("%.1f ", round(1.6));
  printf("%.1f ", round(-1.4));
  printf("%.1f ", round(-1.6));

  printf("%.1f ", round(1.5));
  printf("%.1f ", round(2.5));
  printf("%.1f ", round(-1.5));
  printf("%.1f ", round(-2.5));

  printf("%ld ", lrint(1.4));
  printf("%ld ", lrint(1.6));
  printf("%ld ", lrint(-1.4));
  printf("%ld ", lrint(-1.6));

  printf("%ld ", lrint(1.5));
  printf("%ld ", lrint(2.5));
  printf("%ld ", lrint(-1.5));
  printf("%ld ", lrint(-2.5));

  return 0;
}