math.bend checks
raw source on the hub · import bend-float64@0.1.6.0/math.bend as Math
bend-float64's math functions, NumPy's float64 set, every result correctly rounded (to nearest, ties to even). Each function is evaluated on balls (ball.bend: big-integer values with a rigorous error bound) at 128 bits, and again at 256, 512, 1024, 2048 until every point of the ball rounds to the same float64 (Ziv's strategy). Inputs whose answer is exact, or exactly halfway between two float64s, never settle that way, so they are found first and computed exactly: cbrt and hypot always are (integer roots with a remainder), exp2 of an integer, log2 of a power of two, log10 of 10^k, and every power x^y that is exact. Special values follow C99's Annex F; a NaN result has the bits NumPy gives on x86-64 (a NaN operand passes through quieted). Pure.
9 imports
import Base import ./wide.bend as W import ./big.bend as B import ./float64.bend as F import ./ball.bend as L import ./consts.bend as K import ./fb.bend as Q import ./fbconsts.bend as C import ./fast.bend as FS
Types
type Red source · line 194 · raw
Data
x = (k + f) pi / 2 with |f| <= 1/2: k mod 4, and r = f pi / 2, from 3600 bits of 2 / pi (x > 0)
Red@k:U32 -> @r:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> Red
type Fn source · line 217 · raw
Data
ZExp@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZExp2@k:U32 -> @f:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZExpm1@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZLog@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZLog2@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZLog10@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZLog1p@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZSin@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZCos@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZTan@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZAsin@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZAcos@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZAtan@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZAtan2@y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZSinh@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZCosh@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZTanh@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZAsinh@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZAcosh@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZAtanh@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZPow@neg:Bool -> @x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Fn
ZHalfPi@neg:Bool -> Fn
ZPi@neg:Bool -> Fn
ZQuarterPi@neg:Bool -> @three:Bool -> Fn
type TQ source · line 247 · raw
Data
which of sin r, cos r, sin r / cos r, cos r / sin r a quadrant needs, and its sign
TSinTQ
TCosTQ
TTanTQ
TCotTQ
type Out source · line 570 · raw
Data
Val@x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
Go@f:Fn -> Out
type LK source · line 671 · raw
Data
KLogLK
KLog2LK
KLog10LK
type PX source · line 915 · raw
Data
x = w 2^g, w odd; |y| = Y 2^f, Y odd
PX@w:List<&2, U32> -> @g:U32 -> @yo:0x71d2c95108c3e65654506f5521343c81/wide.W64 -> @f:U32 -> PX
type PK source · line 967 · raw
Data
which way x^y is computed: x a power of two, y a small integer, y a small odd multiple of 2^-j (j <= 5), or balls
KTwoPK
KIntPK
KRootPK
KBallPK
type PC source · line 1011 · raw
Data
CY0PC
CX1PC
CXNanPC
CYNanPC
CYInfPC
CXInfPC
CXZeroPC
CFinPC
type UK source · line 1051 · raw
Data
UExpUK
UExp2UK
UExpm1UK
ULogUK
ULog2UK
ULog10UK
ULog1pUK
USinUK
UCosUK
UTanUK
UArcsinUK
UArccosUK
UArctanUK
USinhUK
UCoshUK
UTanhUK
UArcsinhUK
UArccoshUK
UArctanhUK
UCbrtUK
Definitions
def fp source · line 20 · raw
@+h:U32 -> @+l:U32 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def is_neg source · line 23 · raw
@+x:U32 -> Bool
def neg_nan source · line 26 · raw
0x71d2c95108c3e65654506f5521343c81/float64.F64
def pos_nan source · line 29 · raw
0x71d2c95108c3e65654506f5521343c81/float64.F64
def one source · line 32 · raw
0x71d2c95108c3e65654506f5521343c81/float64.F64
def sign_word source · line 35 · raw
@+neg:Bool -> U32
def approx source · line 39 · raw
@b:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the float64 nearest the ball's midpoint, ignoring its error (for choosing branches, never for answers)
def below source · line 45 · raw
@+b:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+k:U32 -> Bool
|b| < 2^k, judged on the midpoint
def pi_b source · line 48 · raw
@+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def ln2_b source · line 51 · raw
@+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def ln10_b source · line 54 · raw
@+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def mul_i source · line 58 · raw
@+b:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+k:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
b * k for a signed word k
def signed source · line 61 · raw
@+neg:Bool -> @+b:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def small source · line 67 · raw
@+term:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+sum:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> Bool
def series_pick source · line 70 · raw
@stop:Bool -> @+sum:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+term:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @more:(@_:Unit -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball) -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def exp_series source · line 78 · raw
@fuel:Nat -> @+sum:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+term:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+x:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+n:U32 -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
sum + term + term * x / (n + 1) + ...
def odd_series source · line 87 · raw
@fuel:Nat -> @+sum:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+pw:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+z2:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+n:U32 -> @+alt:Bool -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
sum + pw * z2 / (2n + 1) + pw * z2^2 / (2n + 3) + ..., alternating when alt
def atanh_series source · line 97 · raw
@+z:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
atanh(z) = z + z^3/3 + z^5/5 + ... (|z| < 0.7)
def atan_series source · line 101 · raw
@+z:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
atan(z) = z - z^3/3 + z^5/5 - ... (|z| < 0.7)
def trig_series source · line 105 · raw
@fuel:Nat -> @+sum:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+term:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+x2:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+n:U32 -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
sum + term * x2 / ((n + 1)(n + 2)) + ...: sin, cos, sinh, cosh by their Taylor series (x2 = +-x^2)
def square_n source · line 115 · raw
@n:Nat -> @+b:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def exp_go source · line 123 · raw
@+a:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
e^a: a = k ln 2 + r, e^r = (e^(r / 256))^256 by its series
def exp_huge source · line 129 · raw
@huge:Bool -> @+a:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def exp_core source · line 137 · raw
@+a:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
e^a; past |a| = 1500 every point overflows or underflows, so a power of two far out stands for them all
def expm1_go source · line 140 · raw
@near:Bool -> @+a:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def expm1_core source · line 148 · raw
@+a:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
e^a - 1 (exact near 0)
def log_m source · line 151 · raw
@+m:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+k:U32 -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def log_core source · line 156 · raw
@+a:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
log(a), a > 0: a = 2^k m, m in [1/sqrt 2, sqrt 2], log m = 2 atanh((m - 1) / (m + 1))
def log1p_go source · line 163 · raw
@near:Bool -> @+u:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
log(1 + u), exact near 0
def log1p_core source · line 170 · raw
@+u:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def atan_small source · line 176 · raw
@+t:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
atan(t), |t| <= 1: halve the angle twice (t / (1 + sqrt(1 + t^2))), then the series
def atan_go source · line 183 · raw
@small:Bool -> @+t:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
atan(t), any t: past 1, pi/2 - atan(1/t)
def atan_any source · line 190 · raw
@+t:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def red_frac source · line 197 · raw
@+i:List<&2, U32> -> @+t:List<&2, U32> -> @+fb:U32 -> @+xm:List<&2, U32> -> @+ex:U32 -> @+p:U32 -> Red
def reduce source · line 204 · raw
@+xm:List<&2, U32> -> @+ex:U32 -> @+p:U32 -> Red
def sin_r source · line 209 · raw
@+r:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def cos_r source · line 212 · raw
@+r:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def ball source · line 243 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def tq_ball source · line 253 · raw
@t:TQ -> @+r:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+q:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def trig_q source · line 265 · raw
@+which:U32 -> @red:Red -> @+neg:Bool -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
which: 0 sin, 1 cos, 2 tan; quadrant k: sin = (s, c, -s, -c), cos = (c, -s, -c, s), tan = (s/c, -c/s)
def trig_cl source · line 274 · raw
@+which:U32 -> @c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
which: 0 sin, 1 cos, 2 tan; x finite and nonzero
def trig source · line 281 · raw
@+which:U32 -> @x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def sinh_go source · line 285 · raw
@near:Bool -> @+b:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+q:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
sinh b, b >= 0: the series below 1, (e^b - e^-b) / 2 above
def asinh_go source · line 294 · raw
@near:Bool -> @+b:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
asinh b, b >= 0: log1p(b + b^2 / (1 + sqrt(1 + b^2))) below 1, log(b + sqrt(b^2 + 1)) above
def atanh_go source · line 305 · raw
@near:Bool -> @+b:0x71d2c95108c3e65654506f5521343c81/ball.Ball -> @+q:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
atanh b, 0 <= b < 1: the series below 1/2, log1p(2b / (1 - b)) / 2 above
def eval source · line 312 · raw
@f:Fn -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/ball.Ball
def ziv_pick source · line 378 · raw
@m:Maybe<&2, 0x71d2c95108c3e65654506f5521343c81/float64.F64> -> @more:(@_:Unit -> 0x71d2c95108c3e65654506f5521343c81/float64.F64) -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def ziv source · line 386 · raw
@n:Nat -> @+f:Fn -> @+p:U32 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
evaluate at p bits, doubling p until the ball decides (at most n times)
def qb source · line 395 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/fb.FB
def qsigned source · line 398 · raw
@+neg:Bool -> @+a:0x71d2c95108c3e65654506f5521343c81/fb.FB -> 0x71d2c95108c3e65654506f5521343c81/fb.FB
def q_sinh source · line 401 · raw
@small:Bool -> @+b:0x71d2c95108c3e65654506f5521343c81/fb.FB -> 0x71d2c95108c3e65654506f5521343c81/fb.FB
def q_asinh source · line 409 · raw
@small:Bool -> @+b:0x71d2c95108c3e65654506f5521343c81/fb.FB -> 0x71d2c95108c3e65654506f5521343c81/fb.FB
def q_acos source · line 417 · raw
@+neg:Bool -> @+a:0x71d2c95108c3e65654506f5521343c81/fb.FB -> 0x71d2c95108c3e65654506f5521343c81/fb.FB
def fast_eval source · line 420 · raw
@f:Fn -> 0x71d2c95108c3e65654506f5521343c81/fb.FB
def run source · line 480 · raw
@+f:Fn -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the fast path's answer if its ball decides, else the arbitrary-precision balls from 128 bits up
def round_top source · line 485 · raw
@+s:U32 -> @t:0x71d2c95108c3e65654506f5521343c81/big.Top -> @+sticky:Bool -> @+e:U32 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def round_q source · line 491 · raw
@+s:U32 -> @+q:List<&2, U32> -> @+sticky:Bool -> @+e:U32 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the float64 nearest q * 2^e (plus a little, when sticky), q a nonzero big integer
def qr_q source · line 494 · raw
@d:0x71d2c95108c3e65654506f5521343c81/big.QR -> List<&2, U32>
def qr_r source · line 499 · raw
@d:0x71d2c95108c3e65654506f5521343c81/big.QR -> List<&2, U32>
def div3 source · line 504 · raw
@+v:U32 -> U32
def cbrt_go source · line 507 · raw
@+s:U32 -> @+m:List<&2, U32> -> @+ex:U32 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def cbrt_c source · line 514 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def cbrt_body source · line 523 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def hyp_go source · line 526 · raw
@+mx:List<&2, U32> -> @+ex:U32 -> @+my:List<&2, U32> -> @+ey:U32 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def hyp_far source · line 537 · raw
@far:Bool -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+mx:List<&2, U32> -> @+ex:U32 -> @+my:List<&2, U32> -> @+ey:U32 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def hyp_c source · line 544 · raw
@cx:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @cy:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def is_snan source · line 557 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Bool
def hypot source · line 562 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
sqrt(x^2 + y^2) without overflow (exact: the integer square root of the exact sum of squares). An infinity wins over a quiet NaN, as C99 says; a signalling NaN does not, as glibc does it.
def out source · line 574 · raw
@o:Out -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def is_int source · line 581 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Bool
def is_odd source · line 585 · raw
@+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Bool
an odd integer (every float64 from 2^53 up is even)
def nanv source · line 588 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def exp_c source · line 591 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def exp_body source · line 602 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def exp2_fin source · line 605 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def exp2_c source · line 610 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def exp2_body source · line 621 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def expm1_c source · line 624 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def expm1_body source · line 635 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def pow2_c source · line 639 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> Maybe<&2, U32>
k when x = 2^k
def pow10_f source · line 646 · raw
@+k:U32 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def pow10_k source · line 650 · raw
@n:Nat -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+k:U32 -> Maybe<&2, U32>
k when x = 10^k exactly, 0 <= k <= 22
def log_exact source · line 657 · raw
@m:Maybe<&2, U32> -> @f:Fn -> Out
def log10_of source · line 664 · raw
@int:Bool -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def log_fin source · line 677 · raw
@k:LK -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
x finite, positive, not 1
def invalid_of source · line 686 · raw
@k:LK -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def log_c source · line 693 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+k:LK -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def log_body source · line 704 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def log2_body source · line 707 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def log10_body source · line 710 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def log1p_c source · line 713 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def log1p_body source · line 724 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def trig_c source · line 727 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+which:U32 -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def sin_body source · line 738 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def cos_body source · line 741 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def tan_body source · line 744 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def above_one source · line 747 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Bool
def asin_c source · line 750 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def arcsin_body source · line 761 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def acos_c source · line 764 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def arccos_body source · line 776 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def atan_c source · line 779 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def arctan_body source · line 790 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def atan2_c source · line 793 · raw
@cy:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @cx:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def atan2_n source · line 808 · raw
@nx:Bool -> @ny:Bool -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def arctan2 source · line 818 · raw
@+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
atan(y / x) in the quadrant of (x, y), in [-pi, pi] (C99's signed zeros and infinities; of two NaNs, x's)
def hyp_big source · line 821 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+k:U32 -> Bool
def sinh_c source · line 824 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def sinh_body source · line 833 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def cosh_c source · line 836 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def cosh_body source · line 847 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def tanh_c source · line 850 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def tanh_body source · line 862 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the hyperbolic tangent (a NaN gives the plain quiet NaN, as NumPy's own tanh does)
def asinh_c source · line 865 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def arcsinh_body source · line 874 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def acosh_c source · line 877 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def arccosh_body source · line 888 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def atanh_c source · line 891 · raw
@c:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def arctanh_body source · line 902 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def ctz_w source · line 907 · raw
@+m:0x71d2c95108c3e65654506f5521343c81/wide.W64 -> U32
def sdiv2j source · line 911 · raw
@+v:U32 -> @+j:U32 -> U32
v / 2^j for a signed v that 2^j divides (j below 32)
def px_of source · line 918 · raw
@cx:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> @cy:0x71d2c95108c3e65654506f5521343c81/float64.Cls -> PX
def pow_int source · line 928 · raw
@+s:U32 -> @+w:List<&2, U32> -> @+g:U32 -> @+n:U32 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
(w 2^g)^n exactly, 0 < |n| <= 64
def two_to source · line 936 · raw
@+s:U32 -> @+huge:Bool -> @+up:Bool -> @+r:U32 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
2^r for a signed r, or past the range on r's side when huge
def pow_two source · line 940 · raw
@+s:U32 -> @+g:U32 -> @+yo:0x71d2c95108c3e65654506f5521343c81/wide.W64 -> @+f:U32 -> @+yneg:Bool -> @+neg:Bool -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
x = 2^g: x^y = 2^(g y), exact when g y is an integer (x = 1 here only as |-1|: the answer is +-1)
def root2j source · line 950 · raw
@n:Nat -> @+w:List<&2, U32> -> Maybe<&2, List<&2, U32>>
the 2^j-th root of w, when w is a perfect 2^j-th power
def pow_root source · line 959 · raw
@r:Maybe<&2, List<&2, U32>> -> @+s:U32 -> @+g:U32 -> @+ya:U32 -> @+j:U32 -> @+neg:Bool -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
y = Y / 2^j > 0: when w = t^(2^j) and 2^j divides g Y, x^y = t^Y 2^(g Y / 2^j) exactly
def pk_of source · line 973 · raw
@+w:List<&2, U32> -> @+f:U32 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+yo:0x71d2c95108c3e65654506f5521343c81/wide.W64 -> PK
def pow_k source · line 978 · raw
@k:PK -> @+w:List<&2, U32> -> @+g:U32 -> @+yo:0x71d2c95108c3e65654506f5521343c81/wide.W64 -> @+f:U32 -> @+neg:Bool -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def pow_px source · line 989 · raw
@p:PX -> @+neg:Bool -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def pow_y_inf source · line 995 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
C99's table, in order; x and y not NaN unless said
def pow_x_inf source · line 999 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def pow_x_zero source · line 1003 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def pow_fin source · line 1007 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def pc_of source · line 1021 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> PC
def pow_pc source · line 1025 · raw
@c:PC -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> Out
def power source · line 1046 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> @+y:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
x^y (C99's special cases; exact whenever the answer is exact or halfway, every other answer correctly rounded). A NaN x passes through quieted, its sign cleared when y is an odd integer, as glibc's pow does.
def nan_of source · line 1073 · raw
@k:UK -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def unary_go source · line 1080 · raw
@k:UK -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
def unary source · line 1124 · raw
@na:Bool -> @k:UK -> @+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
k's function at x, a NaN passing through quieted (tanh's gives the plain quiet NaN, as NumPy's own tanh does)
def exp source · line 1132 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
e^x
def exp2 source · line 1136 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
2^x (exact for integers)
def expm1 source · line 1140 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
e^x - 1, exact near 0
def log source · line 1144 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the natural logarithm
def log2 source · line 1148 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the base-2 logarithm (exact for powers of two)
def log10 source · line 1152 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the base-10 logarithm (exact for 10^k)
def log1p source · line 1156 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
log(1 + x), exact near 0
def sin source · line 1160 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the sine (argument reduction with 3600 bits of 2/pi, so exact for any x)
def cos source · line 1164 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the cosine
def tan source · line 1168 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the tangent
def arcsin source · line 1172 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the arcsine, in [-pi/2, pi/2]
def arccos source · line 1176 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the arccosine, in [0, pi]
def arctan source · line 1180 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the arctangent, in [-pi/2, pi/2]
def sinh source · line 1184 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the hyperbolic sine
def cosh source · line 1188 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the hyperbolic cosine
def tanh source · line 1192 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the hyperbolic tangent
def arcsinh source · line 1196 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the inverse hyperbolic sine
def arccosh source · line 1200 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the inverse hyperbolic cosine, x >= 1
def arctanh source · line 1204 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the inverse hyperbolic tangent, |x| <= 1
def cbrt source · line 1208 · raw
@+x:0x71d2c95108c3e65654506f5521343c81/float64.F64 -> 0x71d2c95108c3e65654506f5521343c81/float64.F64
the cube root (exact: an integer cube root with its remainder)