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