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

can't omit precision for a Float #58

Closed
proteste-dcm opened this issue Sep 3, 2015 · 1 comment
Closed

can't omit precision for a Float #58

proteste-dcm opened this issue Sep 3, 2015 · 1 comment

Comments

@proteste-dcm
Copy link

Hi guys,

Here's what's happening:

https://gist.github.com/proteste-dcm/c4f49f680d4fdf1450ff

How should I store the values for my variables?

Cheers.

@rubysolo
Copy link
Owner

rubysolo commented Sep 3, 2015

This is fixed on master, but I haven't cut a new gem version yet -- sorry about that!

[1] pry(main)> c = Dentaku::Calculator.new
=> #<Dentaku::Calculator:0x007fcbb91b9270 @ast_cache={}, @memory={}, @tokenizer=#<Dentaku::Tokenizer:0x007fcbb91b9860>>
[2] pry(main)> c.store({"cost_of_eletricity"=>0.253, "scrn_native_vert"=>10.0, "connectstodlnaserver"=>100.0})
=> #<Dentaku::Calculator:0x007fcbb91b9270 @ast_cache={}, @memory={"cost_of_eletricity"=>0.253, "scrn_native_vert"=>10.0, "connectstodlnaserver"=>100.0}, @tokenizer=#<Dentaku::Tokenizer:0x007fcbb91b9860>>
[3] pry(main)> c.evaluate("( ( 1 + scrn_native_vert ) * connectstodlnaserver ) / cost_of_eletricity")
=> #<BigDecimal:7fcbb886e738,'0.4347826086 957E4',18(36)>

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

2 participants