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

Allow floats to use addition/subtraction to combine float literals #28

Open
JimmyCushnie opened this issue May 7, 2020 · 2 comments
Open
Labels
feature/enhancement New feature or request

Comments

@JimmyCushnie
Copy link
Owner

Today I had to write 0.5333333333. It would be much better to write 1/3 + 0.2.

@JimmyCushnie JimmyCushnie added the feature/enhancement New feature or request label May 7, 2020
@JimmyCushnie
Copy link
Owner Author

I worked on this for a while today, but I am unsatisfied with the neatness and reliability of the code. It also feels wrong to support addition/subtraction/division, but not multiplication, and not brackets.

I'm scrapping the work I've done so far on this feature. I think the proper implementation is to use some lightweight third party library that supports parsing a variety of mathematical operators.

I left the code I've written so far in the add-subtract-floats branch; see commit a165098.

@JimmyCushnie
Copy link
Owner Author

@ForLoveOfCats Kindly sent me this link today, and it seems like exactly what is needed for this feature: https://en.wikipedia.org/wiki/Shunting-yard_algorithm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant