def F32.to_nat.wide
import Base1912# Preserve the direct cast below 2^32; wider Nats need both word halves.
1913# Past 2^48-1 no Nat fits, so the direct cast gives 0.
1914def F32.to_nat.wide(+a: F32, wide: Bool) -> Nat:
1915 match wide:
1916 case False{}:
1917 U32.to_nat(F32.to_u32(a))
1918 case True{}:
1919 +hi = U32.to_nat(F32.to_u32(F32.div(a, 4294967296.0)))
1920 +lo = U32.to_nat(F32.to_u32(F32.mod(a, 4294967296.0)))
1921 Nat.add(Nat.mul(hi, Nat.mul(65536n, 65536n)), lo)