Files
alexm 568474d52f
Test (in pplus-core) / in-core (push) Failing after 28m44s
Initial commit
2026-11-12 22:23:48 -05:00

15 lines
1.4 KiB
Mojo

# probe: fma and hypot from std.math on Float64: fma rounds once, and hypot does not overflow or underflow in between
from std.math import fma, hypot
def main():
var z = 0.0
var inf = 1.0 / z
var a = 0.1
print(fma(a, Float64(10.0), Float64(-1.0)), a * 10.0 - 1.0, fma(Float64(1.0) + 2.0 ** -52, Float64(1.0) - 2.0 ** -52, Float64(-1.0)))
print(fma(Float64(2.0), Float64(3.0), Float64(4.0)), fma(Float64(1e308), Float64(10.0), Float64(-1e308)), fma(Float64(-0.0), Float64(1.0), Float64(-0.0)), fma(Float64(0.0), Float64(-1.0), Float64(0.0)), fma(Float64(1.5), Float64(-2.0), Float64(3.0)))
print(fma(Float64(1e-300), Float64(1e-300), Float64(0.0)), fma(Float64(3.0), Float64(1e-320), Float64(0.0)), fma(inf, Float64(2.0), Float64(1.0)), fma(Float64(0.1), Float64(0.2), Float64(0.3)))
print(hypot(Float64(3.0), Float64(4.0)), hypot(Float64(1e200), Float64(1e200)), hypot(Float64(1e-200), Float64(1e-200)), hypot(Float64(-5.0), Float64(12.0)), hypot(Float64(0.0), Float64(0.0)))
print(hypot(Float64(0.1), Float64(0.2)), hypot(Float64(1.0), Float64(1e-17)), hypot(Float64(5e-324), Float64(5e-324)), hypot(Float64(1e308), Float64(1e308)), hypot(inf, Float64(1.0)), hypot(Float64(2.0), Float64(1e-310)))
print(hypot(Float64(1.5), Float64(2.5)), hypot(Float64(7.25), Float64(-0.75)), hypot(Float64(123456.789), Float64(0.001)), hypot(Float64(1e-310), Float64(3e-310)))