Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove libmath

  • Loading branch information...
commit 14ad8baf3a5d3a2cc01698ff3439e5e2894f2f93 1 parent 14a31d4
@sbourdeauducq sbourdeauducq authored
Showing with 1 addition and 1,441 deletions.
  1. +1 −1  Makefile
  2. +0 −86 software/include/base/math.h
  3. +0 −47 software/libmath/Makefile
  4. +0 −35 software/libmath/acosf.c
  5. +0 −85 software/libmath/asincosf.c
  6. +0 −36 software/libmath/asinf.c
  7. +0 −48 software/libmath/atan2f.c
  8. +0 −73 software/libmath/atanf.c
  9. +0 −35 software/libmath/ceilf.c
  10. +0 −33 software/libmath/cosf.c
  11. +0 −32 software/libmath/coshf.c
  12. +0 −44 software/libmath/cotf.c
  13. +0 −89 software/libmath/expf.c
  14. +0 −34 software/libmath/fabsf.c
  15. +0 −35 software/libmath/floorf.c
  16. +0 −40 software/libmath/frexpf.c
  17. +0 −39 software/libmath/ldexpf.c
  18. +0 −30 software/libmath/log10f.c
  19. +0 −69 software/libmath/logf.c
  20. +0 −31 software/libmath/modff.c
  21. +0 −34 software/libmath/powf.c
  22. +0 −89 software/libmath/sincosf.c
  23. +0 −92 software/libmath/sincoshf.c
  24. +0 −33 software/libmath/sinf.c
  25. +0 −32 software/libmath/sinhf.c
  26. +0 −54 software/libmath/sqrtf.c
  27. +0 −88 software/libmath/tancotf.c
  28. +0 −33 software/libmath/tanf.c
  29. +0 −63 software/libmath/tanhf.c
  30. +0 −1  software/update_depend.sh
View
2  Makefile
@@ -10,7 +10,7 @@ BASEDIR=${CURDIR}
SYNTOOL?=xst
BOARD?=milkymist-one
-SDK_DIRS=libbase libmath libhal libfpvm libnet
+SDK_DIRS=libbase libhal libfpvm libnet
SW_DIRS=${SDK_DIRS} libhpdmc libfpvm libfpvm/x86-linux libfpvm/lm32-linux bios
CORE_DIRS=ac97 bt656cap conbus dmx fmlbrg fmlmeter hpdmc_ddr32 \
View
86 software/include/base/math.h
@@ -1,86 +0,0 @@
-/*-------------------------------------------------------------------------
- math.h: Floating point math function declarations
-
- Ported to PIC16 port by Vangelis Rokas, 2004 (vrokas@otenet.gr)
- Adopted for the PIC14 port 2006 by Raphael Neider <rneider AT web.de>
-
- Copyright (C) 2001 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--------------------------------------------------------------------------*/
-
-/*
-** $Id: math.h 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#ifndef __MATH_H
-#define __MATH_H
-
-#define PI 3.1415926536
-#define TWO_PI 6.2831853071
-#define HALF_PI 1.5707963268
-#define QUART_PI 0.7853981634
-#define iPI 0.3183098862
-#define iTWO_PI 0.1591549431
-#define TWO_O_PI 0.6366197724
-
-// EPS=B**(-t/2), where B is the radix of the floating-point representation
-// and there are t base-B digits in the significand. Therefore, for floats
-// EPS=2**(-12). Also define EPS2=EPS*EPS.
-#define EPS 244.14062E-6
-#define EPS2 59.6046E-9
-#define XMAX 3.402823466E+38
-
-union float_long
-{
- float f;
- long l;
-};
-
-/**********************************************
- * Prototypes for float ANSI C math functions *
- **********************************************/
-
-/* Trigonometric functions */
-float sinf(const float x);
-float cosf(const float x);
-float tanf(const float x);
-float cotf(const float x);
-float asinf(const float x);
-float acosf(const float x);
-float atanf(const float x);
-float atan2f(const float x, const float y);
-
-/* Hyperbolic functions */
-float sinhf(const float x);
-float coshf(const float x);
-float tanhf(const float x);
-
-/* Exponential, logarithmic and power functions */
-float expf(const float x);
-float logf(const float x);
-float log10f(const float x);
-float powf(const float x, const float y);
-float sqrtf(const float a);
-
-/* Nearest integer, absolute value, and remainder functions */
-float fabsf(const float x);
-float frexpf(const float x, int *pw2);
-float ldexpf(const float x, const int pw2);
-float ceilf(float x);
-float floorf(float x);
-float modff(float x, float *y);
-
-#endif /* __MATH_H */
View
47 software/libmath/Makefile
@@ -1,47 +0,0 @@
-MMDIR=../..
-include $(MMDIR)/software/include.mak
-
-OBJECTS=acosf.o asinf.o atanf.o cosf.o cotf.o expf.o floorf.o ldexpf.o logf.o modff.o sincosf.o sinf.o sqrtf.o tanf.o asincosf.o atan2f.o ceilf.o coshf.o fabsf.o frexpf.o log10f.o powf.o sincoshf.o sinhf.o tancotf.o tanhf.o
-
-all: libmath.a
-
-libmath.a: $(OBJECTS)
- $(AR) clr libmath.a $(OBJECTS)
- $(RANLIB) libmath.a
-
-.PHONY: clean depend
-
-depend:
- makedepend -Y -- $(CFLAGS) -- *.c
-
-clean:
- rm -f *.o libmath.a .*~ *~ Makefile.bak
-
-# DO NOT DELETE
-
-acosf.o: ../../software/include/base/math.h
-asincosf.o: ../../software/include/base/math.h
-asinf.o: ../../software/include/base/math.h
-atan2f.o: ../../software/include/base/math.h
-atanf.o: ../../software/include/base/math.h
-ceilf.o: ../../software/include/base/math.h
-cosf.o: ../../software/include/base/math.h
-coshf.o: ../../software/include/base/math.h
-cotf.o: ../../software/include/base/math.h
-expf.o: ../../software/include/base/math.h
-fabsf.o: ../../software/include/base/math.h
-floorf.o: ../../software/include/base/math.h
-frexpf.o: ../../software/include/base/math.h
-ldexpf.o: ../../software/include/base/math.h
-log10f.o: ../../software/include/base/math.h
-logf.o: ../../software/include/base/math.h
-modff.o: ../../software/include/base/math.h
-powf.o: ../../software/include/base/math.h
-sincosf.o: ../../software/include/base/math.h
-sincoshf.o: ../../software/include/base/math.h
-sinf.o: ../../software/include/base/math.h
-sinhf.o: ../../software/include/base/math.h
-sqrtf.o: ../../software/include/base/math.h
-tancotf.o: ../../software/include/base/math.h
-tanf.o: ../../software/include/base/math.h
-tanhf.o: ../../software/include/base/math.h
View
35 software/libmath/acosf.c
@@ -1,35 +0,0 @@
-/* acosf.c: Computes arc cosine of a 32-bit float
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: acosf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float asincosf(const float x, const int isacos);
-
-float acosf(const float x)
-{
- if(x== 1.0) return 0.0;
- else if(x==-1.0) return PI;
- else if(x== 0.0) return HALF_PI;
- return asincosf(x,1);
-}
View
85 software/libmath/asincosf.c
@@ -1,85 +0,0 @@
-/* asincosf.c: Computes asin or acos of a 32-bit float as outlined in [1]
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* [1] William James Cody and W. M. Waite. _Software manual for the
- elementary functions_, Englewood Cliffs, N.J.:Prentice-Hall, 1980. */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: asincosf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-
-#include <math.h>
-
-#define P1 0.933935835E+0
-#define P2 -0.504400557E+0
-#define Q0 0.560363004E+1
-#define Q1 -0.554846723E+1
-#define Q2 0.100000000E+1
-
-#define P(g) (P2*g+P1)
-#define Q(g) ((Q2*g+Q1)*g+Q0)
-
-float asincosf(const float x, const int isacos)
-{
- float y, g, r;
- int i;
-
- static const float a[2]={ 0.0, QUART_PI };
- static const float b[2]={ HALF_PI, QUART_PI };
-
- y=fabsf(x);
- i=isacos;
- if (y < EPS) r=y;
- else
- {
- if (y > 0.5)
- {
- i=1-i;
- if (y > 1.0)
- {
- //errno=EDOM;
- return 0.0;
- }
- g=(0.5-y)+0.5;
- g=ldexpf(g,-1);
- y=sqrtf(g);
- y=-(y+y);
- }
- else
- {
- g=y*y;
- }
- r=y+y*((P(g)*g)/Q(g));
- }
- if (isacos)
- {
- if (x < 0.0)
- r=(b[i]+r)+b[i];
- else
- r=(a[i]-r)+a[i];
- }
- else
- {
- r=(a[i]+r)+a[i];
- if (x<0.0) r=-r;
- }
- return r;
-}
View
36 software/libmath/asinf.c
@@ -1,36 +0,0 @@
-/* asinf.c: Computes asin(x)
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: asinf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float asincosf(const float x, const int isacos);
-
-float asinf(const float x)
-{
- if(x== 1.0) return HALF_PI;
- else if(x==-1.0) return -HALF_PI;
- else if(x== 0.0) return 0.0;
- else return asincosf(x,0);
-}
-
View
48 software/libmath/atan2f.c
@@ -1,48 +0,0 @@
-/* atan2f.c: Computes atan2(x) where x is a 32-bit float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: atan2f.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float atan2f(const float x, const float y)
-{
- float r;
-
- if ((x==0.0) && (y==0.0))
- {
- //errno=EDOM;
- return 0.0;
- }
-
- if(fabsf(y)>=fabsf(x))
- {
- r=atanf(x/y);
- if(y<0.0) r+=(x>=0?PI:-PI);
- }
- else
- {
- r=-atanf(y/x);
- r+=(x<0.0?-HALF_PI:HALF_PI);
- }
- return r;
-}
View
73 software/libmath/atanf.c
@@ -1,73 +0,0 @@
-/* atanf.c: Computes arctan of a 32-bit float as outlined in [1]
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* [1] William James Cody and W. M. Waite. _Software manual for the
- elementary functions_, Englewood Cliffs, N.J.:Prentice-Hall, 1980. */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: atanf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-#define P0 -0.4708325141E+0
-#define P1 -0.5090958253E-1
-#define Q0 0.1412500740E+1
-#define Q1 0.1000000000E+1
-
-#define P(g,f) ((P1*g+P0)*g*f)
-#define Q(g) (Q1*g+Q0)
-
-#define K1 0.2679491924 /* 2-sqrt(3) */
-#define K2 0.7320508076 /* sqrt(3)-1 */
-#define K3 1.7320508076 /* sqrt(3) */
-
-float atanf(const float x)
-{
- float f, r, g;
- int n=0;
- static float a[]={ 0.0, 0.5235987756, 1.5707963268, 1.0471975512 };
-
- f=fabsf(x);
- if(f>1.0)
- {
- f=1.0/f;
- n=2;
- }
- if(f>K1)
- {
- f=((K2*f-1.0)+f)/(K3+f);
- // What it is actually wanted is this more accurate formula,
- // but SDCC optimizes it and then it does not work:
- // f=(((K2*f-0.5)-0.5)+f)/(K3+f);
- n++;
- }
- if(fabsf(f)<EPS) r=f;
- else
- {
- g=f*f;
- r=f+P(g,f)/Q(g);
- }
- if(n>1) r=-r;
- r+=a[n];
- if(x<0.0) r=-r;
- return r;
-}
-
View
35 software/libmath/ceilf.c
@@ -1,35 +0,0 @@
-/* ceilf.c: Returns the integer larger or equal than x
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: ceilf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float ceilf(float x)
-{
- long r;
- r=x;
- if (r<0)
- return r;
- else
- return (r+((r<x)?1:0));
-}
View
33 software/libmath/cosf.c
@@ -1,33 +0,0 @@
-/* cosf.c: Computes cos(x) where x is a 32-bit float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: cosf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float sincosf(float x, int iscos);
-
-float cosf(float x)
-{
- if (x==0.0) return 1.0;
- return sincosf(x, 1);
-}
View
32 software/libmath/coshf.c
@@ -1,32 +0,0 @@
-/* coshf.c: Computes cosh(x) where x is a 32-bit float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: coshf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float sincoshf(const float x, const int iscosh);
-
-float coshf(const float x)
-{
- return sincoshf(x, 1);
-}
View
44 software/libmath/cotf.c
@@ -1,44 +0,0 @@
-/* cotf.c: Computes cot(x) where x is a 32-bit float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: cotf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float tancotf(const float x, const int iscot);
-
-float cotf(const float x)
-{
- float y;
-
- y=fabsf(x);
- if (y<1.0E-30) //This one requires more thinking...
- {
- //errno = ERANGE;
- if (x<0.0)
- return -XMAX;
- else
- return XMAX;
- }
- return tancotf(x, 1);
-}
-
View
89 software/libmath/expf.c
@@ -1,89 +0,0 @@
-/* expf.c: Computes e**x of a 32-bit float as outlined in [1]
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* [1] William James Cody and W. M. Waite. _Software manual for the
- elementary functions_, Englewood Cliffs, N.J.:Prentice-Hall, 1980. */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: expf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-#define P0 0.2499999995E+0
-#define P1 0.4160288626E-2
-#define Q0 0.5000000000E+0
-#define Q1 0.4998717877E-1
-
-#define P(z) ((P1*z)+P0)
-#define Q(z) ((Q1*z)+Q0)
-
-#define C1 0.693359375
-#define C2 -2.1219444005469058277e-4
-
-#define BIGX 88.72283911 /* ln(XMAX) */
-#define EXPEPS 1.0E-7 /* exp(1.0E-7)=0.0000001 */
-#define K1 1.4426950409 /* 1/ln(2) */
-
-float expf(const float x)
-{
- int n;
- float xn, g, r, z, y;
- char sign;
-
- if(x>=0.0)
- { y=x; sign=0; }
- else
- { y=-x; sign=1; }
-
- if(y<EXPEPS) return 1.0;
-
- if(y>BIGX)
- {
- if(sign)
- {
- //errno=ERANGE;
- return XMAX;
- }
- else
- {
- return 0.0;
- }
- }
-
- z=y*K1;
- n=z;
-
- if(n<0) --n;
- if(z-n>=0.5) ++n;
- xn=n;
- g=((y-xn*C1))-xn*C2;
- z=g*g;
- r=P(z)*g;
- r=0.5+(r/(Q(z)-r));
-
- n++;
- z=ldexpf(r, n);
- if(sign)
- return 1.0/z;
- else
- return z;
-}
-
View
34 software/libmath/fabsf.c
@@ -1,34 +0,0 @@
-/* fabsf.c: Returns the absolute value of a 32-bit float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: fabsf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float fabsf(const float x)
-{
- union float_long fl;
-
- fl.f = x;
- fl.l &= 0x7fffffff;
- return fl.f;
-}
View
35 software/libmath/floorf.c
@@ -1,35 +0,0 @@
-/* floorf.c: Returns the integer smaller or equal than x
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: floorf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float floorf (float x)
-{
- long r;
- r=x;
- if (r<=0)
- return (r+((r>x)?-1:0));
- else
- return r;
-}
View
40 software/libmath/frexpf.c
@@ -1,40 +0,0 @@
-/* frexpf.c: Returns the exponent and mantisa of a 32 bit float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: frexpf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float frexpf(const float x, int *pw2)
-{
- union float_long fl;
- long int i;
-
- fl.f=x;
- /* Find the exponent (power of 2) */
- i = ( fl.l >> 23) & 0x000000ff;
- i -= 0x7e;
- *pw2 = i;
- fl.l &= 0x807fffff; /* strip all exponent bits */
- fl.l |= 0x3f000000; /* mantissa between 0.5 and 1 */
- return(fl.f);
-}
View
39 software/libmath/ldexpf.c
@@ -1,39 +0,0 @@
-/* ldexpf.c: Build a float from a mantisa and exponent.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: ldexpf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float ldexpf(const float x, const int pw2)
-{
- union float_long fl;
- long e;
-
- fl.f = x;
-
- e=(fl.l >> 23) & 0x000000ff;
- e+=pw2;
- fl.l= ((e & 0xff) << 23) | (fl.l & 0x807fffff);
-
- return(fl.f);
-}
View
30 software/libmath/log10f.c
@@ -1,30 +0,0 @@
-/* log10f.c: Computes the base 10 log of a 32 bit float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: log10f.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float log10f(const float x)
-{
- return logf(x)*0.4342944819;
-}
View
69 software/libmath/logf.c
@@ -1,69 +0,0 @@
-/* logf.c: Computes the natural log of a 32 bit float as outlined in [1].
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* [1] William James Cody and W. M. Waite. _Software manual for the
- elementary functions_, Englewood Cliffs, N.J.:Prentice-Hall, 1980. */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: logf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-/*Constans for 24 bits or less (8 decimal digits)*/
-#define A0 -0.5527074855E+0
-#define B0 -0.6632718214E+1
-#define A(w) (A0)
-#define B(w) (w+B0)
-
-#define C0 0.70710678118654752440
-#define C1 0.693359375 /*355.0/512.0*/
-#define C2 -2.121944400546905827679E-4
-
-float logf(const float x)
-{
- float Rz;
- float f, z, w, znum, zden, xn;
- int n;
-
- if (x<=0.0)
- {
- //errno=EDOM;
- return 0.0;
- }
- f=frexpf(x, &n);
- znum=f-0.5;
- if (f>C0)
- {
- znum-=0.5;
- zden=(f*0.5)+0.5;
- }
- else
- {
- n--;
- zden=znum*0.5+0.5;
- }
- z=znum/zden;
- w=z*z;
-
- Rz=z+z*(w*A(w)/B(w));
- xn=n;
- return ((xn*C2+Rz)+xn*C1);
-}
View
31 software/libmath/modff.c
@@ -1,31 +0,0 @@
-/* modff.c: Returns both the integer and fraction of a float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: modff.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float modff(float x, float * y)
-{
- *y=((int)x);
- return (x-*y);
-}
View
34 software/libmath/powf.c
@@ -1,34 +0,0 @@
-/* powf.c: Computes x**y where x and y are 32-bit floats.
- WARNING: less that 6 digits accuracy.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: powf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float powf(const float x, const float y)
-{
- if(y == 0.0) return 1.0;
- if(y==1.0) return x;
- if(x <= 0.0) return 0.0;
- return expf(logf(x) * y);
-}
View
89 software/libmath/sincosf.c
@@ -1,89 +0,0 @@
-/* sincosf.c: Computes sin or cos of a 32-bit float as outlined in [1]
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* [1] William James Cody and W. M. Waite. _Software manual for the
- elementary functions_, Englewood Cliffs, N.J.:Prentice-Hall, 1980. */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: sincosf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-#define r1 (-0.1666665668E+0)
-#define r2 (0.8333025139E-2)
-#define r3 (-0.1980741872E-3)
-#define r4 (0.2601903036E-5)
-
-/* PI=C1+C2 */
-#define C1 3.140625
-#define C2 9.676535897E-4
-
-/*A reasonable value for YMAX is the int part of PI*B**(t/2)=3.1416*2**(12)*/
-#define YMAX 12867.0
-
-float sincosf(float x, int iscos)
-{
- float y, f, r, g, XN;
- int N;
- char sign;
-
- if(iscos)
- {
- y=fabsf(x)+HALF_PI;
- sign=0;
- }
- else
- {
- if(x<0.0)
- { y=-x; sign=1; }
- else
- { y=x; sign=0; }
- }
-
- if(y>YMAX)
- {
- //errno=ERANGE;
- return 0.0;
- }
-
- /*Round y/PI to the nearest integer*/
- N=((y*iPI)+0.5); /*y is positive*/
-
- /*If N is odd change sign*/
- if(N&1) sign=!sign;
-
- XN=N;
- /*Cosine required? (is done here to keep accuracy)*/
- if(iscos) XN-=0.5;
-
- y=fabsf(x);
- r=(int)y;
- g=y-r;
- f=((r-XN*C1)+g)-XN*C2;
-
- g=f*f;
- if(g>EPS2) //Used to be if(fabsf(f)>EPS)
- {
- r=(((r4*g+r3)*g+r2)*g+r1)*g;
- f+=f*r;
- }
- return (sign?-f:f);
-}
View
92 software/libmath/sincoshf.c
@@ -1,92 +0,0 @@
-/* sincoshf.c: Computes sinh or cosh of a 32-bit float as outlined in [1]
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* [1] William James Cody and W. M. Waite. _Software manual for the
- elementary functions_, Englewood Cliffs, N.J.:Prentice-Hall, 1980. */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: sincoshf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-#define P0 -0.713793159E+1
-#define P1 -0.190333999E+0
-#define Q0 -0.428277109E+2
-#define Q1 0.100000000E+1
-
-#define P(z) (P1*z+P0)
-#define Q(z) (Q1*z+Q0)
-
-#define K1 0.69316101074218750000E+0 /* ln(v) */
-#define K2 0.24999308500451499336E+0 /* v**(-2) */
-#define K3 0.13830277879601902638E-4 /* v/2-1 */
-
-//WMAX is defined as ln(XMAX)-ln(v)+0.69
-#define WMAX 44.93535952E+0
-//WBAR 0.35*(b+1)
-#define WBAR 1.05
-#define YBAR 9.0 /*Works for me*/
-
-float sincoshf(const float x, const int iscosh)
-{
- float y, w, z;
- char sign;
-
- if (x<0.0) { y=-x; sign=1; }
- else { y=x; sign=0; }
-
- if ((y>1.0) || iscosh)
- {
- if(y>YBAR)
- {
- w=y-K1;
- if (w>WMAX)
- {
- //errno=ERANGE;
- z=XMAX;
- }
- else
- {
- z=expf(w);
- z+=K3*z;
- }
- }
- else
- {
- z=expf(y);
- w=1.0/z;
- if(!iscosh) w=-w;
- z=(z+w)*0.5;
- }
- if(sign) z=-z;
- }
- else
- {
- if (y<EPS)
- z=x;
- else
- {
- z=x*x;
- z=x+x*z*P(z)/Q(z);
- }
- }
- return z;
-}
View
33 software/libmath/sinf.c
@@ -1,33 +0,0 @@
-/* sinf.c: Computes sin(x) where x is a 32-bit float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: sinf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float sincosf(float x, int iscos);
-
-float sinf(float x)
-{
- if (x==0.0) return 0.0;
- return sincosf(x, 0);
-}
View
32 software/libmath/sinhf.c
@@ -1,32 +0,0 @@
-/* sinhf.c: Computes sinh(x) where x is a 32-bit float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: sinhf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float sincoshf(const float x, const int iscosh);
-
-float sinhf(const float x)
-{
- return sincoshf(x, 0);
-}
View
54 software/libmath/sqrtf.c
@@ -1,54 +0,0 @@
-/* sqrtf.c: Computes square root of a 32-bit float as outlined in [1]
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* [1] William James Cody and W. M. Waite. _Software manual for the
- elementary functions_, Englewood Cliffs, N.J.:Prentice-Hall, 1980. */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: sqrtf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float sqrtf(const float x)
-{
- float f, y;
- int n;
-
- if (x==0.0) return x;
- else if (x==1.0) return 1.0;
- else if (x<0.0)
- {
- //errno=EDOM;
- return 0.0;
- }
- f=frexpf(x, &n);
- y=0.41731+0.59016*f; /*Educated guess*/
- /*For a 24 bit mantisa (float), two iterations are sufficient*/
- y+=f/y;
- y=ldexpf(y, -2) + f/y; /*Faster version of 0.25 * y + f/y*/
-
- if (n&1)
- {
- y*=0.7071067812;
- ++n;
- }
- return ldexpf(y, n/2);
-}
View
88 software/libmath/tancotf.c
@@ -1,88 +0,0 @@
-/* tancotf.c: Computes tan or cot of a 32-bit float as outlined in [1]
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* [1] William James Cody and W. M. Waite. _Software manual for the
- elementary functions_, Englewood Cliffs, N.J.:Prentice-Hall, 1980. */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: tancotf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-#define P0 0.100000000E+1
-#define P1 -0.958017723E-1
-#define Q0 0.100000000E+1
-#define Q1 -0.429135777E+0
-#define Q2 0.971685835E-2
-
-#define C1 1.5703125
-#define C2 4.83826794897E-4
-
-#define P(f,g) (P1*g*f+f)
-#define Q(g) ((Q2*g+Q1)*g+Q0)
-
-//A reasonable choice for YMAX is the integer part of B**(t/2)*PI/2:
-#define YMAX 6433.0
-
-float tancotf(const float x, const int iscotan)
-{
- float f, g, xn, xnum, xden;
- int n;
-
- if (fabsf(x) > YMAX)
- {
- //errno = ERANGE;
- return 0.0;
- }
-
- /*Round x*2*PI to the nearest integer*/
- n=(x*TWO_O_PI+(x>0.0?0.5:-0.5)); /*works for +-x*/
- xn=n;
-
- xnum=(int)x;
- xden=x-xnum;
- f=((xnum-xn*C1)+xden)-xn*C2;
-
- if (fabsf(f) < EPS)
- {
- xnum = f;
- xden = 1.0;
- }
- else
- {
- g = f*f;
- xnum = P(f,g);
- xden = Q(g);
- }
-
- if(n&1)
- //xn is odd
- {
- if(iscotan) return (-xnum/xden);
- else return (-xden/xnum);
- }
- else
- {
- if(iscotan) return (xden/xnum);
- else return (xnum/xden);
- }
-}
-
View
33 software/libmath/tanf.c
@@ -1,33 +0,0 @@
-/* tanf.c: Computes tan(x) where x is a 32-bit float.
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: tanf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-float tancotf(const float x, const int iscot);
-
-float tanf(const float x)
-{
- return tancotf(x, 0);
-}
-
View
63 software/libmath/tanhf.c
@@ -1,63 +0,0 @@
-/* tanhf.c: Computes tanh(x) where x is a 32-bit float as outlined in [1].
-
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* [1] William James Cody and W. M. Waite. _Software manual for the
- elementary functions_, Englewood Cliffs, N.J.:Prentice-Hall, 1980. */
-
-/* Version 1.0 - Initial release */
-
-/*
-** $Id: tanhf.c 4776 2007-04-29 13:15:51Z borutr $
-*/
-
-#include <math.h>
-
-#define P0 -0.8237728127E+0
-#define P1 -0.3831010665E-2
-#define Q0 0.2471319654E+1
-#define Q1 0.1000000000E+1
-
-/* ln(3)/2 */
-#define K1 0.5493061443E+0
-/* SBIG=[ln(2)+(t+1)*ln(B)]/2 */
-#define SBIG 9.01091
-
-#define P(g) ((P1*g+P0)*g)
-#define Q(g) (Q1*g+Q0)
-
-float tanhf(const float x)
-{
- float f, g, r;
-
- f=fabsf(x);
- if(f>SBIG) r=1.0;
- else if(f>K1)
- {
- r=0.5-1.0/(expf(f+f)+1.0);
- r+=r;
- }
- else if(f<EPS) r=f;
- else
- {
- g=f*f;
- r=f+f*(P(g)/Q(g));
- }
- if(x<0.0) r=-r;
- return r;
-}
-
View
1  software/update_depend.sh
@@ -1,7 +1,6 @@
#!/bin/bash
make -C libbase depend
-make -C libmath depend
make -C libhal depend
make -C libfpvm depend
make -C libnet depend
Please sign in to comment.
Something went wrong with that request. Please try again.