Synopsis - Cross-Reference

File: /Synopsis/Parsers/IDL/idlmath.h
  1// -*- c++ -*-
  2//                          Package   : omniidl
  3// idlmath.cc               Created on: 1999/10/19
  4//			    Author    : Duncan Grisby (dpg1)
  5//
  6//    Copyright (C) 1999 AT&T Laboratories Cambridge
  7//
  8//  This file is part of omniidl.
  9//
 10//  omniidl is free software; you can redistribute it and/or modify it
 11//  under the terms of the GNU General Public License as published by
 12//  the Free Software Foundation; either version 2 of the License, or
 13//  (at your option) any later version.
 14//
 15//  This program is distributed in the hope that it will be useful,
 16//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 17//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 18//  General Public License for more details.
 19//
 20//  You should have received a copy of the GNU General Public License
 21//  along with this program; if not, write to the Free Software
 22//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 23//  02111-1307, USA.
 24//
 25// Description:
 26//   
 27//   Floating point maths functions
 28
 29// $Id: idlmath.h,v 1.7.2.1 2003/03/23 21:01:45 dgrisby Exp $
 30// $Log: idlmath.h,v $
 31// Revision 1.7.2.1  2003/03/23 21:01:45  dgrisby
 32// Start of omniORB 4.1.x development branch.
 33//
 34// Revision 1.4.2.3  2002/01/15 16:38:14  dpg1
 35// On the road to autoconf. Dependencies refactored, configure.ac
 36// written. No makefiles yet.
 37//
 38// Revision 1.4.2.2  2000/10/27 16:31:09  dpg1
 39// Clean up of omniidl dependencies and types, from omni3_develop.
 40//
 41// Revision 1.4.2.1  2000/07/17 10:36:04  sll
 42// Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0.
 43//
 44// Revision 1.5  2000/07/13 15:25:53  dpg1
 45// Merge from omni3_develop for 3.0 release.
 46//
 47// Revision 1.2  1999/11/02 17:07:26  dpg1
 48// Changes to compile on Solaris.
 49//
 50// Revision 1.1  1999/10/27 14:05:56  dpg1
 51// *** empty log message ***
 52//
 53
 54#ifndef _idlmath_h_
 55#define _idlmath_h_
 56
 57#include <math.h>
 58#include <idlutil.h>
 59
 60#ifdef HAVE_NAN_H
 61#  include <nan.h>
 62#endif
 63
 64#if defined(HAVE_ISINF) && defined(HAVE_ISINFF) && (defined(HAVE_ISINFL) || !defined(HAS_LongDouble))
 65
 66inline IDL_Boolean IdlFPOverflow(IDL_Double f) {
 67  return isinf(f) || isnan(f);
 68}
 69
 70inline IDL_Boolean IdlFPOverflow(IDL_Float f) {
 71  return isinff(f) || isnanf(f);
 72}
 73#  ifdef HAS_LongDouble
 74inline IDL_Boolean IdlFPOverflow(IDL_LongDouble f) {
 75  return isinfl(f) || isnanl(f);
 76}
 77#  endif
 78
 79#elif defined(HAVE_ISNANORINF)
 80
 81inline IDL_Boolean IdlFPOverflow(IDL_Float f) {
 82  double d = f;
 83  return IsNANorINF(d);
 84}
 85inline IDL_Boolean IdlFPOverflow(IDL_Double f) {
 86  return IsNANorINF(f);
 87}
 88#ifdef HAS_LongDouble
 89inline IDL_Boolean IdlFPOverflow(IDL_LongDouble f) {
 90  return 0;
 91}
 92#endif
 93
 94#else // No FP overflow detection
 95
 96inline IDL_Boolean IdlFPOverflow(IDL_Float f) {
 97  return 0;
 98}
 99inline IDL_Boolean IdlFPOverflow(IDL_Double f) {
100  return 0;
101}
102#ifdef HAS_LongDouble
103inline IDL_Boolean IdlFPOverflow(IDL_LongDouble f) {
104  return 0;
105}
106#endif
107
108#endif
109
110#endif // _idlmath_h_