floating_fudge.h

00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * floating_fudge.h - A bunch of shims, to use double maths
00005  *                    functions on platforms which lack the
00006  *                    float versions with an 'f' at the end,
00007  *                    and to deal with the vaguaries of lrint().
00008  *
00009  * Written by Steve Underwood <steveu@coppice.org>
00010  *
00011  * Copyright (C) 2008 Steve Underwood
00012  *
00013  * All rights reserved.
00014  *
00015  * This program is free software; you can redistribute it and/or modify
00016  * it under the terms of the GNU Lesser General Public License version 2.1,
00017  * as published by the Free Software Foundation.
00018  *
00019  * This program is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  * GNU Lesser General Public License for more details.
00023  *
00024  * You should have received a copy of the GNU Lesser General Public
00025  * License along with this program; if not, write to the Free Software
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00027  */
00028 
00029 #if !defined(_FLOATING_FUDGE_H_)
00030 #define _FLOATING_FUDGE_H_
00031 
00032 #if defined(__cplusplus)
00033 extern "C"
00034 {
00035 #endif
00036 
00037 #if !defined(HAVE_SINF)
00038 static __inline__ float sinf(float x)
00039 {
00040         return (float) sin((double) x);
00041 }
00042 #endif
00043 
00044 #if !defined(HAVE_COSF)
00045 static __inline__ float cosf(float x)
00046 {
00047         return (float) cos((double) x);
00048 }
00049 #endif
00050 
00051 #if !defined(HAVE_TANF)
00052 static __inline__ float tanf(float x)
00053 {
00054         return (float) tan((double) x);
00055 }
00056 #endif
00057 
00058 #if !defined(HAVE_ASINF)
00059 static __inline__ float asinf(float x)
00060 {
00061         return (float) asin((double) x);
00062 }
00063 #endif
00064 
00065 #if !defined(HAVE_ACOSF)
00066 static __inline__ float acosf(float x)
00067 {
00068         return (float) acos((double) x);
00069 }
00070 #endif
00071 
00072 #if !defined(HAVE_ATANF)
00073 static __inline__ float atanf(float x)
00074 {
00075         return (float) atan((double) x);
00076 }
00077 
00078 #endif
00079 
00080 #if !defined(HAVE_ATAN2F)
00081 static __inline__ float atan2f(float y, float x)
00082 {
00083         return (float) atan2((double) y, (double) x);
00084 }
00085 
00086 #endif
00087 
00088 #if !defined(HAVE_CEILF)
00089 static __inline__ float ceilf(float x)
00090 {
00091         return (float) ceil((double) x);
00092 }
00093 #endif
00094 
00095 #if !defined(HAVE_FLOORF)
00096 static __inline__ float floorf(float x)
00097 {
00098         return (float) floor((double) x);
00099 }
00100 
00101 #endif
00102 
00103 #if !defined(HAVE_POWF)
00104 static __inline__ float powf(float x, float y)
00105 {
00106     return (float) pow((double) x, (double) y);
00107 }
00108 #endif
00109 
00110 #if !defined(HAVE_EXPF)
00111 static __inline__ float expf(float x)
00112 {
00113     return (float) expf((double) x);
00114 }
00115 #endif
00116 
00117 #if !defined(HAVE_LOGF)
00118 static __inline__ float logf(float x)
00119 {
00120         return (float) logf((double) x);
00121 }
00122 #endif
00123 
00124 #if !defined(HAVE_LOG10F)
00125 static __inline__ float log10f(float x)
00126 {
00127     return (float) log10((double) x);
00128 }
00129 #endif
00130 
00131 #if defined(__cplusplus)
00132 }
00133 #endif
00134 
00135 #endif
00136 
00137 /*- End of file ------------------------------------------------------------*/

Generated on Wed Feb 8 18:38:18 2012 for spandsp by  doxygen 1.4.7