float_fudge.h

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

Generated on Mon Jul 9 00:45:47 2007 for libspandsp by  doxygen 1.5.1