def fmod
import bend-collections-laws-crypto@1.0.0.0/spec/math/f64.bend as F64import Base
import bend-collections-laws-crypto@1.0.0.0/src/math/f64.bend as F
514# x - n y with n = trunc(x / y): the exact remainder of the scaled
515# significands, with the sign of x; NaN for NaN, an infinite x or a zero y;
516# x for an infinite y (4.3: fmod(x, inf) == x)
517def fmod(+x: F.F64, +y: F.F64) -> F.F64:
518 pick(F.F64, rbad(x, y), qnan(), pick(F.F64, is_inf(y), x, round(sign(x), Nat.mod(ra(x, y), rb(x, y)), rsc(x, y))))