[SciPy-dev] [SciPy-user] numpy's math library?
Charles R Harris
charlesr.harris at gmail.com
Thu Jan 12 00:22:16 CST 2006
On 1/11/06, Travis E. Oliphant <oliphant.travis at ieee.org> wrote:
> Charles R Harris wrote:
> >
> > >
> > >
> > >
> > Will we really have to test for all of these if we add them? It would
> > be nice to have a single HAVE_C99 defined that we could use to test for
> > the presence and/or absence of these functions.
> >
> >
> > I use erf and erfc pretty often. If only every c compiler were c99
> > compliant we could bring in all the standard functions.
>
> I think what we are proposing is a small project to bring just the
> functions defined in the C99 standard over to numpy. Yes, they would
> have to be in C to do that. Complex-versions would be nice but not
> necessary for all of them.
Here is a list to start with. Some of these probably aren't in the C99
standard and some might not be suitable for ufuncs.
/* Arc cosine of X. */
acos
/* Arc sine of X. */
asin
/* Arc tangent of X. */
atan
/* Arc tangent of Y/X. */
atan2
/* Cosine of X. */
cos
/* Sine of X. */
sin
/* Tangent of X. */
tan
/* Hyperbolic cosine of X. */
cosh
/* Hyperbolic sine of X. */
sinh
/* Hyperbolic tangent of X. */
tanh
/* Hyperbolic arc cosine of X. */
acosh
/* Hyperbolic arc sine of X. */
asinh
/* Hyperbolic arc tangent of X. */
atanh
/* Exponential function of X. */
exp
/* Break VALUE into a normalized fraction and an integral power of 2. */
frexp
/* X times (two to the EXP power). */
ldexp
/* Natural logarithm of X. */
log
/* Base-ten logarithm of X. */
log10
/* Break VALUE into integral and fractional parts. */
modf
/* A function missing in all standards: compute exponent to base ten. */
exp10
/* Another name occasionally used. */
pow10
/* Return exp(X) - 1. */
expm1
/* Return log(1 + X). */
log1p
/* Return the base 2 signed integral exponent of X. */
logb
/* Compute base-2 exponential of X. */
exp2
/* Compute base-2 logarithm of X. */
log2
/* Return X to the Y power. */
pow
/* Return the square root of X. */
sqrt
/* Return `sqrt(X*X + Y*Y)'. */
hypot
/* Return the cube root of X. */
cbrt
/* Smallest integral value not less than X. */
ceil
/* Absolute value of X. */
fabs
/* Largest integer not greater than X. */
floor
/* Floating-point modulo remainder of X/Y. */
fmod
/* Return the remainder of X/Y. */
drem
/* Return the fractional part of X after dividing out `ilogb (X)'. */
significand
/* Return X with its signed changed to Y's. */
copysign
/* Bessel functions */
j0
j1
jn
y0
y1
yn
erf
erfc
lgamma
tgamma
/* Obsolete alias for `lgamma'. */
gamma
/* Return the integer nearest X in the direction of the prevailing
rounding mode. */
rint
/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
nextafter
nexttoward
/* Return the remainder of integer divison X / Y with infinite precision. */
remainder
/* Return X times (2 to the Nth power). */
scalbn
/* Return the binary exponent of X, which must be nonzero. */
ilogb
/* Return X times (2 to the Nth power). */
scalbln
/* Round X to integral value in floating-point format using current
rounding direction, but do not raise inexact exception. */
nearbyint
/* Round X to nearest integral value, rounding halfway cases away from zero. */
round
/* Round X to the integral value in floating-point format nearest but
not larger in magnitude. */
trunc
/* Compute remainder of X and Y and put in *QUO a value with sign of x/y
and magnitude congruent `mod 2^n' to the magnitude of the integral
quotient x/y, with n >= 3. */
remquo
/* Round X to nearest integral value according to current rounding
direction. */
lrint
llrint
/* Round X to nearest integral value, rounding halfway cases away from zero. */
lround
llround
/* Return positive difference between X and Y. */
fdim
/* Return maximum numeric value from X and Y. */
fmax
/* Return minimum numeric value from X and Y. */
fmin
/* Multiply-add function computed as a ternary operation. */
fma
/* Return X times (2 to the Nth power). */
scalb
Chuck
More information about the Scipy-dev
mailing list