def ldexp

bend-collections-laws-math@1.0.0.0 · spec/math/f64.bend:421

import bend-collections-laws-math@1.0.0.0/spec/math/f64.bend as F64
import Base
import bend-collections-laws-math@1.0.0.0/src/math/f64.bend as F

421# x 2^e rounded once: overflow to infinity, gradual underflow (4.4); a
422# scale below 2^-Z is a product under 2^-2947, which rounds to a zero like
423# the scale 0 it is cut to
424def ldexp(+x: F.F64, +neg: Bool, +k: Nat) -> F.F64:
425  pick(F.F64, is_nan(x), qnan(), pick(F.F64, Bool.or(is_inf(x), is_zero(x)), x, round(sign(x), mant(x), pick(Nat, neg, Nat.sub(xexp(x), k), Nat.add(xexp(x), k)))))

Uses (15)

Used by (2)