Ticket #18351: foo.c

File foo.c, 570 bytes (added by bhaible, 20 months ago)

test case

Line 
1#include <math.h>
2#include <float.h>
3#include <limits.h>
4#include <stdio.h>
5#include <stdlib.h>
6
7#define ASSERT(x) do { if (!(x)) abort (); } while (0)
8
9int
10main (void)
11{
12 volatile double x1;
13 volatile long double x2;
14 int y1;
15 int y2;
16
17 x1 = 0.0;
18 y1 = ilogb (x1);
19
20 x2 = 0.0L;
21 y2 = ilogbl (x2);
22
23 printf ("%d %d %d\n", y1, y2, FP_ILOGB0);
24
25 // This assertion failed in Haiku 2017.
26 if (!(y1 == FP_ILOGB0 && y2 == FP_ILOGB0))
27 abort ();
28
29 // This assertion fails in Haiku r1beta4.
30 if (!(FP_ILOGB0 == INT_MIN || FP_ILOGB0 == -INT_MAX))
31 abort ();
32}