This commit is contained in:
commit
568474d52f
1591 files changed
+528213
No files matched your search
@@ -0,0 +1,14 @@
|
||||
# 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)))
|
||||
Reference in new issue
Block a user