Blame trio/trionan.h

Packit Service 8f0814
/*************************************************************************
Packit Service 8f0814
 *
Packit Service 8f0814
 * $Id: trionan.h,v 1.9 2005/03/27 18:52:45 breese Exp $
Packit Service 8f0814
 *
Packit Service 8f0814
 * Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
Packit Service 8f0814
 *
Packit Service 8f0814
 * Permission to use, copy, modify, and distribute this software for any
Packit Service 8f0814
 * purpose with or without fee is hereby granted, provided that the above
Packit Service 8f0814
 * copyright notice and this permission notice appear in all copies.
Packit Service 8f0814
 *
Packit Service 8f0814
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
Packit Service 8f0814
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
Packit Service 8f0814
 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
Packit Service 8f0814
 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
Packit Service 8f0814
 *
Packit Service 8f0814
 ************************************************************************/
Packit Service 8f0814
Packit Service 8f0814
#ifndef TRIO_TRIONAN_H
Packit Service 8f0814
#define TRIO_TRIONAN_H
Packit Service 8f0814
Packit Service 8f0814
#include "triodef.h"
Packit Service 8f0814
Packit Service 8f0814
#ifdef __cplusplus
Packit Service 8f0814
extern "C" {
Packit Service 8f0814
#endif
Packit Service 8f0814
Packit Service 8f0814
#if !defined(TRIO_PUBLIC_NAN)
Packit Service 8f0814
# if !defined(TRIO_PUBLIC)
Packit Service 8f0814
#  define TRIO_PUBLIC
Packit Service 8f0814
# endif
Packit Service 8f0814
# define TRIO_PUBLIC_NAN TRIO_PUBLIC
Packit Service 8f0814
#endif
Packit Service 8f0814
  
Packit Service 8f0814
enum {
Packit Service 8f0814
  TRIO_FP_INFINITE,
Packit Service 8f0814
  TRIO_FP_NAN,
Packit Service 8f0814
  TRIO_FP_NORMAL,
Packit Service 8f0814
  TRIO_FP_SUBNORMAL,
Packit Service 8f0814
  TRIO_FP_ZERO
Packit Service 8f0814
};
Packit Service 8f0814
Packit Service 8f0814
/*************************************************************************
Packit Service 8f0814
 * Dependencies
Packit Service 8f0814
 */
Packit Service 8f0814
Packit Service 8f0814
#if defined(TRIO_EMBED_NAN)
Packit Service 8f0814
Packit Service 8f0814
/*
Packit Service 8f0814
 * The application that trionan is embedded in must define which functions
Packit Service 8f0814
 * it uses.
Packit Service 8f0814
 *
Packit Service 8f0814
 * The following resolves internal dependencies.
Packit Service 8f0814
 */
Packit Service 8f0814
  
Packit Service 8f0814
# if defined(TRIO_FUNC_ISNAN) \
Packit Service 8f0814
  || defined(TRIO_FUNC_ISINF)
Packit Service 8f0814
#  if !defined(TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT)
Packit Service 8f0814
#   define TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT
Packit Service 8f0814
#  endif
Packit Service 8f0814
# endif
Packit Service 8f0814
Packit Service 8f0814
# if defined(TRIO_FUNC_NAN)
Packit Service 8f0814
#  if !defined(TRIO_FUNC_PINF)
Packit Service 8f0814
#   define TRIO_FUNC_PINF
Packit Service 8f0814
#  endif
Packit Service 8f0814
# endif
Packit Service 8f0814
  
Packit Service 8f0814
# if defined(TRIO_FUNC_NINF)
Packit Service 8f0814
#  if !defined(TRIO_FUNC_PINF)
Packit Service 8f0814
#   define TRIO_FUNC_PINF
Packit Service 8f0814
#  endif
Packit Service 8f0814
# endif
Packit Service 8f0814
Packit Service 8f0814
#else
Packit Service 8f0814
Packit Service 8f0814
/*
Packit Service 8f0814
 * When trionan is not embedded all all functions are defined.
Packit Service 8f0814
 */
Packit Service 8f0814
  
Packit Service 8f0814
# define TRIO_FUNC_NAN
Packit Service 8f0814
# define TRIO_FUNC_PINF
Packit Service 8f0814
# define TRIO_FUNC_NINF
Packit Service 8f0814
# define TRIO_FUNC_NZERO
Packit Service 8f0814
# define TRIO_FUNC_ISNAN
Packit Service 8f0814
# define TRIO_FUNC_ISINF
Packit Service 8f0814
# define TRIO_FUNC_ISFINITE
Packit Service 8f0814
# define TRIO_FUNC_SIGNBIT
Packit Service 8f0814
# define TRIO_FUNC_FPCLASSIFY
Packit Service 8f0814
# define TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT
Packit Service 8f0814
  
Packit Service 8f0814
#endif
Packit Service 8f0814
Packit Service 8f0814
/*************************************************************************
Packit Service 8f0814
 * Functions
Packit Service 8f0814
 */
Packit Service 8f0814
Packit Service 8f0814
/*
Packit Service 8f0814
 * Return NaN (Not-a-Number).
Packit Service 8f0814
 */
Packit Service 8f0814
#if defined(TRIO_FUNC_NAN)
Packit Service 8f0814
TRIO_PUBLIC_NAN double
Packit Service 8f0814
trio_nan
Packit Service 8f0814
TRIO_PROTO((void));
Packit Service 8f0814
#endif
Packit Service 8f0814
Packit Service 8f0814
/*
Packit Service 8f0814
 * Return positive infinity.
Packit Service 8f0814
 */
Packit Service 8f0814
#if defined(TRIO_FUNC_PINF)
Packit Service 8f0814
TRIO_PUBLIC_NAN double
Packit Service 8f0814
trio_pinf
Packit Service 8f0814
TRIO_PROTO((void));
Packit Service 8f0814
#endif
Packit Service 8f0814
Packit Service 8f0814
/*
Packit Service 8f0814
 * Return negative infinity.
Packit Service 8f0814
 */
Packit Service 8f0814
#if defined(TRIO_FUNC_NINF)
Packit Service 8f0814
TRIO_PUBLIC_NAN double
Packit Service 8f0814
trio_ninf
Packit Service 8f0814
TRIO_PROTO((void));
Packit Service 8f0814
#endif
Packit Service 8f0814
Packit Service 8f0814
/*
Packit Service 8f0814
 * Return negative zero.
Packit Service 8f0814
 */
Packit Service 8f0814
#if defined(TRIO_FUNC_NZERO)
Packit Service 8f0814
TRIO_PUBLIC_NAN double
Packit Service 8f0814
trio_nzero
Packit Service 8f0814
TRIO_PROTO((TRIO_NOARGS));
Packit Service 8f0814
#endif
Packit Service 8f0814
Packit Service 8f0814
/*
Packit Service 8f0814
 * If number is a NaN return non-zero, otherwise return zero.
Packit Service 8f0814
 */
Packit Service 8f0814
#if defined(TRIO_FUNC_ISNAN)
Packit Service 8f0814
TRIO_PUBLIC_NAN int
Packit Service 8f0814
trio_isnan
Packit Service 8f0814
TRIO_PROTO((double number));
Packit Service 8f0814
#endif
Packit Service 8f0814
Packit Service 8f0814
/*
Packit Service 8f0814
 * If number is positive infinity return 1, if number is negative
Packit Service 8f0814
 * infinity return -1, otherwise return 0.
Packit Service 8f0814
 */
Packit Service 8f0814
#if defined(TRIO_FUNC_ISINF)
Packit Service 8f0814
TRIO_PUBLIC_NAN int
Packit Service 8f0814
trio_isinf
Packit Service 8f0814
TRIO_PROTO((double number));
Packit Service 8f0814
#endif
Packit Service 8f0814
Packit Service 8f0814
/*
Packit Service 8f0814
 * If number is finite return non-zero, otherwise return zero.
Packit Service 8f0814
 */
Packit Service 8f0814
#if defined(TRIO_FUNC_ISFINITE)
Packit Service 8f0814
TRIO_PUBLIC_NAN int
Packit Service 8f0814
trio_isfinite
Packit Service 8f0814
TRIO_PROTO((double number));
Packit Service 8f0814
#endif
Packit Service 8f0814
Packit Service 8f0814
#if defined(TRIO_FUNC_SIGNBIT)
Packit Service 8f0814
TRIO_PUBLIC_NAN int
Packit Service 8f0814
trio_signbit
Packit Service 8f0814
TRIO_PROTO((double number));
Packit Service 8f0814
#endif
Packit Service 8f0814
Packit Service 8f0814
#if defined(TRIO_FUNC_FPCLASSIFY)
Packit Service 8f0814
TRIO_PUBLIC_NAN int
Packit Service 8f0814
trio_fpclassify
Packit Service 8f0814
TRIO_PROTO((double number));
Packit Service 8f0814
#endif
Packit Service 8f0814
Packit Service 8f0814
#if defined(TRIO_FUNC_FPCLASSIFY_AND_SIGNBIT)
Packit Service 8f0814
TRIO_PUBLIC_NAN int
Packit Service 8f0814
trio_fpclassify_and_signbit
Packit Service 8f0814
TRIO_PROTO((double number, int *is_negative));
Packit Service 8f0814
#endif
Packit Service 8f0814
Packit Service 8f0814
#ifdef __cplusplus
Packit Service 8f0814
}
Packit Service 8f0814
#endif
Packit Service 8f0814
Packit Service 8f0814
#endif /* TRIO_TRIONAN_H */