Main Page | Alphabetical List | Class List | File List | Class Members | File Members

math.h File Reference

apeNEXT math functions for nlcc More...

#include <nlibc.h>
#include <stdint.h>
#include <limits.h>
#include <float.h>
#include "math_suppl.h"

Include dependency graph for math.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define _INLINE_MATH_   /** copied from /home/apenext/apenext/math.h EL */
#define math_inline   inline
#define _math_setdouble(U, D)
#define INFINITY   0x1.0p32767
#define HUGE_VAL   INFINITY
#define HUGE_VALF   HUGE_VAL
#define HUGE_VALL   HUGE_VAL
#define FP_INFINITE   2
#define FP_NAN   3
#define FP_NORMAL   1
#define FP_SUBNORMAL   1
#define FP_ZERO   4
#define FP_FAST_FMA
#define FP_FAST_FMAF   FP_FAST_FMA
#define FP_FAST_FMAL   FP_FAST_FMA
#define FP_ILOGB0   -INT_MAX
#define FP_ILOGBNAN   INT_MAX
#define MATH_ERRNO   1
#define MATH_ERREXCEPT   2
#define math_errhandling
#define fpclassify(x)   _fpclassify(x)
#define isfinite(x)   _isfinite(x)
#define isinf(x)   _isinf(x)
#define isnan(x)   _isnan(x)
#define isnormal(x)   _isfinite(x)
#define signbit(x)   _signbit(x)
#define llrint(x)   lrint(x)
#define llround(x)   lround(x)
#define nexttoward(x, y)   nextafter(x,y)
#define isgreater(x, y)   _isgreater(x,y)
#define isgreaterequal(x, y)   _isgreaterequal(x,y)
#define isless(x, y)   _isless(x,y)
#define islessequal(x, y)   _islessequal(x,y)
#define islessgreater(x, y)   _islessgreater(x,y)
#define isunordered(x, y)   _isunordered( x, y)

Functions

math_inline double sqrt (double a)
math_inline double log (double x)
math_inline double exp (double x)
math_inline double expm1 (double x)
math_inline double acos (double x)
math_inline double asin (double x)
math_inline double atan (double x)
math_inline double atan2 (double y, double x)
math_inline double cos (double x)
math_inline double sin (double x)
math_inline double tan (double x)
math_inline double acosh (double x)
math_inline double asinh (double x)
math_inline double atanh (double x)
math_inline double cosh (double x)
math_inline double sinh (double x)
math_inline double tanh (double xxx)
math_inline double exp2 (double x)
math_inline double frexp (double value, int *eptr)
math_inline int ilogb (double x)
math_inline double ldexp (double x, int n)
math_inline double log10 (double x)
math_inline double log1p (double xxx)
math_inline double log2 (double x)
math_inline double modf (double value, double *dptr)
math_inline double cbrt (double x)
math_inline double fabs (double x)
math_inline double hypot (double x, double y)
math_inline double erf (double x)
math_inline double erfc (double x)
math_inline double lgamma (double x)
math_inline double tgamma (double x)
math_inline double ceil (double x)
math_inline double floor (double x)
math_inline double round (double x)
math_inline long int lround (double x)
math_inline double trunc (double x)
math_inline double copysign (double x, double y)
math_inline double fmod (double x, double y)
math_inline double remainder (double x, double y)
math_inline double remquo (double x, double y, int *quo)
math_inline double nan (const char *tagp)
math_inline double nextafter (double x, double y)
math_inline double pow (double x, double y)
math_inline double fdim (double x, double y)
math_inline double fmax (double x, double y)
math_inline double fmin (double x, double y)
math_inline double fma (double x, double y, double z)


Detailed Description

apeNEXT math functions for nlcc

Id
math.h,v 1.33 2005/11/11 10:22:09 morinl Exp

#include <math.h>

IMPLEMENTATION for apeNEXT: possible (math.h) with restrictions [not yet completed]
IMPLEMENTATION for apeNEXT:
IMPLEMENTATION for apeNEXT: (math.h) data types: float, double, long double are all the same
IMPLEMENTATION for apeNEXT: (math.h) data types: int, long int, long long int are all the same
IMPLEMENTATION for apeNEXT: (math.h) data types: characters not available
IMPLEMENTATION for apeNEXT: (math.h) hardware not(?) fully compliant with IEC 754
IMPLEMENTATION for apeNEXT: (math.h) rounding fixed (see NOTE 1)
IMPLEMENTATION for apeNEXT: (math.h) (quiet) NaN not available ? (see NOTE 2)
IMPLEMENTATION for apeNEXT: (math.h) handling of infinities ? (see NOTE 2)
IMPLEMENTATION for apeNEXT: (math.h) exceptions ?
IMPLEMENTATION for apeNEXT:

CAVEAT:
so far ISO/IEC compliance in dealing with infinities has not yet been properly
taken into account.

all present implementations need to be checked
for correctness (incl. some hex constants)
for domains and ranges
for exception handling
Author:
ZZ version : Roberto De Pietri: v. 0.4 26/08/2001

C conversion : Norbert Paschedag : 15/02/2002

Edwin Laermann (edwin@physik.uni-bielefeld.de)

Definition in file math.h.


Define Documentation

#define _INLINE_MATH_   /** copied from /home/apenext/apenext/math.h EL */
 

copied from /home/apenext/apenext/math.h EL

Definition at line 38 of file math.h.

#define _math_setdouble U,
 ) 
 

Value:

{ \
  register union { double d; unsigned i; } u; \
  asm("\tatr0h %0 <"#U">" : "=r" (u.i)); D=u.d; \
}
==========================================================
macro to set a double from its hex representation
NOT C standard

suggestion by noe to initialize also high bank of double
==========================================================

Definition at line 52 of file math.h.

#define FP_FAST_FMA
 

optionally defined. If defined it indicates that the fma() function generally executes as fast as or faster than a multiply and add of double operands. Makes sense if there is a machine instruction

  • NORMAL ? -

Definition at line 107 of file math.h.

#define FP_FAST_FMAF   FP_FAST_FMA
 

the same for float and long double

Definition at line 110 of file math.h.

#define FP_FAST_FMAL   FP_FAST_FMA
 

Definition at line 111 of file math.h.

#define FP_ILOGB0   -INT_MAX
 

integer constant expressions whose values are returned by ilogb(x) if x is zero or NaN. Should be either INT_MIN or -INT_MAX for ILOGB0 and either INT_MAX or INT_MIN for ILOGBNAN

Definition at line 116 of file math.h.

#define FP_ILOGBNAN   INT_MAX
 

Definition at line 117 of file math.h.

#define FP_INFINITE   2
 

for number classification: FP_NORMAL must be 1 !! all the others are ad lib no subnormals assumed

Definition at line 97 of file math.h.

#define FP_NAN   3
 

Definition at line 98 of file math.h.

#define FP_NORMAL   1
 

Definition at line 99 of file math.h.

#define FP_SUBNORMAL   1
 

Definition at line 100 of file math.h.

#define FP_ZERO   4
 

Definition at line 101 of file math.h.

#define fpclassify  )     _fpclassify(x)
 

---------------------------------------------------------------------------

NAME
fpclassify
SYNOPSIS
#include <math.h>
int fpclassify(real-floating x);
DESCRIPTION
The fpclassify() macro classifies its argument as
NaN, infinity, normal, subnormal, zero or into
another implementation defined category.
RETURN VALUE
Returns value of the number classification macro.
Notes
$x = s * 2^k * 1.m$
with s sign bit
k exponent 11 bits
m mantissa 52 bits $m \epsilon [0,1)$
The exponent is stored as E = k + 0X3FF,
$0X001 \leq E \leq 0X7FE <=> -1022 \leq k \leq 1023$

E=0X000 is true zero
E=0X7FF flags infinity or NaN

There are no subnormal floats on apeNEXT ?

taken from APENextLUT.pdf in /doc
-----------------------------------------------------------

implemented as function in math_suppl.h

IMPLEMENTATION for apeNEXT: implem (fpclassify)

Definition at line 188 of file math.h.

#define HUGE_VAL   INFINITY
 

double constant expression not necessarily representable as float

Definition at line 78 of file math.h.

#define HUGE_VALF   HUGE_VAL
 

float and long double analogs of HUGE_VAL
A positive float constant expression, used as an error value returned
by the mathematics library. It evaluates to +infinity on systems supporting IEEE-Std
It has been added with C99

Definition at line 85 of file math.h.

#define HUGE_VALL   HUGE_VAL
 

Definition at line 86 of file math.h.

#define INFINITY   0x1.0p32767
 

constant expression of type float representing positive or unsigned infinity, if available; else to a positive constant of type float that overflows at translation time

Definition at line 73 of file math.h.

#define isfinite  )     _isfinite(x)
 

--------------------------------------------------------------------------

NAME
isfinite
SYNOPSIS
#include <math.h>
int isfinite(real-floating x);
DESCRIPTION
The isfinite() macro determines whether its argument
has a finite value (zero, subnormal, normal, and
not +-Inf or NaN).
RETURN VALUE
Return nonzero value if X is not +-Inf or NaN.
Notes
NO difference made between float, double, long double
implemented as function in math_suppl.h
could also be implemented as
define isfinite(x) (fpclassify(x) == FP_NORMAL)
this version here should be slightly faster
IMPLEMENTATION for apeNEXT: implem (isfinite)

Author:
Edwin Laermann

Definition at line 219 of file math.h.

#define isgreater x,
 )     _isgreater(x,y)
 

-------------------------------------------------------------------------

NAME
isgreater
SYNOPSIS
#include <math.h>
int isgreater(real-floating x, real-floating y);
DESCRIPTION
The isgreater() macro determines whether its first argument
is greater than its second argument. The value of
isgreater(x,y) is always equal to (x) > (y); however
unlike (x) > (y), isgreater() does not raise the
"invalid" floating-point exception when x and y
are unordered.
RETURN VALUE
Returns the value of (x) > (y)
Notes
no difference made between float, double, long double
expands to _isgreater(double x, double y)
implemented as function in math_suppl.h
IMPLEMENTATION for apeNEXT: implem (isgreater)

Definition at line 4050 of file math.h.

#define isgreaterequal x,
 )     _isgreaterequal(x,y)
 

------------------------------------------------------------------------

NAME
isgreaterequal
SYNOPSIS
#include <math.h>
int isgreaterequal(real-floating x, real-floating y);
DESCRIPTION
The isgreaterequal() macro determines whether its first argument
is greater than or equal to its second argument. The value of
isgreaterequal(x,y) is always equal to (x) >= (y); however
unlike (x) >= (y), isgreaterequal() does not raise the
"invalid" floating-point exception when x and y
are unordered.
RETURN VALUE
Returns the value of (x) >= (y)
Notes
no difference made between float, double, long double
expands to _isgreaterequal(double x, double y)
implemented as function in math_suppl.h
IMPLEMENTATION for apeNEXT: implem (isgreaterequal)

Definition at line 4079 of file math.h.

#define isinf  )     _isinf(x)
 

------------------------------------------------------------------------------------------------

NAME
isinf
SYNOPSIS
#include <math.h>
int isinf(real-floating x);
DESCRIPTION
The isinf() macro determines whether its argument
is an infinity (positive or negative)
RETURN VALUE
Return nonzero value if X is positive or negative infinity
Notes
since float, double, long double are identical on apeNEXT
no difference is made between the float types
+-Inf = +- 0x7ff0...0
implemented as function in math_suppl.h
IMPLEMENTATION for apeNEXT: implem (isinf)

Definition at line 247 of file math.h.

#define isless x,
 )     _isless(x,y)
 

---------------------------------------------------------------------

NAME
isless
SYNOPSIS
#include <math.h>
int isless(real-floating x, real-floating y);
DESCRIPTION
The isless() macro determines whether its first argument
is less than its second argument. The value of
isless(x,y) is always equal to (x) < (y); however
unlike (x) < (y), isless() does not raise the
"invalid" floating-point exception when x and y
are unordered.
RETURN VALUE
Returns the value of (x) < (y)
Notes
no difference made between float, double, long double
expands to _isless(double x, double y)
implemented as function in math_suppl.h
IMPLEMENTATION for apeNEXT: implem (isless)

Definition at line 4108 of file math.h.

#define islessequal x,
 )     _islessequal(x,y)
 

-----------------------------------------------------------------------

NAME
islessequal
SYNOPSIS
#include <math.h>
int islessequal(real-floating x, real-floating y);
DESCRIPTION
The islessequal() macro determines whether its first argument
is less than or equal to its second argument. The value of
islessequal(x,y) is always equal to (x) <= (y); however
unlike (x) <= (y), islessequal() does not raise the
"invalid" floating-point exception when x and y
are unordered.
RETURN VALUE
Returns the value of (x) <= (y)
Notes
no difference made between float, double, long double
expands to _islessequal(double x, double y)
implemented as function in math_suppl.h
IMPLEMENTATION for apeNEXT: implem (islessequal)

Definition at line 4137 of file math.h.

#define islessgreater x,
 )     _islessgreater(x,y)
 

-----------------------------------------------------------------------------

NAME
islessgreater
SYNOPSIS
#include <math.h>
int islessgreater(real-floating x, real-floating y);
DESCRIPTION
The islessgreater() macro determines whether its first argument
is less than or greater than its second argument. The value of
islessgreater(x,y) is similar to (x) < (y) || (x) > (y); however
islessgreater() does not raise the "invalid" floating-point
exception when x and y are unordered.
RETURN VALUE
Returns the value of (x) < (y) || (x) > (y)
Notes
no difference made between float, double, long double
expands to _islessgreater(double x, double y)
implemented as function in math_suppl.h
IMPLEMENTATION for apeNEXT: implem (islessgreater)

Definition at line 4165 of file math.h.

#define isnan  )     _isnan(x)
 

------------------------------------------------------------------------------------------------

NAME
isnan
SYNOPSIS
#include <math.h>
int isnan(real-floating x);
DESCRIPTION
The isnan() macro determines whether its argument
is NaN.
RETURN VALUE
Return nonzero value if X is NaN.
Notes
since float, double, long double are identical on apeNEXT
no difference is made between the float types
+-NaN = +- 0x7ff.mantissa with mantissa neq 0
implemented as function in math_suppl.h
IMPLEMENTATION for apeNEXT: implem (isnan)

Definition at line 273 of file math.h.

#define isnormal  )     _isfinite(x)
 

---------------------------------------------------------------------------

NAME
isnormal
SYNOPSIS
#include <math.h>
int isnormal(real-floating x);
DESCRIPTION
The isnormal() macro determines whether its argument
is normal (neither zero, subnormal, +-Inf nor NaN).
RETURN VALUE
Return nonzero value if X is normal
Notes
There are no subnormals presumably
see isfinite
IMPLEMENTATION for apeNEXT: implem (isnormal) expands to isfinite
IMPLEMENTATION for apeNEXT: no subnormals ?

Definition at line 298 of file math.h.

#define isunordered x,
 )     _isunordered( x, y)
 

------------------------------------------------------------------------

NAME
isunordered
SYNOPSIS
#include <math.h>
int isunordered(real-floating x, real-floating y);
DESCRIPTION
The isunordered() macro determines whether its arguments
are unordered i.e. it is true if both, x and y are NaN
and false otherwise.
RETURN VALUE
Returns 1 if both its arguments are unordered, 0 otherwise
Notes
no difference made between float, double, long double
expands to _isunordered(double x, double y)
implemented as function in math_suppl.h
IMPLEMENTATION for apeNEXT: implem (isunordered)

Definition at line 4191 of file math.h.

#define llrint  )     lrint(x)
 

----------------------------------------------------------------------

NAME
llrint
SYNOPSIS
#include <math.h>
long long int llrint(double x)
long long int llrintf(float x)
long long int llrintl(long double x)
DESCRIPTION
The llrint() function rounds x to the nearest integer value,
rounding according to the current rounding direction (see note at bottom).
If the rounded value is outside the range of the return
type, the numeric result is unspecified and the "invalid"
floating point exception is raised. A range error may
occur if the magnitude of x is too large. When no other
floating-point exception is raised and the result differs from the
argument, the "inexact" floating-point exception is raised.
RETURN VALUE
The llrint() function returns the rounded integer value,
the return value is long long integer
Notes
The difference to lrint is the type of the result.
This is irrelevant for apeNEXT
IMPLEMENTATION for apeNEXT: implem (llrint) expands to lrint

Definition at line 3103 of file math.h.

#define llround  )     lround(x)
 

---------------------------------------------------------------------

NAME
llround
SYNOPSIS
#include <math.h>
long long int llround(double x)
long long int llroundf(float x)
long long int llroundl(long double x)
DESCRIPTION
The llround() function rounds its argument to the nearest integer
value in floating format, rounding halfway cases away from zero,
regardless of the current rounding direction. If the rounded
value is outside the range of the return type the numeric result
is unspecified. A range error may occur if the magnitude of x
is too large.
RETURN VALUE
The lround() function returns the rounded integer value.
Notes
see round()
The difference to lround is the return type long long int
which is identical to int on apeNEXT
IMPLEMENTATION for apeNEXT: implem (llround) expands to lround

Author:
Edwin Laermann

Definition at line 3256 of file math.h.

#define MATH_ERREXCEPT   2
 

Definition at line 121 of file math.h.

#define math_errhandling
 

Definition at line 122 of file math.h.

#define MATH_ERRNO   1
 

see ISO manual p.213

Definition at line 120 of file math.h.

#define math_inline   inline
 

copied from /home/apenext/apenext/math_next.h EL

Definition at line 41 of file math.h.

Referenced by acos(), acosh(), asin(), asin_k(), asinh(), atan(), atan2(), atan_k(), atanh(), cbrt(), ceil(), copysign(), cos(), cos_1oct(), cosh(), erf(), erfc(), exp(), exp1m(), exp2(), expm1(), fabs(), fdim(), floor(), fma(), fmax(), fmin(), fmod(), frexp(), hypot(), ilogb(), isqrt(), isqrt2(), ldexp(), lgamma(), log(), log10(), log1p(), log2(), lround(), modf(), nan(), nextafter(), pow(), remainder(), remquo(), round(), sin(), sin_1oct(), sinh(), sqrt(), sqrt2(), tan(), tanh(), tgamma(), and trunc().

#define nexttoward x,
 )     nextafter(x,y)
 

------------------------------------------------------------------------

NAME
nexttoward
SYNOPSIS
#include <math.h>
double nexttoward(double x, long double y)
float nexttowardf(float x, long double y)
long double nexttowardl(long double x, long double y)
DESCRIPTION
The nexttoward functions are equivalent to the nextafter functions
except that the second parameter has type long double and the
functions return y converted to the type of the function if
x equals y.
RETURN VALUE
Notes
was missing is Olafs list
since there is no long double, nexttoward is identical
to nextafter
IMPLEMENTATION for apeNEXT: implem (nexttoward) expands to nextafter

Author:
Edwin Laermann

Definition at line 3726 of file math.h.

#define signbit  )     _signbit(x)
 

------------------------------------------------------------------------------------------------

NAME
signbit
SYNOPSIS
#include <math.h>
int signbit(real-floating x);
DESCRIPTION
The signbit() macro determines whether the sign of
its argument is negative. It does so for all values
including infinities, zeros and NaNs.
RETURN VALUE
Return nonzero value if sign X is negative
Notes
since float, double, long double are identical on apeNEXT
no difference is made between the float types
implemented as function in math_suppl.h
may be better way via sasm
IMPLEMENTATION for apeNEXT: implem (signbit)

Definition at line 325 of file math.h.


Function Documentation

math_inline double acos double  x  ) 
 

--------------------------------------------------------------------

NAME
acos - arc cosine

SYNOPSIS
#include <math.h>
double acos(double x)
float acosf(float x)
long double acosl(long double x)

DESCRIPTION
The acos() function computes the principal value of the
arc cosine of x. A domain error occurs for arguments not
in the interval [-1,+1]

RETURN VALUE
The acos() function returns arccos(x) in the interval [0,pi]

NOTES
The ArcCos[x] function is computed in terms of the ArcSin[y]
function (with |y|<0.5) according to the following reduction
formula

$( 0.5 < x ) ==> Acos[x] = 2 Asin[sqrt[(1-x)/2]]$
$( -0.5 < x <.5) ==> Acos[x] = pi/2 - Asin[x]$
$( x < -0.5 ) ==> Acos[x] = 2 (pi/2 - Asin[sqrt[(1+x)/2]] )$

IMPLEMENTATION for apeNEXT: implem (acos)
Author:
?

Definition at line 807 of file math.h.

References _math_setdouble, asin_k(), math_inline, and sqrt.

math_inline double acosh double  x  ) 
 

----------------------------------------------------------------------

NAME
acosh - area cosine
SYNOPSIS
#include <math.h>
double acosh(double x)
float acoshf(float x)
long double acoshl(long double x)
DESCRIPTION
The acosh() function computes the (nonnegative)
area cosine of x.
A domain error occurs for x less than 1.
RETURN VALUE
The acosh() function returns the area cosine value
in the interval [0,+infty]
Notes
IMPLEMENTATION for apeNEXT: implem (acosh)

Author:
Edwin Laermann

Definition at line 1485 of file math.h.

References log, math_inline, and sqrt.

math_inline double asin double  x  ) 
 

----------------------------------------------------------------------

NAME
asin - arc sine
SYNOPSIS
#include <math.h>
double asin(double x)
float asinf(float x)
long double asinl(long double x)
DESCRIPTION
The asin() function computes the principal value of the
arc sine of x. A domain error occurs for arguments not
in the interval [-1,+1]
RETURN VALUE
The asin() function returns arcsin(x) in the interval
[-pi/2,+pi/2]
Notes
The ArcSin[x] function is computed in terms of the ArcSin[y]
function (with |y|<0.5) according to the following reduction
formula:

$ ( 0.5 < x ) ==> Asin[x] = pi/2 - 2 Asin[sqrt[(1-x)/2]] $
$ ( -0.5 < x <.5) ==> Asin[x] = Asin[x] $
$ ( x < -0.5 ) ==> Asin[x] = - pi/2 + 2 Asin[sqrt[(1+x)/2]] ) $
IMPLEMENTATION for apeNEXT: implem (asin)

Author:
?

Definition at line 891 of file math.h.

References _math_setdouble, asin_k(), math_inline, and sqrt.

math_inline double asinh double  x  ) 
 

-----------------------------------------------------------------------

NAME
asinh - area sine
SYNOPSIS
#include <math.h>
double asinh(double x)
float asinhf(float x)
long double asinhl(long double x)
DESCRIPTION
The asinh() function computes the area sine of x
RETURN VALUE
The asinh() function returns the area sine value
Notes
IMPLEMENTATION for apeNEXT: implem (asinh)

Author:
Edwin Laermann

Definition at line 1524 of file math.h.

References log, math_inline, and sqrt.

math_inline double atan double  x  ) 
 

-----------------------------------------------------------------

NAME
atan - arc tangent
SYNOPSIS
#include <math.h>
double atan(double x)
float atanf(float x)
long double atanl(long double x)
DESCRIPTION
The atan() function computes the principal value of the
arc tangent of x.
RETURN VALUE
The atan() function returns arctan(x) in the interval
[-pi/2,+pi/2]
Notes
The computation of Atan(x) is done according to

$ 1 < x : Atan(x) = pi/2 - Atan_k(1/x) $
$ -1 < x < 1 : Atan(x) = Atan_k(x) $
$ x < -1 : Atan(x) = -pi/2 - Atan_k(1/x) $

where Atan_k is computed in math_suppl.h
IMPLEMENTATION for apeNEXT: implem (atan)

Author:
?

Definition at line 966 of file math.h.

References _math_setdouble, atan_k(), and math_inline.

math_inline double atan2 double  y,
double  x
 

--------------------------------------------------------------------

NAME
atan2 - arc tangent of y/x
SYNOPSIS
#include <math.h>
double atan2(double y, double x)
float atan2f(float y, float x)
long double atan2l(long double y, long double x)
DESCRIPTION
The atan2() function computes the value of the arc
tangent of y/x, using the signs of both arguments
to determine the quadrant of the return value.
A domain error may occur if both arguments are zero.
RETURN VALUE
The atan2() function returns arctan(y/x) in the
interval [-pi,+pi]
Notes
for x=y=0: atan2 set to 0 as in g++
accuracy ?
IF 2715 2515 0 0 10 190 on 9 calls, incl 3 times x=0
WHERE 3489 3305 0 0 10 174 on 9 calls, incl 3 times x=0
IF 3579 3376 0 0 10 193 on 9 calls, 0 times x=0
IMPLEMENTATION for apeNEXT: implem (atan2) precision ?

Definition at line 1035 of file math.h.

References _math_setdouble, atan_k(), and math_inline.

math_inline double atanh double  x  ) 
 

---------------------------------------------------------------------------

NAME
atanh - area tangent
SYNOPSIS
#include <math.h>
double atanh(double x)
float atanh(float x)
long double atanhl(long double x)
DESCRIPTION
The atanh() function computes the area tangent of x.
A domain error occurs for arguments not in the interval
[-1,+1].
A range error may ocur if the argument equals -1 or +1.
RETURN VALUE
The atanh() function returns the area tangent value
Notes
IMPLEMENTATION for apeNEXT: implem (atanh)

Author:
Edwin Laermann

Definition at line 1566 of file math.h.

References log, and math_inline.

math_inline double cbrt double  x  ) 
 

-------------------------------------------------------------------

NAME
cbrt - cube root
SYNOPSIS
#include <math.h>
double cbrt(double x)
float cbrtf(float x)
long double cbrtl(long double x)
DESCRIPTION
The function cbrt() computes the real third root of x,
x^(1/3)
RETURN VALUE
The function cbrt() returns x^(1/3).
Notes
done by pow, but possibly meant as more efficiently ?
IMPLEMENTATION for apeNEXT: implem (cbrt) by exp(log(x)/3)

Author:
Edwin Laermann

Definition at line 2472 of file math.h.

References _math_setdouble, exp, log, and math_inline.

math_inline double ceil double  x  ) 
 

-------------------------------------------------------------------

NAME
ceil
SYNOPSIS
#include <math.h>
double ceil(double x)
float ceilf(float x)
long double ceill(long double x)
DESCRIPTION
The ceil() function computes the smallest (double precision)
integer value greater than or equal to (double) x.
RETURN VALUE
The ceil() function returns the smallest (double precision)
integer value greater than or equal to (double) x.
Notes
ceil( 2.4) = 3
ceil(-2.4) =-2
IMPLEMENTATION for apeNEXT: implem (ceil)

Author:
Edwin Laermann

Definition at line 2776 of file math.h.

References _math_setdouble, and math_inline.

Referenced by lround(), and round().

math_inline double copysign double  x,
double  y
 

---------------------------------------------------------------------

NAME
copysign
SYNOPSIS
#include <math.h>
double copysign(double x, double y)
float copysignf(float x, float y)
long double copysignl(long double x, long double y)
DESCRIPTION
The copysign() function produces a value with the magnitude of x
and with the sign of y. It produces NaN (with the sign of y) if x
is NaN. On implementations that represent a signed zero but do not
treat negative zero consistently in arithmetic operations, the
copysign() function regards the sign of zero as positive.
RETURN VALUE
The copysign() function returns a value with the magnitude of x
and with the same sign as y.
Notes
IEEE 754 requires copysign(x,NaN) to return +x or -x
IMPLEMENTATION for apeNEXT: implem (copysign) signed zero ?
IMPLEMENTATION for apeNEXT: signed NaN in write_double useful

Author:
Edwin Laermann

Definition at line 3395 of file math.h.

References math_inline, and uint64_t.

Referenced by nextafter(), and remquo().

math_inline double cos double  x  ) 
 

----------------------------------------------------------------------

NAME
cos - cosine
SYNOPSIS
#include <math.h>
double cos(double x)
float cosf(float x)
long double cosl(long double x)
DESCRIPTION
The cos() function computes cosine of x measured
in radians
RETURN VALUE
The cos() function returns the cosine value
Notes
IMPLEMENTATION for apeNEXT: implem (cos)

Author:
ZZ version : Roberto De Pietri: v. 0.4 26/08/2001

C conversion : N. Paschedag : 15/02/2002

Definition at line 1118 of file math.h.

References _math_setdouble, cos_1oct(), math_inline, and sin_1oct().

math_inline double cosh double  x  ) 
 

------------------------------------------------------------------------

NAME
cosh - hyperbolic cosine
SYNOPSIS
#include <math.h>
double cosh(double x)
float coshf(float x)
long double coshl(long double x)
DESCRIPTION
The cosh() function computes the hyperbolic cosine of x.
A range error occurs if the magnitude of x is too large.
RETURN VALUE
The cosh() function returns the hyperbolic cosine value
Notes
version 1 549 513 0 0 10 26 on 2 calls
version 2 519 483 0 0 10 26 on 2 calls
IMPLEMENTATION for apeNEXT: implem (cosh)

Definition at line 1606 of file math.h.

References exp, and math_inline.

math_inline double erf double  x  ) 
 

--------------------------------------------------------------------

NAME
erf - error function
SYNOPSIS
#include <math.h>
double erf(double x)
DESCRIPTION
The erf() function computes the error function of x.
$erf(x) = (2/sqrt(pi)) \int^x_0 exp(-t^2) dt$
RETURN VALUE
The erf() function returns the error function value
Notes
IMPLEMENTATION for apeNEXT: ? (erf) do we need that ?

Definition at line 2629 of file math.h.

References math_inline.

math_inline double erfc double  x  ) 
 

---------------------------------------------------------------------------

NAME
erfc - error function complement
SYNOPSIS
#include <math.h>
double erf(double x)
DESCRIPTION
The erfc) function computes 1 - error function of x.
A range error occurs if x is too large.
RETURN VALUE
The erfc) function returns the error function complement
Notes
IMPLEMENTATION for apeNEXT: ? (erfc) do we need that ?

Definition at line 2662 of file math.h.

References math_inline.

math_inline double exp double  x  ) 
 

----------------------------------------------------------------------

NAME
exp - exponential
SYNOPSIS
#include <math.h>
double exp(double x)
float expf(float x)
long double expl(long double x)
DESCRIPTION
The exp() function computes the base e exponential
of double x.
A range error occurs if the magnitude of x is too large.
RETURN VALUE
The exp() function returns e^x
Notes
Exp(x)
= 2^(1/log[2) b)
= 2^f 2^(1/Log(2) x -f )
= P 2^q' where q' = 1/Log[2] x - f
= P Exp(q) and q = x - Log[2] f

Since 0 < |q'| < 0.5 we will have 0 < |q| < Log[2]/2 ~ 0.347

Exp[q] = 1 + q + 1/2 q^2 + q^3 P(q) )

---------------------------------------------------------------

$ P(q) = \frac{ Exp[q] - 1 - q - q^2/2} {q^3} $

P(q) has been approximated by a Remez minimax polynomial:

degree = 8
[a,b] = [-0.34657359027997,0.34657359027997]
w(q) = q^3/(Exp[q]).
N Iter = 20000
Max Error = 5.3*10^-18

IMPLEMENTATION for apeNEXT: implem (exp)

Author:
ZZ version : Roberto De Pietri: v. 0.4 26/08/2001

C conversion : N. Paschedag : 15/02/2002

Definition at line 608 of file math.h.

References _math_setdouble, and math_inline.

math_inline double exp2 double  x  ) 
 

-------------------------------------------------------------------------

NAME
exp2 - base 2 exponential
SYNOPSIS
#include <math.h>
double exp2(double x)
float exp2f(float x)
long double exp2l(long double x)
DESCRIPTION
The exp2() function computes the base 2 exponential of x.
A range error occurs if the magnitude of x is too large.
RETURN VALUE
The exp2() function returns 2^x.
Notes
IMPLEMENTATION for apeNEXT: implem (exp2)

Definition at line 1773 of file math.h.

References exp, and math_inline.

math_inline double expm1 double  x  ) 
 

-----------------------------------------------------------------------

NAME
expm1 - exponential minus 1
SYNOPSIS
#include <math.h>
double expm1(double x)
float expm1f(float x)
long double expm1l(long double x)
DESCRIPTION
The expm1() function computes the base e exponential minus 1.
A range error occurs if the magnitude of x is too large.
RETURN VALUE
The expm1() function returns the value of exp(x)-1.
Notes
was exp1m in math_next.h
IMPLEMENTATION for apeNEXT: implem (expm1)

Author:
ZZ version : Roberto De Pietri: v. 0.4 26/08/2001

C conversion : N. Paschedag : 15/02/2002

Definition at line 703 of file math.h.

References _math_setdouble, and math_inline.

Referenced by tanh().

math_inline double fabs double  x  ) 
 

----------------------------------------------------------------------

NAME
fabs - absolute value
SYNOPSIS
#include <math.h>
double fabs(double x)
float fabsf(float x)
long double fabsl(long double x)
DESCRIPTION
The fabs() function computes the absolute value of x
RETURN VALUE
The fabs() function returns the absolute value of x
Notes
check performance
clk run fifo nosend internal nodata
cnt cnt str. str.
version 1 99 79 0 0 10 10
version 2 107 85
version 3 103 83
IMPLEMENTATION for apeNEXT: implem (fabs)

Definition at line 2530 of file math.h.

References math_inline, and uint64_t.

math_inline double fdim double  x,
double  y
 

-----------------------------------------------------------------------

NAME
fdim - positive difference
SYNOPSIS
#include <math.h>
double fdim(double x, double y)
float fdimf(float x, float y)
long double fdiml(long double x, long double y)
DESCRIPTION
The fdim() function determines the positive difference between
the arguments,
x-y if x > y
0 if x leq y
A range error may occur.
RETURN VALUE
The fdim() function returns the positive difference value.
Notes
IMPLEMENTATION for apeNEXT: implem (fdim)

Definition at line 3886 of file math.h.

References math_inline.

math_inline double floor double  x  ) 
 

------------------------------------------------------------------

NAME
floor
SYNOPSIS
#include <math.h>
double floor(double x)
float floorf(float x)
long double floor(long double x)
DESCRIPTION
The floor() function computes the largest (double precision)
integer value less than or equal to (double) x
RETURN VALUE
The floor() function returns the largest (double precision)
integer value less than or equal to (double) x
Notes
floor( 2.4) = 2
floor(-2.4) =-3
IMPLEMENTATION for apeNEXT: implem (floor)

Author:
Edwin Laermann

Definition at line 2846 of file math.h.

References _math_setdouble, and math_inline.

Referenced by lround(), and round().

math_inline double fma double  x,
double  y,
double  z
 

----------------------------------------------------------------------------

NAME
fma - multiply-add
SYNOPSIS
#include <math.h>
double fma(double x, double y, double z)
DESCRIPTION
The function fma() computes (x*y)+z, rounded as one ternary operation.
RETURN VALUE
The function fma() returns (x*y)+z, rounded as one ternary operation.
Notes
The function computes the value (as if) to infinite precision and
rounds once to the result format, according to the rounding mode
characterized by the value of FLT_ROUNDS.
default on apeNEXT
IMPLEMENTATION for apeNEXT: implem (fma)

Definition at line 4012 of file math.h.

References math_inline.

math_inline double fmax double  x,
double  y
 

--------------------------------------------------------------------

NAME
fmax - maximum value
SYNOPSIS
#include <math.h>
double fmax(double x, double y)
float fmaxf(float x, float y)
long double fmaxl(long double x, long double y)
DESCRIPTION
The fmax() function determines the maximum numeric value of their arguments.
NaN arguments are treated as missing data: if one argument is NaN
and the other is numeric, then fmax choses the numeric value.
RETURN VALUE
The fmax() function returns the maximum numeric value of their arguments.
Notes
to do: if one value is NaN
IMPLEMENTATION for apeNEXT: implem (fmax)

Definition at line 3929 of file math.h.

References math_inline.

math_inline double fmin double  x,
double  y
 

---------------------------------------------------------------------

NAME
fmin - minimum value
SYNOPSIS
#include <math.h>
double fmin(double x, double y)
float fminf(float x, float y)
long double fminl(long double x, long double y)
DESCRIPTION
The fmin() function determines the minimum numeric value of their arguments.
NaN arguments are treated as missing data: if one argument is NaN
and the other is numeric, then fmin choses the numeric value.
RETURN VALUE
The fmin() function returns the minimum numeric value of their arguments.
Notes
to do: if one value is NaN
IMPLEMENTATION for apeNEXT: implem (fmin)

Definition at line 3971 of file math.h.

References math_inline.

math_inline double fmod double  x,
double  y
 

-------------------------------------------------------------------------

NAME
fmod
SYNOPSIS
#include <math.h>
double fmod(double x, double y)
float fmodf(float x, float y)
long double fmodl(long double x, long double y)
DESCRIPTION
The fmod() function computes the remainder r = x - n*y, for some
integer n such that, if y is nonzero, the result has the same sign as x
and magnitude less than the magnitude of y. If y is zero, whether a
domain error occurs or the fmod() function returns zero is
implementation-defined.
RETURN VALUE
The fmod() function returns the floating-point remainder of x/y.
Notes
see C99(F.9.7.1)
IMPLEMENTATION for apeNEXT: implem (fmod)

Author:
Edwin Laermann

Definition at line 3457 of file math.h.

References math_inline, and trunc().

Referenced by remainder(), and remquo().

math_inline double frexp double  value,
int *  eptr
 

--------------------------------------------------------------------

NAME
frexp -
SYNOPSIS
#include <math.h>
double frexp(double value, int *eptr)
float frexpf(float value, int *eptr)
long double frexpl(long double value, int *eptr)
DESCRIPTION
The function frexp() breaks a floating point number
into a normalized fraction x and an integral power of 2
such that value = x * 2^eptr. Thus x normally has
a magnitude in the interval [0.5,1).
RETURN VALUE
If value is not a floating-point number the results
are unspecified. Otherwise, the function returns the
value x and the integer stored in the int object
pointed to by eptr. If value is zero both parts of the
result are zero.
Notes
IMPLEMENTATION for apeNEXT: implem (frexp)

Author:
Edwin Laermann

Definition at line 1821 of file math.h.

References math_inline, and uint64_t.

math_inline double hypot double  x,
double  y
 

-----------------------------------------------------------------------

NAME
hypot - sqrt(x**2+y**2)
SYNOPSIS
#include <math.h>
double hypot(double x, double y)
float hypotf(float x, float y)
long double hypotl(long double x, long double y)
DESCRIPTION
The hypot() function computes the length of the hypotenuse of
a right triangle, where x and y represent the perpendicular sides
of the triangle. The hypot(x,y) function is defined as
sqrt(x**2 + y**2). No undue overflow or underflow (?).
A range error may occur.
RETURN VALUE
The hypot() function returns sqrt(x**2 + y**2)
Notes
IMPLEMENTATION for apeNEXT: implem (hypot)

Definition at line 2592 of file math.h.

References math_inline, and sqrt.

math_inline int ilogb double  x  ) 
 

-------------------------------------------------------------------------

NAME
ilogb -
SYNOPSIS
#include <math.h>
int ilogb(double x)
int ilogbf(float x)
int ilogbl(long double x)
DESCRIPTION
The ilogb() function extracts the exponent of x as
a signed integer value. If x is zero it computes
the value FP_ILOGB0, if x is infinite it computes
the value INT_MAX, if x is nan it computes the value
FP_ILOGBNAN. Otherwise the function is equivalent
to calling the corresponding logb function and casting
the returned value to type int. A range error may
occur if x is 0.
RETURN VALUE
The function ilogb() returns the exponent of x as a
signed integer
Notes
logb uses FLT_RADIX as basis, not requested here ?
IMPLEMENTATION for apeNEXT: implem (ilogb) ?: handling of NaN

Author:
Edwin Laermann

Definition at line 1891 of file math.h.

References math_inline, and uint64_t.

math_inline double ldexp double  x,
int  n
 

-------------------------------------------------------------------

NAME
ldexp -
SYNOPSIS
#include <math.h>
double ldexp(double x, int n)
float ldexpf(float x, int n)
long double ldexpl(long double x, int n)
DESCRIPTION
The function ldexp() multiplies x with 2^n,
where n is int. A range error may occur.
RETURN VALUE
The function ldexp() returns x * 2^n
Notes
IMPLEMENTATION for apeNEXT: implem (ldexp)

Definition at line 1937 of file math.h.

References math_inline.

math_inline double lgamma double  x  ) 
 

--------------------------------------------------------------------

NAME
lgamma - logarithm of gamma fct.
SYNOPSIS
#include <math.h>
double lgamma(double x)
DESCRIPTION
The lgamma() function computes the natural logarithm of
absolute value of the gamma function of x. A range
error occurs if x is too large. A range error may occur
if x is negative integer or zero.
RETURN VALUE
The lgamma() function returns the natural logarithm of the absolute
value of gamma(x) where gamma is the gamma function,
log_e | gamma(x) |
Notes
IMPLEMENTATION for apeNEXT: ? (lgamma) do we need that ?

Definition at line 2699 of file math.h.

References math_inline.

math_inline double log double  x  ) 
 

----------------------------------------------------------------------

NAME
log - natural logarithm
SYNOPSIS
#include <math.h>
double log(double x)
float logf(float x)
long double logl(long double x)
DESCRIPTION
The log() function computes the base-e (natural) logarithm of x.
A domain error occurs for negative argument. A range error
may occur if x is zero.
RETURN VALUE
The log() function returns the natural logarithm value log_e (x)
Notes

Log(x)
= e log(2) + log(x0)
= e log(2) + log(1+r)
= e log(2) + r + r^2 Q(r)

where:
e = lutloge(x) x = 2^e x0
x0 = lutlogm(x), 0.5 < x0 < 1.5
r = x0 - 1

$ Q(r) = \frac{ Log(1+r) - r }{ r^2} $

has been approximated by a Remez minimax polynomial:
==> p0 + p1 r + p2 r^2 + ..... + p36 r^36

degree = 36
[a,b] = [-0.5,0.5]
w(r) = r^2/(Log[1+r]).
N Iter = 20000
Max Error = 1.6*10^-18
IMPLEMENTATION for apeNEXT: implem (log)

Author:
ZZ version : Roberto De Pietri: v. 0.4 26/08/2001

C conversion : N. Paschedag : 15/02/2002

Definition at line 435 of file math.h.

References _math_setdouble, and math_inline.

math_inline double log10 double  x  ) 
 

------------------------------------------------------------------------

NAME
log10 - logarithm base 10
SYNOPSIS
#include <math.h>
double log10(double x)
float log10f(float x)
long double log10l(long double x)
DESCRIPTION
The log10() function computes the base-10 logarithm of x.
A domain error occurs if x is negative. A range error
may occur if x is zero.
RETURN VALUE
The log10() function returns the logarithm base 10 value
log_10 (x).
Notes
IMPLEMENTATION for apeNEXT: implem (log10)

Definition at line 1982 of file math.h.

References log, and math_inline.

math_inline double log1p double  xxx  ) 
 

--------------------------------------------------------------------

NAME
log1p - natural logarithm of (1+x)
SYNOPSIS
#include <math.h>
double log1p(double x)
float log1pf(float x)
long double log1pl(long double x)
DESCRIPTION
The log1p() function computes the base-e (natural) logarithm
of x plus 1, log_e (x+1). A domain error occurs if x less than -1.
A range error may occur if x equals -1.
RETURN VALUE
The log1p() function returns log_e (1+x).
Notes
IMPLEMENTATION for apeNEXT: implem (log1p)

Author:
ZZ version : Roberto De Pietri: v. 0.4 26/08/2001

C conversion : N. Paschedag : 15/02/2002

Definition at line 2025 of file math.h.

References _math_setdouble, and math_inline.

math_inline double log2 double  x  ) 
 

--------------------------------------------------------------------------

NAME
log2 - logarithm base 2
SYNOPSIS
#include <math.h>
double log2(double x)
float log2f(float x)
long double log2l(long double x)
DESCRIPTION
The log2() function computes the base-2 logarithm of x.
A domain error occurs if x is less than zero. A range error
may occur if x is 0.
RETURN VALUE
The log2() function returns log_2 (x)
Notes
IMPLEMENTATION for apeNEXT: implem (log2)

Author:
Edwin Laermann

Definition at line 2182 of file math.h.

References _math_setdouble, log, and math_inline.

math_inline long int lround double  x  ) 
 

-----------------------------------------------------------------------

NAME
lround
SYNOPSIS
#include <math.h>
long int lround(double x)
long int lroundf(float x)
long int lroundl(long double x)
DESCRIPTION
The lround() function rounds its argument to the nearest integer
value in floating format, rounding halfway cases away from zero,
regardless of the current rounding direction. If the rounded
value is outside the range of the return type the numeric result
is unspecified. A range error may occur if the magnitude of x
is too large.
RETURN VALUE
The lround() function returns the rounded integer value.
Notes
see round()
ISO requires long int return value
which is identical to int on apeNEXT
casting not yet properly taken into account
check also ftoi
IMPLEMENTATION for apeNEXT: implem (lround) faster way ?

Definition at line 3202 of file math.h.

References ceil(), floor(), and math_inline.

math_inline double modf double  value,
double *  dptr
 

---------------------------------------------------------------------

NAME
modf -
SYNOPSIS
#include <math.h>
double modf(double value, double *dptr)
float modff(float value, float *dptr)
long double modfl(long double value, long double *dptr)
DESCRIPTION
The modf() function breaks the argument value into
integral and fractional parts each of which has the
same type and sign as the argument. It stores the
integral part (in floating-point format) in the
object pointed to by dptr.
RETURN VALUE
The function modf() returns the signed fractional part
of value.
Notes
Should the use of pointers inside where be avoided ?
IMPLEMENTATION for apeNEXT: implem (modf) WARNING: LSH with |op2| > 64 ?

Author:
Edwin Laermann

Definition at line 2294 of file math.h.

References math_inline, and uint64_t.

math_inline double nan const char *  tagp  ) 
 

-----------------------------------------------------------------------

NAME
nan -
SYNOPSIS
#include <math.h>
double nan(const char *tagp)
float nanf(const char *tagp)
long double nanl(const char *tagp)
DESCRIPTION
The call nan("char-sequence") is equivalent to
strtod( "NAN(char-sequence)", (char**) NULL )
char-sequence is allowed to be empty.
If tagp does not point to char-sequence or an empty
string, the call is equivalent to
strtod( "NAN", (char**) NULL )
RETURN VALUE
Should return a quiet NaN, if available,
with content indicated through tagp.
If the implementation does not support quiet
NaN the function returns 0.
Notes
IMPLEMENTATION for apeNEXT: prob. NO (nan) needs characters

Definition at line 3612 of file math.h.

References math_inline.

math_inline double nextafter double  x,
double  y
 

---------------------------------------------------------------------

NAME
nextafter
SYNOPSIS
#include <math.h>
double nextafter(double x, double y)
float nextafterf(float x, float y)
long double nextafterl(long double x, long double y)
DESCRIPTION
The nextafter() function returns the next machine-
representable number after x in the direction of y.
The nextafter function returns y if x equals y. A range
error may occur if the magnitude if x is the largest
finite value representable in the type and the result
is infinite or not representable in the type.
RETURN VALUE
The nextafter() function returns the next machine-
representable number from x in the direction of y.
Notes
IMPLEMENTATION for apeNEXT: implem (nextafter) denorms ?
IMPLEMENTATION for apeNEXT: one more digit in write_double useful

Author:
Edwin Laermann

Definition at line 3656 of file math.h.

References copysign(), and math_inline.

math_inline double pow double  x,
double  y
 

------------------------------------------------------------------------

NAME
pow - power
SYNOPSIS
#include <math.h>
double pow(double x, double y)
float powf(float x, float y)
long double powl(long double x, long double y)
DESCRIPTION
The pow() function computes x raised to the power y.
A domain error occurs if x is finite and negative and
y is finite and not an integer value. A domain error
may occur if x is zero and y is less than or equal to zero.
A range error may occur.
RETURN VALUE
The pow() function returns the value of x**y
Notes
domain range errors not ISO compliant (?)
too slow yet
new 585 549 0 0 10 26
615 579 0 0 10 26 trunc introduced
498 460 0 0 10 28 fmod avoided
IMPLEMENTATION for apeNEXT: implem (pow) improvement needed

Author:
Edwin Laermann

Definition at line 3764 of file math.h.

References exp, log, math_inline, and uint64_t.

math_inline double remainder double  x,
double  y
 

-----------------------------------------------------------------------

NAME
remainder

SYNOPSIS
#include <math.h>
double remainder(double x, double y)

DESCRIPTION
The remainder() function computes the remainder x REM y.
When y != 0, the remainder r = x REM y is defined
regardless of the rounding mode by the mathematical
relation r = x - n*y, where n is the integer nearest
to the exact value of x/y; whenever |n - x/y| = 1/2, then
n is even. Thus, the remainder is always exact.
If r=0, its sign shall be that of x.

RETURN VALUE
The remainder() function returns x REM y.

Notes
Examples
(3,2) -> x/y=1.5 -> n=2, |2-1.5|=0.5 -> n even ok r=3-2*2=-1
(5,2) -> x/y=2.5 -> n=3, |3-2.5|=0.5 -> n odd => n->2 r=5-2*2=1
IMPLEMENTATION for apeNEXT:
implemented
Author:
Edwin Laermann

Definition at line 3504 of file math.h.

References fabs, fmod(), math_inline, and round().

Referenced by remquo().

math_inline double remquo double  x,
double  y,
int *  quo
 

----------------------------------------------------------------------------

NAME
remquo -
SYNOPSIS
#include <math.h>
double remquo(double x, double y, int *quo)
DESCRIPTION
The remquo() function computes the same remainder as the
remainder() function. In the object pointed to by quo it
stores a value whose sign is the sign of x/y and whose
magnitude is congruent modulo 2**n to the magnitude of
the integral quotient of x/y, where n is an implementation
defined integer greater than or equal to 3.
RETURN VALUE
The remquo() function returns x REM y.
Notes
The following implementation does not compare with
icc results in the quo value.
n = 3 chosen here
IMPLEMENTATION for apeNEXT: implem (remquo) what should this function exactly do ?

Definition at line 3560 of file math.h.

References copysign(), fmod(), math_inline, remainder(), and trunc().

math_inline double round double  x  ) 
 

-------------------------------------------------------------------------

NAME
round
SYNOPSIS
#include <math.h>
double round(double x)
float roundf(float x)
long double roundl(long double x)
DESCRIPTION
The round() function rounds its argument to the nearest integer
value in floating format, rounding halfway cases away from zero,
regardless of the current rounding direction (see note at bottom).
RETURN VALUE
The round() function returns the rounded integer value in double format.
Notes
round( 2.49)= 2, round( 2.5)= 3
round(-2.49)=-2, round(-2.5)=-3
IMPLEMENTATION for apeNEXT: implem (round) faster way ?

Author:
Edwin Laermann

Definition at line 3137 of file math.h.

References ceil(), floor(), and math_inline.

Referenced by remainder().

math_inline double sin double  x  ) 
 

----------------------------------------------------------------------

NAME
sin - sine
SYNOPSIS
#include <math.h>
double sin(double x)
float sinf(float x)
long double sinl(long double x)
DESCRIPTION
The sin() function computes the sine of x
measured in radians
RETURN VALUE
The sin() function returns the sine value
Notes
IMPLEMENTATION for apeNEXT: implem (sin)

Author:
ZZ version : Roberto De Pietri: v. 0.4 26/08/2001

C conversion : N. Paschedag : 15/02/2002

Definition at line 1207 of file math.h.

References _math_setdouble, cos_1oct(), math_inline, and sin_1oct().

math_inline double sinh double  x  ) 
 

-----------------------------------------------------------------------

NAME
sinh - hyperbolic sine
SYNOPSIS
#include <math.h>
double sinh(double x)
float sinhf(float x)
long double sinhl(long double x)
DESCRIPTION
The sinh() function computes the hyperbolic sine of x.
A range error occurs if the magnitude of x is too large.
RETURN VALUE
The sinh() function returns the hyperbolic sine value
Notes
version 1 533 497 0 0 10 26 version 2 519 483 0 0 10 26
IMPLEMENTATION for apeNEXT: implem (sinh)

Definition at line 1662 of file math.h.

References exp, and math_inline.

math_inline double sqrt double  a  ) 
 

--------------------------------------------------------------------------

NAME
sqrt - square root
SYNOPSIS
#include <math.h>
double sqrt(double x)
float sqrtf(float x)
long double sqrtl(long double x)
DESCRIPTION
The sqrt() function computes the nonnegative square root of x.
A domain error occurs if the argument is less than zero.
RETURN VALUE
The sqrt() function returns the sqrt root value
Notes
IMPLEMENTATION for apeNEXT: implem (sqrt)

Author:
?

Definition at line 356 of file math.h.

References _math_setdouble, and math_inline.

math_inline double tan double  x  ) 
 

---------------------------------------------------------------

NAME
tan - tangent
SYNOPSIS
#include <math.h>
double tan(double x)
float tanf(float x)
long double tanl(long double x)
DESCRIPTION
The tan() function computes the tangent of x,
measured in radians
RETURN VALUE
The tan() function returns the tangent value
Notes
The argument of the function Tan(x) is first reduced to y such that

x = k pi/2 + y, k integer and -pi/4 < y < pi/4

and then:

-pi/4 + k pi < x < pi/4 + k pi : Tan(x) = Tan(y)
-pi/4 + k pi < x < pi/4 + k pi : Tan(x) = - Cotan(y)

Tan(y) and CoTan(y) are computed according to:

---------------------------------------------------------

P = Tan(y) = y + y^3 P13(y^2)

Where P22(r) is a degree 13 minimax polynomial approximating

$ P(r) = \frac{ Tan(\sqrt r )-\sqrt r }{ r \sqrt r } $

degree = 13
[a,b] = [0,0.61685027506808]
w(r) = r^3/(Tan[r]).
N Iter = 20000
Max Error = 5.3*10^-18

---------------------------------------------------------
$ Q = \frac{1}{y} - cotan(y) = y + y^3 Q10(y^2) $

Where Q22(t) is a degree 10 minimax polinomial approximating

$ Q(r) = \frac{ 1/\sqrt(r) - CoTan(\sqrt(r)) - \sqrt(r)} {\sqrt(r) r} $

degree = 10
[a,b] = [0,0.61685027506808]
w(r) = r^3/( 1/Sqrt(r) - CoTan(sqrt(r)) ).
N Iter = 2000
Max Error = 2.36*10^-20

IMPLEMENTATION for apeNEXT: implem (tan)

Author:
ZZ version : Roberto De Pietri: v. 0.4 26/08/2001

C conversion : N. Paschedag : 15/02/2002

Definition at line 1338 of file math.h.

References _math_setdouble, and math_inline.

math_inline double tanh double  xxx  ) 
 

-----------------------------------------------------------------------

NAME
tanh - hyperbolic tangent
SYNOPSIS
#include <math.h>
double tanh(double x)
float tanhf(float x)
long double tanhl(long double x)
DESCRIPTION
The tanh() function computes the hyperbolic tangent of x.
RETURN VALUE
The tanh() function returns the hyperbolic tangent value.
Notes
IMPLEMENTATION for apeNEXT: implem (tanh)

Definition at line 1715 of file math.h.

References expm1(), and math_inline.

math_inline double tgamma double  x  ) 
 

---------------------------------------------------------------------

NAME
tgamma - gamma function
SYNOPSIS
#include <math.h>
double tgamma(double x)
DESCRIPTION
The function tgamma() computes the gamma function of x.
A domain error occurs if x is a negative integer or if
the result cannot be represented when x is zero. A
range error may occur if the magnitude of x is too large
or too small.
RETURN VALUE
The function tgamma() returns gamma(x).
Notes
IMPLEMENTATION for apeNEXT: ? (tgamma) do we need that ?

Definition at line 2735 of file math.h.

References math_inline.

math_inline double trunc double  x  ) 
 

---------------------------------------------------------------------

NAME
trunc
SYNOPSIS
#include <math.h>
double trunc(double x)
float truncf(float x)
long double truncl(long double x)
DESCRIPTION
The trunc() function rounds its argument to the integer value,
in floating format, nearest to but no larger in magnitude than
the argument. (1)
RETURN VALUE
The trunc() function returns x truncated to an integer value,
the return value is double
Notes
The description is taken from c99.pdf (7.12.9.8).
c99.pdf (F.9.6.8) says: "... rounding toward zero regardless
of rounding mode". (2)
Note: if magnitude is understood as absolute value (3),
then (1) and (2) would be identical

(1) (2) (3)
2.4 2 2 2
2.5 2 2 2
-2.4 -3 -2 -2
-2.5 -3 -2 -2

icc supports (2) or (3), thus, they are implemented

implementation as in rtc-lib

alternatively: get exp by ilogb
shift right, then left by 51-ilogb
rtc 159 137 0 0 10 12
new 128 108 0 0 10 10
IMPLEMENTATION for apeNEXT: implem (trunc) faster way ?

Definition at line 3307 of file math.h.

References math_inline, and uint64_t.

Referenced by fmod(), and remquo().


Generated on Mon Feb 20 15:54:30 2006 for nlibc by doxygen 1.3.5