You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to estimate log(BigDecimal) starts infinite loop for some random BigDecimals values, trying to test it and get this:
timer.start()
for(_ <-1 to 100){
valbd=BigDecimal(math.random() *100)
print(s"for BigDecimal $bd")
println(s" result is ${ln(bd)}")
timer.restartTimer
}
output:
for BigDecimal 95.43783506046007 result is 4.5584750937568150091505279932085940
for BigDecimal 65.74758834870731 result is 4.1858229912780658998029987138361140
for BigDecimal 19.975121517921245 result is 2.9944875751342717477239494914685500
for BigDecimal 35.87874081671405 result is 3.5801449422802959968367744428563220
for BigDecimal 57.00977196205218
1
2
3
4
5...
With Double values it works perfectly.
The text was updated successfully, but these errors were encountered:
@xmelko91 Thanks for the bug report. I can't fix the issue right now.
In general, I think we need to be careful with BigDecimal support in Spire, due to the use of MathContext which does not fit exactly with the principles adopted by Spire.
@armanbilge spire is a type level math repo. So I think we can make log(Int, Int) different from log(double, double).
In BigDecimal 1 means 1.00000000 and in Int 1 just means 1. This in scala is easy and it's a worthwhile job.
Trying to estimate log(
BigDecimal
) starts infinite loop for some randomBigDecimal
s values, trying to test it and get this:output:
With Double values it works perfectly.
The text was updated successfully, but these errors were encountered: