def logarithm_finish

stelliferous@0.0.2.0 · math_fp32.bend:176

import stelliferous@0.0.2.0/math_fp32.bend as MathFp32
import Base

176# Scaling a subnormal by 2^23 is exact. Zero, negatives, infinities and
177# NaNs are selected explicitly, after normalizing the finite positive input.
178def logarithm_finish(+x: F32,value: F32) -> F32:
179  +word = F32.bits(x)
180  +magnitude = U32.and(word,2147483647)
181  +zero = (0 - U32.shrn((magnitude - 1 : U32),31n) : U32)
182  +negative = (0 - U32.shrn(word,31n) : U32)
183  +special = U32.not((0 - U32.shrn((magnitude - 2139095040 : U32),31n) : U32))
184  selected(zero,from_bits(4286578688),selected(negative,from_bits(2143289344),selected(special,(x + x : F32),value)))

Uses (10)

Used by (1)