power
nimony/lib/std/math/power.nim
These implementations are ported from the Rust compiler-builtins libm library. Original sources: - sqrt: musl src/math/sqrt.c (direct port, correctly rounded) - cbrt (f32): FreeBSD /usr/src/lib/msun/src/scbrtf.c - cbrt (f64): core-math/src/binary64/cbrt/cbrt.c (Copyright (c) 2021-2022 Alexei Sibidanov) - pow (f32): FreeBSD /usr/src/lib/msun/src/epowf.c (Conversion to float by Ian Lance Taylor, Cygnus Support) - pow (f64): FreeBSD /usr/src/lib/msun/src/e_pow.c (Copyright (C) 2004 by Sun Microsystems, Inc.) - hypot (f32/f64): core-math (Copyright (c) 2022 Alexei Sibidanov)
func sqrt(x: float32): float32Square root for f32: the correctly rounded f64 root rounds correctly to f32 (binary64 carries more than 2*24 + 2 bits).
func sqrt(x: float64): float64Square root for f64, correctly rounded (musl sqrt.c).
func cbrt(x: float32): float32Cube root for f32 origin: FreeBSD /usr/src/lib/msun/src/s_cbrtf.c
func cbrt(x: float64): float64Cube root for f64, using exponent-scaled Newton iteration.
func pow(x: float32; y: float32): float32Port of FreeBSD msun e_powf.c (fdlibm), converted by Ian Lance Taylor.
func pow(x: float64; y: float64): float64Port of FreeBSD msun e_pow.c (fdlibm).
func hypot(x: float32; y: float32): float32Euclidean distance (hypotenuse) for f32.
func hypot(x: float64; y: float64): float64Euclidean distance (hypotenuse) for f64.