From 8fe5dbae4f32bb911f05dc703689bd26df10d29e Mon Sep 17 00:00:00 2001 From: martynas Date: Thu, 24 Jul 2008 09:35:30 +0000 Subject: [PATCH] - add NAN definition (except on VAX) - add C99 real-floating macros fpclassify isfinite isinf isnan isnormal signbit - add C99 macros isgreater isgreaterequal isless islessequal islessgreater isunordered - add function prototypes, __fpclassify __fpclassifyf __fpclassifyl __isfinite __isfinitef __isfinitel __isinf __isinfl __isnan __isnanl __isnormal __isnormalf __isnormall __signbit __signbitf __signbitl ok millert@ --- include/math.h | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/include/math.h b/include/math.h index 024b2c29b81..e1ccb67d222 100644 --- a/include/math.h +++ b/include/math.h @@ -1,4 +1,4 @@ -/* $OpenBSD: math.h,v 1.18 2008/07/22 16:01:46 martynas Exp $ */ +/* $OpenBSD: math.h,v 1.19 2008/07/24 09:35:30 martynas Exp $ */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -37,9 +37,10 @@ typedef __float_t float_t; #define HUGE_VALF ((float)HUGE_VAL) #define HUGE_VALL ((long double)HUGE_VAL) #define INFINITY HUGE_VALF -#if 0 /* XXX */ -#define NAN nan("") -#endif /* XXX */ +#ifndef __vax__ +extern char __nan[]; +#define NAN (*(float *)(void *)__nan) +#endif /* !__vax__ */ #define FP_INFINITE 0x01 #define FP_NAN 0x02 @@ -50,7 +51,6 @@ typedef __float_t float_t; #define FP_ILOGB0 (-INT_MAX) #define FP_ILOGBNAN INT_MAX -#if 0 /* XXX */ #define fpclassify(x) \ ((sizeof (x) == sizeof (float)) ? \ __fpclassifyf(x) \ @@ -95,10 +95,6 @@ typedef __float_t float_t; #define islessgreater(x, y) (!isunordered((x), (y)) && \ ((x) > (y) || (y) > (x))) #define isunordered(x, y) (isnan(x) || isnan(y)) -#else /* XXX */ -extern int isinf(double); -extern int isnan(double); -#endif /* XXX */ #endif /* __ISO_C_VISIBLE >= 1999 */ /* @@ -516,7 +512,6 @@ extern long double fmal(long double, long double, long double); /* * Library implementation */ -#if 0 /* XXX */ extern int __fpclassify(double); extern int __fpclassifyf(float); extern int __fpclassifyl(long double); @@ -533,7 +528,6 @@ extern int __isnormall(long double); extern int __signbit(double); extern int __signbitf(float); extern int __signbitl(long double); -#endif /* XXX */ #if __BSD_VISIBLE && defined(__vax__) extern double infnan(int); -- 2.20.1