/*************************************************************************1*2* $Id$3*4* Copyright (C) 2001 Bjorn Reese <[email protected]>5*6* Permission to use, copy, modify, and distribute this software for any7* purpose with or without fee is hereby granted, provided that the above8* copyright notice and this permission notice appear in all copies.9*10* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED11* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF12* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND13* CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.14*15************************************************************************/1617#ifndef TRIO_TRIONAN_H18#define TRIO_TRIONAN_H1920#include "triodef.h"2122#ifdef __cplusplus23extern "C" {24#endif2526#if !defined(TRIO_PUBLIC_NAN)27# if !defined(TRIO_PUBLIC)28# define TRIO_PUBLIC29# endif30# define TRIO_PUBLIC_NAN TRIO_PUBLIC31#endif3233enum {34TRIO_FP_INFINITE,35TRIO_FP_NAN,36TRIO_FP_NORMAL,37TRIO_FP_SUBNORMAL,38TRIO_FP_ZERO39};4041/*************************************************************************42* Dependencies43*/4445#if defined(TRIO_EMBED_NAN)4647/*48* The application that trionan is embedded in must define which functions49* it uses.50*51* The following resolves internal dependencies.52*/5354# if defined(TRIO_FUNC_ISNAN) \55|| defined(TRIO_FUNC_ISINF)56# if !defined(TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT)57# define TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT58# endif59# endif6061# if defined(TRIO_FUNC_NAN)62# if !defined(TRIO_FUNC_PINF)63# define TRIO_FUNC_PINF64# endif65# endif6667# if defined(TRIO_FUNC_NINF)68# if !defined(TRIO_FUNC_PINF)69# define TRIO_FUNC_PINF70# endif71# endif7273#else7475/*76* When trionan is not embedded all all functions are defined.77*/7879# define TRIO_FUNC_NAN80# define TRIO_FUNC_PINF81# define TRIO_FUNC_NINF82# define TRIO_FUNC_NZERO83# define TRIO_FUNC_ISNAN84# define TRIO_FUNC_ISINF85# define TRIO_FUNC_ISFINITE86# define TRIO_FUNC_SIGNBIT87# define TRIO_FUNC_FPCLASSIFY88# define TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT8990#endif9192/*************************************************************************93* Functions94*/9596/*97* Return NaN (Not-a-Number).98*/99#if defined(TRIO_FUNC_NAN)100TRIO_PUBLIC_NAN double101trio_nan102TRIO_PROTO((void));103#endif104105/*106* Return positive infinity.107*/108#if defined(TRIO_FUNC_PINF)109TRIO_PUBLIC_NAN double110trio_pinf111TRIO_PROTO((void));112#endif113114/*115* Return negative infinity.116*/117#if defined(TRIO_FUNC_NINF)118TRIO_PUBLIC_NAN double119trio_ninf120TRIO_PROTO((void));121#endif122123/*124* Return negative zero.125*/126#if defined(TRIO_FUNC_NZERO)127TRIO_PUBLIC_NAN double128trio_nzero129TRIO_PROTO((TRIO_NOARGS));130#endif131132/*133* If number is a NaN return non-zero, otherwise return zero.134*/135#if defined(TRIO_FUNC_ISNAN)136TRIO_PUBLIC_NAN int137trio_isnan138TRIO_PROTO((double number));139#endif140141/*142* If number is positive infinity return 1, if number is negative143* infinity return -1, otherwise return 0.144*/145#if defined(TRIO_FUNC_ISINF)146TRIO_PUBLIC_NAN int147trio_isinf148TRIO_PROTO((double number));149#endif150151/*152* If number is finite return non-zero, otherwise return zero.153*/154#if defined(TRIO_FUNC_ISFINITE)155TRIO_PUBLIC_NAN int156trio_isfinite157TRIO_PROTO((double number));158#endif159160#if defined(TRIO_FUNC_SIGNBIT)161TRIO_PUBLIC_NAN int162trio_signbit163TRIO_PROTO((double number));164#endif165166#if defined(TRIO_FUNC_FPCLASSIFY)167TRIO_PUBLIC_NAN int168trio_fpclassify169TRIO_PROTO((double number));170#endif171172#if defined(TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT)173TRIO_PUBLIC_NAN int174trio_fpclassify_and_signbit175TRIO_PROTO((double number, int *is_negative));176#endif177178#ifdef __cplusplus179}180#endif181182#endif /* TRIO_TRIONAN_H */183184185