RosettaCodeData/Task/Pathological-floating-point-problems/Ruby/pathological-floating-point-problems-1.rb

7 lines
173 B
Ruby
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
ar = [0, 2, -4]
100.times{ar << (111 - 1130.quo(ar[-1])+ 3000.quo(ar[-1]*ar[-2])) }
[3, 4, 5, 6, 7, 8, 20, 30, 50, 100].each do |n|
puts "%3d -> %0.16f" % [n, ar[n]]
end