MathFp32.tanh_finish: def of stelliferous@0.0.2.0 Import: import stelliferous@0.0.2.0/math_fp32.bend as MathFp32 Lines 81-87 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=81&end_line=87 import Base # Sign restoration and the tiny interval are word selections. For |x|<2^-12, # |x-tanh(x)|<|x|^3/3 is below half an F32 ulp, so return x, including -0. def tanh_finish(+x: F32,+value: F32) -> F32: +word = F32.bits(x) +small = (0 - U32.shrn((U32.and(word,2147483647) - 964689920 : U32),31n) : U32) +keep = U32.or(small,2147483648) from_bits(U32.or(U32.and(word,keep),U32.and(F32.bits(value),U32.not(keep)))) Uses (9): 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=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.not https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.or https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.shrn https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/math_fp32.bend&name=from_bits