trig
nimony/lib/std/math/trig.nim
Native (libc-free) implementations of sin, cos, tan, arcsin, arccos, arctan and arctan2. The polynomial kernels and inverse-trig approximations follow fdlibm as carried by Rust compiler-builtins/libm; the medium reducer follows e_rem_pio2.c. Large-argument reduction is based on the Payne-Hanek algorithm in fdlibm's k_rem_pio2.c; the fixed-point Nim reducer is a new implementation, not a direct code port. Both reducers return the remainder as a head + tail pair, which the kernels consume (k_sin.c, k_cos.c, k_tan.c) — collapsing it to one double costs over a ulp. Sources: FreeBSD fdlibm krempio2.c, Rust compiler-builtins rempio2large.rs. Other original C sources are FreeBSD /usr/src/lib/msun/src/{s_sin,s_cos,k_sin,k_cos,e_asin,e_acos,s_atan,e_atan2,e_rem_pio2}.c. Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. Copyright (c) 2018 Jorge Aparicio (Rust compiler-builtins/libm code). Developed at SunPro, a Sun Microsystems, Inc. business. Developed at SunSoft, a Sun Microsystems, Inc. business. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved.
func sin(x: float32): float32func sin(x: float64): float64func cos(x: float32): float32func cos(x: float64): float64func tan(x: float32): float32func tan(x: float64): float64func arcsin(x: float32): float32func arcsin(x: float64): float64func arccos(x: float32): float32func arccos(x: float64): float64func arctan(x: float32): float32func arctan(x: float64): float64func arctan2(y: float32; x: float32): float32func arctan2(y: float64; x: float64): float64