MathFp32.tanh_magnitude: def of stelliferous@0.0.2.0 Import: import stelliferous@0.0.2.0/math_fp32.bend as MathFp32 Lines 89-92 of stelliferous@0.0.2.0/math_fp32.bend: https://jend.leeeet.dev/read.txt?path=stelliferous@0.0.2.0/math_fp32.bend&start_line=89&end_line=92 import Base # At |x|>=10, 1-tanh(|x|)<2*exp(-20)<2^-25. Clamping before arithmetic # also keeps infinities away from intermediate products; NaNs propagate. def tanh_magnitude(+x: F32) -> F32: F32.max(F32.min(10.0,from_bits(U32.and(F32.bits(x),2147483647))),0.000244140625) Uses (6): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.bits https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.max https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.min https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.and https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/math_fp32.bend&name=from_bits