def F32.hypot
import Base1875# Outside [2^-60, 2^60] the squares would overflow or underflow, so scale
1876# both sides by a power of two first; inside, the scale is 1 and exact.
1877def F32.hypot(a: F32, b: F32) -> F32:
1878 +x = F32.abs(a)
1879 +y = F32.abs(b)
1880 +m = F32.max(x, y)
1881 +hi = F32.is_gt(m, 1.152921504606847e18)
1882 +lo = F32.is_lt(m, 8.673617379884035e-19)
1883 +s = Bool.pick(F32, hi, 8.470329472543003e-22,
1884 Bool.pick(F32, lo, 1.2676506002282294e30, 1.0))
1885 +u = Bool.pick(F32, hi, 1.1805916207174113e21,
1886 Bool.pick(F32, lo, 7.888609052210118e-31, 1.0))
1887 +p = F32.mul(x, s)
1888 +q = F32.mul(y, s)
1889 F32.mul(F32.sqrt(F32.add(F32.mul(p, p), F32.mul(q, q))), u)
Uses (9)
Used by (0)
No other definition uses this definition.