test-fmaxmin.c (216222) | test-fmaxmin.c (251241) |
---|---|
1/*- 2 * Copyright (c) 2008 David Schultz <das@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * SUCH DAMAGE. 25 */ 26 27/* 28 * Tests for fmax{,f,l}() and fmin{,f,l}. 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2008 David Schultz <das@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * SUCH DAMAGE. 25 */ 26 27/* 28 * Tests for fmax{,f,l}() and fmin{,f,l}. 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/tools/regression/lib/msun/test-fmaxmin.c 216222 2010-12-06 00:02:49Z das $"); | 32__FBSDID("$FreeBSD: head/tools/regression/lib/msun/test-fmaxmin.c 251241 2013-06-02 04:30:03Z das $"); |
33 34#include <fenv.h> 35#include <float.h> 36#include <math.h> 37#include <stdio.h> 38 | 33 34#include <fenv.h> 35#include <float.h> 36#include <math.h> 37#include <stdio.h> 38 |
39#define ALL_STD_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \ 40 FE_OVERFLOW | FE_UNDERFLOW) | 39#include "test-utils.h" |
41 42#pragma STDC FENV_ACCESS ON 43 44/* | 40 41#pragma STDC FENV_ACCESS ON 42 43/* |
45 * Test for equality with two special rules: 46 * fpequal(NaN, NaN) is true 47 * fpequal(+0.0, -0.0) is false 48 */ 49static inline int 50fpequal(long double x, long double y) 51{ 52 53 return ((x == y && !signbit(x) == !signbit(y)) 54 || (isnan(x) && isnan(y))); 55} 56 57/* | |
58 * Test whether func(x, y) has the expected result, and make sure no 59 * exceptions are raised. 60 */ 61#define TEST(func, type, x, y, expected) do { \ 62 type __x = (x); /* convert before we clear exceptions */ \ 63 type __y = (y); \ 64 feclearexcept(ALL_STD_EXCEPT); \ 65 long double __result = func((__x), (__y)); \ --- 85 unchanged lines hidden --- | 44 * Test whether func(x, y) has the expected result, and make sure no 45 * exceptions are raised. 46 */ 47#define TEST(func, type, x, y, expected) do { \ 48 type __x = (x); /* convert before we clear exceptions */ \ 49 type __y = (y); \ 50 feclearexcept(ALL_STD_EXCEPT); \ 51 long double __result = func((__x), (__y)); \ --- 85 unchanged lines hidden --- |