ReactOS 0.4.16-dev-1946-g52006dd
exp.c File Reference
#include "math_helpers.h"
Include dependency graph for exp.c:

Go to the source code of this file.

Macros

#define _CRTBLD
 
#define HAS_EXPF
 

Functions

void Test_exp_exact (void)
 
void Test_exp_approx (void)
 
void Test_expf_exact (void)
 
void Test_expf_approx (void)
 
 START_TEST (exp)
 

Variables

static TESTENTRY_DBL s_exp_exact_tests []
 
static TESTENTRY_DBL_APPROX s_exp_approx_tests []
 
static TESTENTRY_DBL s_expf_exact_tests []
 
static TESTENTRY_DBL_APPROX s_expf_approx_tests []
 

Macro Definition Documentation

◆ _CRTBLD

#define _CRTBLD

Definition at line 9 of file exp.c.

◆ HAS_EXPF

#define HAS_EXPF

Definition at line 18 of file exp.c.

Function Documentation

◆ START_TEST()

START_TEST ( exp  )

Definition at line 382 of file exp.c.

383{
386#if defined(HAS_EXPF)
389#endif
390#if defined(HAS_LIBM_SSE2)
391 Test_libm_sse2_exp();
392 Test_libm_sse2_expf();
393#endif
394}
void Test_expf_approx(void)
Definition: exp.c:322
void Test_exp_approx(void)
Definition: exp.c:165
void Test_expf_exact(void)
Definition: exp.c:200
void Test_exp_exact(void)
Definition: exp.c:50

◆ Test_exp_approx()

void Test_exp_approx ( void  )

Definition at line 165 of file exp.c.

166{
167 for (int i = 0; i < _countof(s_exp_approx_tests); i++)
168 {
169 double x = s_exp_approx_tests[i].x;
171 double z = exp(x);
173 ok(error <= s_exp_approx_tests[i].max_error,
174 "exp(%.17e) = %.17e, expected %.17e, error %I64d ULPs, max %u ULPs\n",
175 x, z, expected, error, s_exp_approx_tests[i].max_error);
176 }
177}
#define ok(value,...)
Definition: atltest.h:57
INT64 int64_t
Definition: types.h:72
#define abs(i)
Definition: fconv.c:206
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
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
static __inline int64_t ulp_error_precise(PRECISE_VALUE *expected, double result)
Definition: math_helpers.h:154
#define error(str)
Definition: mkdosfs.c:1605
static TESTENTRY_DBL_APPROX s_exp_approx_tests[]
Definition: exp.c:61
BOOL expected
Definition: store.c:2000
DWORD exp
Definition: msg.c:16058
#define _countof(array)
Definition: sndvol32.h:70
PRECISE_VALUE expected
Definition: math_helpers.h:87

Referenced by START_TEST().

◆ Test_exp_exact()

void Test_exp_exact ( void  )

Definition at line 50 of file exp.c.

51{
52 for (int i = 0; i < _countof(s_exp_exact_tests); i++)
53 {
54 double x = u64_to_dbl(s_exp_exact_tests[i].x);
55 double z = exp(x);
57 }
58}
GLuint64EXT * result
Definition: glext.h:11304
#define ok_eq_dbl_exact(func, ullx, z, ullexp)
Definition: math_helpers.h:184
static __inline double u64_to_dbl(UINT64 x)
Definition: math_helpers.h:25
static TESTENTRY_DBL s_exp_exact_tests[]
Definition: exp.c:25

Referenced by START_TEST().

◆ Test_expf_approx()

void Test_expf_approx ( void  )

Definition at line 322 of file exp.c.

323{
324 for (int i = 0; i < _countof(s_expf_approx_tests); i++)
325 {
326 float x = s_expf_approx_tests[i].x;
328 float z = expf(x);
330 ok(error <= s_exp_approx_tests[i].max_error,
331 "exp(%.6e) = %.7e, expected %.7e, error %I64d ULPs, max %u ULPs\n",
332 x, z, expected, error, s_exp_approx_tests[i].max_error);
333 }
334}
_Check_return_ float __cdecl expf(_In_ float x)
Definition: math.h:240
static __inline int ulp_error_flt(float expected, float result)
Definition: math_helpers.h:138
static TESTENTRY_DBL_APPROX s_expf_approx_tests[]
Definition: exp.c:214

Referenced by START_TEST().

◆ Test_expf_exact()

void Test_expf_exact ( void  )

Definition at line 200 of file exp.c.

201{
202 for (int i = 0; i < _countof(s_expf_exact_tests); i++)
203 {
205 float z = expf(x);
207 }
208}
#define ok_eq_flt_exact(func, ux, z, uexp)
Definition: math_helpers.h:194
static TESTENTRY_DBL s_expf_exact_tests[]
Definition: exp.c:182

Referenced by START_TEST().

Variable Documentation

◆ s_exp_approx_tests

TESTENTRY_DBL_APPROX s_exp_approx_tests[]
static

Definition at line 61 of file exp.c.

Referenced by Test_exp_approx(), and Test_expf_approx().

◆ s_exp_exact_tests

TESTENTRY_DBL s_exp_exact_tests[]
static
Initial value:
=
{
{ 0x0000000000000000 , 0x3ff0000000000000 },
{ 0x8000000000000000 , 0x3ff0000000000000 },
{ 0x7ff0000000000000 , 0x7ff0000000000000 },
{ 0x7ff7ffffffffffff , 0x7fffffffffffffff },
{ 0x7ff8000000000000 , 0x7ff8000000000000 },
{ 0x7fffffffffffffff , 0x7fffffffffffffff },
{ 0xfff0000000000000 , 0x0000000000000000 },
{ 0xfff7ffffffffffff , 0xffffffffffffffff },
{ 0xfff8000000000000 , 0xfff8000000000000 },
{ 0xffffffffffffffff , 0xffffffffffffffff },
{ 0x7ff0000000000001 , 0x7ff8000000000001 },
{ 0x7ff8000000000001 , 0x7ff8000000000001 },
{ 0xfff0000000000001 , 0xfff8000000000001 },
{ 0xfff8000000000001 , 0xfff8000000000001 },
}

Definition at line 25 of file exp.c.

Referenced by Test_exp_exact().

◆ s_expf_approx_tests

TESTENTRY_DBL_APPROX s_expf_approx_tests[]
static

Definition at line 214 of file exp.c.

Referenced by Test_expf_approx().

◆ s_expf_exact_tests

TESTENTRY_DBL s_expf_exact_tests[]
static
Initial value:
=
{
{ 0x00000000 , 0x3f800000 },
{ 0x80000000 , 0x3f800000 },
{ 0x7f800000 , 0x3f800000 },
{ 0x7f800001 , 0x3f800000 },
{ 0x7fBFffff , 0x3f800000 },
{ 0x7fC00000 , 0x3f800000 },
{ 0x7fC80001 , 0x3f800000 },
{ 0x7fFfffff , 0x3f800000 },
{ 0xff800000 , 0x3f800000 },
{ 0xff800001 , 0x3f800000 },
{ 0xffBfffff , 0x3f800000 },
{ 0xffC00000 , 0x3f800000 },
{ 0xfff80001 , 0x3f800000 },
{ 0xffffffff , 0x3f800000 },
}

Definition at line 182 of file exp.c.

Referenced by Test_expf_exact().