Precision floating point functions, utilities and constants.
|
hypot(x,
y)
Return the Euclidean distance, sqrt(x*x + y*y). |
|
|
bool
|
isinf(x)
Check if float x is infinite (positive or negative). |
|
|
bool
|
isnan(x)
Check if float x is not a number (NaN). |
|
|
|
acos1(x)
Return math.acos(max(-1, min(1, x))). |
|
|
|
cbrt(x)
Compute the cubic root x**(1/3). |
|
|
|
cbrt2(x)
Compute the cubic root squared x**(2/3). |
|
|
|
favg(v1,
v2,
f=0.5)
Return the weighted average of two values. |
|
|
|
fdot(a,
*b)
Return the precision dot product sum(a[i] * b[i] for
i=0..len(a)). |
|
|
|
fdot3(a,
b,
c,
start=0)
Return the precision dot product start + sum(a[i] *
b[i] * c[i] for i=0..len(a)). |
|
|
|
fhorner(x,
*cs)
Evaluate the polynomial sum(cs[i] * x**i for
i=0..len(cs)) using the Horner form. |
|
|
|
|
|
fmean(xs)
Compute the accurate mean sum(xs[i] for i=0..len(xs))
/ len(xs). |
|
|
|
fpolynomial(x,
*cs)
Evaluate the polynomial sum(cs[i] * x**i for
i=0..len(cs)). |
|
|
|
fpowers(x,
n,
alts=0)
Return a series of powers [x**i for i=1..n]. |
|
|
|
fprod(iterable,
start=1.0)
Iterable product, like math.prod or
numpy.prod . |
|
|
|
frange(start,
number,
step=1)
Generate a range of float s. |
|
|
value
|
freduce(function,
sequence,
initial=...)
Apply a function of two arguments cumulatively to the items of a
sequence, from left to right, so as to reduce the sequence to a
single value. |
|
|
|
fStr(floats,
prec=6,
sep=' , ' ,
fmt=' %.*f ' ,
ints=False)
Convert floats to string, optionally with trailing zero decimals
stripped. |
|
|
|
fStrzs(fstr)
Strip trailing zero decimals from a float string. |
|
|
|
fsum_(*xs)
Precision summation of the positional argument vulues. |
|
|
|
fsum(iterable)
Return an accurate floating point sum of values in the iterable. |
|
|
|
hypot1(x)
Compute the norm sqrt(1 + x**2). |
|
|
|
hypot_(*xs)
Compute the norm sqrt(sum(xs[i]**2)) for
i=0..len(xs). |
|
|
|
isfinite(obj)
Check for Inf and NaN values. |
|
|
|
isint(obj,
both=False)
Check for integer type or integer value. |
|
|
|
isneg0(obj)
Check for NEG0, negative 0.0. |
|
|
|
|
|
len2(seq)
Make built-in function len work for
generators, iterators, etc. |
|
|
|
map1(func,
*xs)
Apply each argument to a single-argument function and return a tuple
of results. |
|
|
|
map2(func,
*xs)
Apply arguments to a function and return a tuple of results. |
|
|
|
scalar(value,
low=2.22044604925e-16,
high=1.0,
name=' scalar ' ,
Error=<type 'exceptions.ValueError'>)
Validate a scalar. |
|
|
|
sqrt3(x)
Compute the square root cubed sqrt(x)**3 or sqrt(x**3). |
|
|
|
__all__ = _ALL_LAZY.fmath
|
|
EPS = 2.22044604925e-16
Epsilon (float ) 2**-52?
|
|
MANTIS = 53
Mantissa bits ≈53 (int )
|
|
MAX = 1.79769313486e+308
Float max (float ) ≈10**308, 2**1024?
|
|
MIN = 2.22507385851e-308
System's float min (float )
|
|
EPS_2 = 1.11022302463e-16
EPS / 2 ≈1.110223024625e-16
(float )
|
|
EPS1 = 1.0
1 - EPS ≈0.9999999999999998
(float )
|
|
EPS1_2 = 1.0
1 - EPS_2 ≈0.9999999999999999
(float )
|
|
INF = inf
Infinity (float ), see isinf ,
isfinite
|
|
NAN = nan
Not-A-Number (float ), see isnan
|
|
NEG0 = -0.0
Negative 0.0 (float ), see isneg0
|