casa
$Rev:20696$
|
00001 //# math.h: Interim solution for standard/nonstandard system cmath 00002 //# Copyright (C) 2001,2002 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: math.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $ 00027 00028 #ifndef CASA_STD_MATH_H 00029 #define CASA_STD_MATH_H 00030 00031 //# Define the C standard C++ include file. 00032 //# This is an interim solution to cater for the SGI non-existence of 00033 //# them (e.g. <cstring>) 00034 00035 //# Make sure any special macros are set 00036 #include <casa/aips.h> 00037 00038 #if defined(__APPLE__) || defined(AIPS_DARWIN) 00039 #include <math.h> 00040 #include <ostream> 00041 #include <cmath> 00042 namespace casa { //# NAMESPACE CASA - BEGIN 00043 using std::isnan; 00044 using std::isinf; 00045 using std::isfinite; 00046 } //# NAMESPACE CASA - END 00047 #endif 00048 00049 #if defined(AIPS_SGI) || defined(AIPS_SUN_NATIVE) 00050 # include <math.h> 00051 #else 00052 # include <cmath> 00053 # if !defined(AIPS_INTELCC) 00054 namespace casa { //# NAMESPACE CASA - BEGIN 00055 using std::abs; 00056 } //# NAMESPACE CASA - END 00057 # endif 00058 # if !(defined(AIPS_KAICC) || defined(AIPS_GCC3) || defined(AIPS_GCC4) || defined(AIPS_INTELCC) || defined(AIPS_DARWIN) || defined(AIPS_CRAY_PGI)) 00059 # define NEEDS_POWFLOATFLOAT 00060 # endif 00061 #endif 00062 00063 namespace casa { //# NAMESPACE CASA - BEGIN 00064 00065 using std::abs; 00066 using std::fabs; 00067 using std::cos; 00068 using std::cosh; 00069 using std::sin; 00070 using std::sinh; 00071 using std::tan; 00072 using std::tanh; 00073 using std::asin; 00074 using std::acos; 00075 using std::atan; 00076 using std::atan2; 00077 using std::exp; 00078 using std::log; 00079 using std::log10; 00080 using std::sqrt; 00081 using std::pow; 00082 using std::floor; 00083 using std::ceil; 00084 using std::fmod; 00085 using ::erf; 00086 using ::erfc; 00087 //# The following is not yet part of some of the cmath include file. Should be 00088 //# removed at some stage 00089 # if defined(NEEDS_POWFLOATFLOAT) 00090 inline Float pow(Float f1, Float f2) 00091 { return Float(pow(Double(f1), Double(f2))); }; 00092 # endif 00093 00094 //# No float abs defined on the Cray. 00095 #if defined(AIPS_CRAY_PGI) 00096 inline float abs(float v) 00097 { return fabs(v); } 00098 #endif 00099 00100 00101 } //# NAMESPACE CASA - END 00102 00103 #endif