~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to gnulib-tests/test-math.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- buffer-read-only: t -*- vi: set ro: */
2
 
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3
1
/* Test of <math.h> substitute.
4
 
   Copyright (C) 2007-2011 Free Software Foundation, Inc.
 
2
   Copyright (C) 2007-2012 Free Software Foundation, Inc.
5
3
 
6
4
   This program is free software: you can redistribute it and/or modify
7
5
   it under the terms of the GNU General Public License as published by
27
25
choke me
28
26
#endif
29
27
 
 
28
#ifndef HUGE_VALF
 
29
# error HUGE_VALF should be defined
 
30
choke me
 
31
#endif
 
32
 
 
33
#ifndef HUGE_VAL
 
34
# error HUGE_VAL should be defined
 
35
choke me
 
36
#endif
 
37
 
 
38
#ifndef HUGE_VALL
 
39
# error HUGE_VALL should be defined
 
40
choke me
 
41
#endif
 
42
 
 
43
#ifndef FP_ILOGB0
 
44
# error FP_ILOGB0 should be defined
 
45
choke me
 
46
#endif
 
47
 
 
48
#ifndef FP_ILOGBNAN
 
49
# error FP_ILOGBNAN should be defined
 
50
choke me
 
51
#endif
 
52
 
 
53
#include <limits.h>
 
54
 
 
55
#include "macros.h"
 
56
 
30
57
#if 0
31
58
/* Check that NAN expands into a constant expression.  */
32
59
static float n = NAN;
36
63
   This is a separate function because IRIX 6.5 "cc -O" miscompiles an
37
64
   'x == x' test.  */
38
65
static int
39
 
numeric_equal (double x, double y)
 
66
numeric_equalf (float x, float y)
 
67
{
 
68
  return x == y;
 
69
}
 
70
static int
 
71
numeric_equald (double x, double y)
 
72
{
 
73
  return x == y;
 
74
}
 
75
static int
 
76
numeric_equall (long double x, long double y)
40
77
{
41
78
  return x == y;
42
79
}
46
83
{
47
84
  double d = NAN;
48
85
  double zero = 0.0;
49
 
  if (numeric_equal (d, d))
50
 
    return 1;
 
86
  ASSERT (!numeric_equald (d, d));
 
87
 
51
88
  d = HUGE_VAL;
52
 
  if (!numeric_equal (d, 1.0 / zero))
53
 
    return 1;
 
89
  ASSERT (numeric_equald (d, 1.0 / zero));
 
90
 
 
91
  ASSERT (numeric_equalf (HUGE_VALF, HUGE_VALF + HUGE_VALF));
 
92
 
 
93
  ASSERT (numeric_equald (HUGE_VAL, HUGE_VAL + HUGE_VAL));
 
94
 
 
95
  ASSERT (numeric_equall (HUGE_VALL, HUGE_VALL + HUGE_VALL));
 
96
 
 
97
  /* Check the value of FP_ILOGB0.  */
 
98
  ASSERT (FP_ILOGB0 == INT_MIN || FP_ILOGB0 == - INT_MAX);
 
99
 
 
100
  /* Check the value of FP_ILOGBNAN.  */
 
101
  ASSERT (FP_ILOGBNAN == INT_MIN || FP_ILOGBNAN == INT_MAX);
 
102
 
54
103
  return 0;
55
104
}