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

Option to output floats instead of rounded integers #168

Open
soupslurpr opened this issue May 20, 2024 · 2 comments
Open

Option to output floats instead of rounded integers #168

soupslurpr opened this issue May 20, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@soupslurpr
Copy link

Hi, could there be an option to automatically convert integers to floats especially when it results in rounding? For example, doing 1/16 results in 0 but I expect 0.0625.

@ISibboI
Copy link
Owner

ISibboI commented May 20, 2024 via email

@soupslurpr
Copy link
Author

Okay, for now to achieve this I just change one line in tree/mod.rs line 842 from

Token::Int(int) => Some(Node::new(Operator::value(Value::Int(int)))),

to

Token::Int(int) => Some(Node::new(Operator::value(Value::Float(int as f64)))),

and it seems to work fine.

@ISibboI ISibboI added the enhancement New feature or request label Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants