def logarithm_normalized

stelliferous@0.0.2.0 · math_fp32.bend:168

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

168# The exponent carry at mantissa word 0x3504f4 selects the same reduced
169# interval as halving m above sqrt(2), without a floating-point selection.
170def logarithm_normalized(x: F32,adjustment: F32) -> F32:
171  +word = F32.bits(x)
172  +adjusted = (word + 4913932 : U32)
173  logarithm_series((from_bits((word - U32.and(adjusted,4286578688) + 1065353216 : U32)) - 1.0 : F32),
174    ((from_bits(U32.or(U32.and(U32.shrn(adjusted,23n),255),1258291200)) - 8388735.0 : F32) - adjustment : F32))

Uses (11)

Used by (1)