ReactOS 0.4.15-dev-7942-gd23573b
ceil.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS API tests
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: Tests for ceil / ceilf
5 * COPYRIGHT: Copyright 2021 Timo Kreuzer <timo.kreuzer@reactos.org>
6 */
7
8#if !defined(_CRTBLD) && !defined(_M_IX86)
9#define _CRTBLD // we don't want inline ceilf!
10#endif
11#include "math_helpers.h"
12
13#ifdef _MSC_VER
14#pragma function(ceil)
15// ceilf is not available as an intrinsic
16#endif
17
19{
20 /* Special values */
21 { 0x0000000000000000 /* 0.000000000000000e+000 */, 0x0000000000000000 /* 0.000000000000000e+000 */ },
22 { 0x8000000000000000 /* -0.000000000000000e+000 */, 0x8000000000000000 /* 0.000000000000000e+000 */ },
23 { 0x7ff0000000000000 /* 1.#INF00000000000e+000 */, 0x7ff0000000000000 /* 1.#INF00000000000e+000 */ },
24 { 0x7ff0000000000001 /* 1.#QNAN0000000000e+000 */, 0x7ff8000000000001 /* 1.#QNAN0000000000e+000 */ },
25 { 0x7ff7ffffffffffff /* 1.#QNAN0000000000e+000 */, 0x7fffffffffffffff /* 1.#QNAN0000000000e+000 */ },
26 { 0x7ff8000000000000 /* 1.#QNAN0000000000e+000 */, 0x7ff8000000000000 /* 1.#QNAN0000000000e+000 */ },
27 { 0x7ff8000000000001 /* 1.#QNAN0000000000e+000 */, 0x7ff8000000000001 /* 1.#QNAN0000000000e+000 */ },
28 { 0x7fffffffffffffff /* 1.#QNAN0000000000e+000 */, 0x7fffffffffffffff /* 1.#QNAN0000000000e+000 */ },
29 { 0xfff0000000000000 /* -1.#INF00000000000e+000 */, 0xfff0000000000000 /* -1.#INF00000000000e+000 */ },
30 { 0xfff0000000000001 /* -1.#QNAN0000000000e+000 */, 0xfff8000000000001 /* -1.#QNAN0000000000e+000 */ },
31 { 0xfff7ffffffffffff /* -1.#QNAN0000000000e+000 */, 0xffffffffffffffff /* -1.#QNAN0000000000e+000 */ },
32 { 0xfff8000000000000 /* -1.#IND00000000000e+000 */, 0xfff8000000000000 /* -1.#IND00000000000e+000 */ },
33 { 0xfff8000000000001 /* -1.#QNAN0000000000e+000 */, 0xfff8000000000001 /* -1.#QNAN0000000000e+000 */ },
34 { 0xffffffffffffffff /* -1.#QNAN0000000000e+000 */, 0xffffffffffffffff /* -1.#QNAN0000000000e+000 */ },
35
36 /* Some random floats */
37 { 0x84be2329aed66ce1 /* -7.916792434840887e-286 */, 0x8000000000000000 /* -0.000000000000000e+000 */ },
38 { 0xf1499052ebe9bbf1 /* -5.202012813127544e+237 */, 0xf1499052ebe9bbf1 /* -5.202012813127544e+237 */ },
39 { 0x3cdba6b3993e0c87 /* 1.534948721304537e-015 */, 0x3ff0000000000000 /* 1.000000000000000e+000 */ },
40 { 0x1c0d5e24de47b706 /* 1.484236768428990e-173 */, 0x3ff0000000000000 /* 1.000000000000000e+000 */ },
41 { 0xc84d12b3a68bbb43 /* -1.978609508743937e+040 */, 0xc84d12b3a68bbb43 /* -1.978609508743937e+040 */ },
42 { 0x7d5a031f1f253809 /* 6.645271626742043e+295 */, 0x7d5a031f1f253809 /* 6.645271626742043e+295 */ },
43 { 0xfccbd45d3b45f596 /* -1.388583322422121e+293 */, 0xfccbd45d3b45f596 /* -1.388583322422121e+293 */ },
44 { 0x0a890d1332aedb1c /* 6.517185427488806e-258 */, 0x3ff0000000000000 /* 1.000000000000000e+000 */ },
45 { 0xee509a20fd367840 /* -2.400484647490954e+223 */, 0xee509a20fd367840 /* -2.400484647490954e+223 */ },
46 { 0xf6324912dc497d9e /* -2.249167320514119e+261 */, 0xf6324912dc497d9e /* -2.249167320514119e+261 */ },
47};
48
49
50void Test_ceil(void)
51{
52 int i;
53
54 for (i = 0; i < _countof(s_ceil_tests); i++)
55 {
56 double x = u64_to_dbl(s_ceil_tests[i].x);
57 double z = ceil(x);
59 }
60}
61
63{
64 /* Special values */
65 { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ },
66 { 0x80000000 /* -0.000000e+000 */, 0x80000000 /* 0.000000e+000 */ },
67 { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ },
68 { 0x00000001 /* 1.401298e-045 */, 0x3f800000 /* 1.000000e+000 */ },
69 { 0xffffffff /* -1.#QNAN0e+000 */, 0xffffffff /* -1.#QNAN0e+000 */ },
70 { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ },
71 { 0x00000001 /* 1.401298e-045 */, 0x3f800000 /* 1.000000e+000 */ },
72 { 0xffffffff /* -1.#QNAN0e+000 */, 0xffffffff /* -1.#QNAN0e+000 */ },
73 { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ },
74 { 0x00000001 /* 1.401298e-045 */, 0x3f800000 /* 1.000000e+000 */ },
75 { 0xffffffff /* -1.#QNAN0e+000 */, 0xffffffff /* -1.#QNAN0e+000 */ },
76 { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ },
77 { 0x00000001 /* 1.401298e-045 */, 0x3f800000 /* 1.000000e+000 */ },
78 { 0xffffffff /* -1.#QNAN0e+000 */, 0xffffffff /* -1.#QNAN0e+000 */ },
79
80 /* Some random floats */
81 { 0xf2144fad /* -2.937607e+030 */, 0xf2144fad /* -2.937607e+030 */ },
82 { 0xd0664044 /* -1.545189e+010 */, 0xd0664044 /* -1.545189e+010 */ },
83 { 0xb730c46b /* -1.053615e-005 */, 0x80000000 /* -0.000000e+000 */ },
84 { 0x22a13b32 /* 4.370181e-018 */, 0x3f800000 /* 1.000000e+000 */ },
85 { 0x9d9122f6 /* -3.841733e-021 */, 0x80000000 /* -0.000000e+000 */ },
86 { 0xda1f8be1 /* -1.122708e+016 */, 0xda1f8be1 /* -1.122708e+016 */ },
87 { 0x0299cab0 /* 2.259767e-037 */, 0x3f800000 /* 1.000000e+000 */ },
88 { 0x499d72b9 /* 1.289815e+006 */, 0x499d72c0 /* 1.289816e+006 */ },
89 { 0xc57e802c /* -4.072011e+003 */, 0xc57e8000 /* -4.072000e+003 */ },
90 { 0x80e9d599 /* -2.147430e-038 */, 0x80000000 /* -0.000000e+000 */ },
91};
92
93void Test_ceilf(void)
94{
95 int i;
96
97 for (i = 0; i < _countof(s_ceilf_tests); i++)
98 {
99 float x = u32_to_flt(s_ceilf_tests[i].x);
100 float z = ceilf(x);
102 }
103}
104
106{
107 Test_ceil();
108 Test_ceilf();
109}
#define START_TEST(x)
Definition: atltest.h:75
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint64EXT * result
Definition: glext.h:11304
GLdouble GLdouble z
Definition: glext.h:5874
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_ _CRTIMP double __cdecl ceil(_In_ double x)
#define ok_eq_dbl_exact(func, ullx, z, ullexp)
Definition: math_helpers.h:67
static __inline double u64_to_dbl(UINT64 x)
Definition: math_helpers.h:18
static __inline float u32_to_flt(UINT32 x)
Definition: math_helpers.h:34
#define ok_eq_flt_exact(func, ux, z, uexp)
Definition: math_helpers.h:77
static TESTENTRY_DBL s_ceil_tests[]
Definition: ceil.c:18
void Test_ceil(void)
Definition: ceil.c:50
static TESTENTRY_FLT s_ceilf_tests[]
Definition: ceil.c:62
void Test_ceilf(void)
Definition: ceil.c:93
#define ceilf(x)
Definition: mymath.h:62
#define _countof(array)
Definition: sndvol32.h:68