# ok => 2.718...
n = 1_000_000_000;
((BigDecimal.new(n) + BigDecimal.new(1)) / BigDecimal.new(n))**BigDecimal.new(n)
# gives infinity, not good, it should converge to value E or rise
# an exception if it can't compute it.
n = 1_000_000_000_0;
((BigDecimal.new(n) + BigDecimal.new(1)) / BigDecimal.new(n))**BigDecimal.new(n)
I am running Ruby 2.4.2, do you observe the same behaviour
in your release?
# ok => 2.718...
n = 1_000_000_000;
((BigDecimal.new(n) + BigDecimal.new(1)) / BigDecimal.new(n))**BigDecimal
.new(n)
# gives infinity, not good, it should converge to value E or rise
# an exception if it can't compute it.
n = 1_000_000_000_0;
((BigDecimal.new(n) + BigDecimal.new(1)) / BigDecimal.new(n))**BigDecimal
.new(n)
I am running Ruby 2.4.2, do you observe the same behaviour
in your release?
Umm, very suspicious, my configuration is similar.
But I restarted the irb, redone the computation, and still it fails.
It could be because I am in a 32 bit system. I report my config in details.
# ok => 2.718...
n = 1_000_000_000;
((BigDecimal.new(n) + BigDecimal.new(1)) /
BigDecimal.new(n))**BigDecimal.new(n)
# gives infinity, not good, it should converge to value E or rise
# an exception if it can't compute it.
n = 1_000_000_000_0;
((BigDecimal.new(n) + BigDecimal.new(1)) /
BigDecimal.new(n))**BigDecimal.new(n)
========================
I am running Ruby 2.4.2, do you observe the same behaviour
in your release?
# ok => 2.718...
n = 1_000_000_000;
((BigDecimal.new(n) + BigDecimal.new(1)) /
BigDecimal.new(n))**BigDecimal.new(n)
# gives infinity, not good, it should converge to value E or rise
# an exception if it can't compute it.
n = 1_000_000_000_0;
((BigDecimal.new(n) + BigDecimal.new(1)) /
BigDecimal.new(n))**BigDecimal.new(n)
========================
I am running Ruby 2.4.2, do you observe the same behaviour
in your release?