From c8e1897c969ce43b551c29d65bc605f175c01263 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Thu, 2 Jul 2009 19:48:34 +0000 Subject: Update trio to CVS checkout of 2009-07-02. svn path=/branches/BRANCH_6-3/; revision=5370 --- trio/trionan.h | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 117 insertions(+), 15 deletions(-) (limited to 'trio/trionan.h') diff --git a/trio/trionan.h b/trio/trionan.h index 3fbed375..a38b1cc2 100644 --- a/trio/trionan.h +++ b/trio/trionan.h @@ -1,6 +1,6 @@ /************************************************************************* * - * $Id: trionan.h,v 1.7 2002/05/04 14:26:44 breese Exp $ + * $Id: trionan.h,v 1.9 2005/03/27 18:52:45 breese Exp $ * * Copyright (C) 2001 Bjorn Reese * @@ -15,8 +15,8 @@ * ************************************************************************/ -#ifndef TRIO_NAN_H -#define TRIO_NAN_H +#ifndef TRIO_TRIONAN_H +#define TRIO_TRIONAN_H #include "triodef.h" @@ -24,6 +24,13 @@ extern "C" { #endif +#if !defined(TRIO_PUBLIC_NAN) +# if !defined(TRIO_PUBLIC) +# define TRIO_PUBLIC +# endif +# define TRIO_PUBLIC_NAN TRIO_PUBLIC +#endif + enum { TRIO_FP_INFINITE, TRIO_FP_NAN, @@ -32,50 +39,145 @@ enum { TRIO_FP_ZERO }; +/************************************************************************* + * Dependencies + */ + +#if defined(TRIO_EMBED_NAN) + +/* + * The application that trionan is embedded in must define which functions + * it uses. + * + * The following resolves internal dependencies. + */ + +# if defined(TRIO_FUNC_ISNAN) \ + || defined(TRIO_FUNC_ISINF) +# if !defined(TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT) +# define TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT +# endif +# endif + +# if defined(TRIO_FUNC_NAN) +# if !defined(TRIO_FUNC_PINF) +# define TRIO_FUNC_PINF +# endif +# endif + +# if defined(TRIO_FUNC_NINF) +# if !defined(TRIO_FUNC_PINF) +# define TRIO_FUNC_PINF +# endif +# endif + +#else + +/* + * When trionan is not embedded all all functions are defined. + */ + +# define TRIO_FUNC_NAN +# define TRIO_FUNC_PINF +# define TRIO_FUNC_NINF +# define TRIO_FUNC_NZERO +# define TRIO_FUNC_ISNAN +# define TRIO_FUNC_ISINF +# define TRIO_FUNC_ISFINITE +# define TRIO_FUNC_SIGNBIT +# define TRIO_FUNC_FPCLASSIFY +# define TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT + +#endif + +/************************************************************************* + * Functions + */ + /* * Return NaN (Not-a-Number). */ -TRIO_PUBLIC double trio_nan TRIO_PROTO((void)); +#if defined(TRIO_FUNC_NAN) +TRIO_PUBLIC_NAN double +trio_nan +TRIO_PROTO((void)); +#endif /* * Return positive infinity. */ -TRIO_PUBLIC double trio_pinf TRIO_PROTO((void)); +#if defined(TRIO_FUNC_PINF) +TRIO_PUBLIC_NAN double +trio_pinf +TRIO_PROTO((void)); +#endif /* * Return negative infinity. */ -TRIO_PUBLIC double trio_ninf TRIO_PROTO((void)); - +#if defined(TRIO_FUNC_NINF) +TRIO_PUBLIC_NAN double +trio_ninf +TRIO_PROTO((void)); +#endif + /* * Return negative zero. */ -TRIO_PUBLIC double trio_nzero TRIO_PROTO((TRIO_NOARGS)); +#if defined(TRIO_FUNC_NZERO) +TRIO_PUBLIC_NAN double +trio_nzero +TRIO_PROTO((TRIO_NOARGS)); +#endif /* * If number is a NaN return non-zero, otherwise return zero. */ -TRIO_PUBLIC int trio_isnan TRIO_PROTO((double number)); +#if defined(TRIO_FUNC_ISNAN) +TRIO_PUBLIC_NAN int +trio_isnan +TRIO_PROTO((double number)); +#endif /* * If number is positive infinity return 1, if number is negative * infinity return -1, otherwise return 0. */ -TRIO_PUBLIC int trio_isinf TRIO_PROTO((double number)); +#if defined(TRIO_FUNC_ISINF) +TRIO_PUBLIC_NAN int +trio_isinf +TRIO_PROTO((double number)); +#endif /* * If number is finite return non-zero, otherwise return zero. */ -TRIO_PUBLIC int trio_isfinite TRIO_PROTO((double number)); +#if defined(TRIO_FUNC_ISFINITE) +TRIO_PUBLIC_NAN int +trio_isfinite +TRIO_PROTO((double number)); +#endif -TRIO_PUBLIC int trio_signbit TRIO_PROTO((double number)); +#if defined(TRIO_FUNC_SIGNBIT) +TRIO_PUBLIC_NAN int +trio_signbit +TRIO_PROTO((double number)); +#endif -TRIO_PUBLIC int trio_fpclassify TRIO_PROTO((double number)); +#if defined(TRIO_FUNC_FPCLASSIFY) +TRIO_PUBLIC_NAN int +trio_fpclassify +TRIO_PROTO((double number)); +#endif -TRIO_PUBLIC int trio_fpclassify_and_signbit TRIO_PROTO((double number, int *is_negative)); +#if defined(TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT) +TRIO_PUBLIC_NAN int +trio_fpclassify_and_signbit +TRIO_PROTO((double number, int *is_negative)); +#endif #ifdef __cplusplus } #endif -#endif /* TRIO_NAN_H */ +#endif /* TRIO_TRIONAN_H */ -- cgit v1.2.3