Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return wrong type of value with zero fraction in decimal number #64

Open
dankatanka opened this issue Nov 15, 2015 · 2 comments
Open

Return wrong type of value with zero fraction in decimal number #64

dankatanka opened this issue Nov 15, 2015 · 2 comments

Comments

@dankatanka
Copy link

calculator.evaluate('10 + 1.1')
=> 11.1

calculator.evaluate('1.0')
=> 1.0

calculator.evaluate('10 + 1.0')
=> 11

Why not 11.0?

@rubysolo
Copy link
Owner

Currently, Dentaku reads arithmetic operands as BigDecimal, but then converts to integer if the fractional part is zero. This is a little surprising though -- when I have a chance, I'll look into retaining the type if it was explicit in the original expression.

@wendy0402
Copy link
Contributor

@rubysolo why don't you set the result always BigDecimal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants