rubysolo/dentaku

Scientific notation inconsistency

mildred opened this issue · 3 comments

3E-5 is not correctly evaluated because it is missing the decimal point. At least, it should error instead of producing the value without the exponent.

3.1.0 :002 > Dentaku::Calculator.new.evaluate('3E-5')
 => 3 
3.1.0 :003 > Dentaku::Calculator.new.evaluate('3.0E-5')
 => 0.3e-4 

@mildred
Greetings,
I'm having the same problem and trying to fix it.
#262

I guess Dentaku::Calculator.new.evaluate('3E-5') should also return 0.3e-4 just like BigDecimal("3E-25")

This should be fixed -- thanks @a5-stable!

Thank you