test-fmaxmin.c (216221) | test-fmaxmin.c (216222) |
---|---|
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 216221 2010-12-05 23:50:49Z das $"); | 32__FBSDID("$FreeBSD: head/tools/regression/lib/msun/test-fmaxmin.c 216222 2010-12-06 00:02:49Z das $"); |
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) --- 4 unchanged lines hidden (view full) --- 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 | 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) --- 4 unchanged lines hidden (view full) --- 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)) || (isnan(x) && isnan(y))); | 53 return ((x == y && !signbit(x) == !signbit(y)) 54 || (isnan(x) && isnan(y))); |
54} 55 56/* 57 * Test whether func(x, y) has the expected result, and make sure no 58 * exceptions are raised. 59 */ 60#define TEST(func, type, x, y, expected) do { \ 61 type __x = (x); /* convert before we clear exceptions */ \ --- 88 unchanged lines hidden --- | 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 */ \ --- 88 unchanged lines hidden --- |