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

Square root #3

Open
kartano opened this issue Dec 21, 2016 · 0 comments
Open

Square root #3

kartano opened this issue Dec 21, 2016 · 0 comments

Comments

@kartano
Copy link
Owner

kartano commented Dec 21, 2016

We need a system for handling square roots. √2 for example.

The main issue with √ is with determining what portion of the expression it is trying to squre.

If we have 5 * √2a for example, are we taking the sqaure of 2 * a? Or the square of 2, multiplied by a?

I'm suggesting using a specific command such as sqrt() to handle this. So the tokenizer should consume the sqrt and handle the entire sub-expression before continuing on with the rest of the equation.

I.E:

5 * 2 +8 / sqrt(144*2) + 5

.... the tokenizer should push the sqrt open brack onto the operator stack, carry out the equation until it comes to a closing bracket. Then it should continue on with the remainder of the equation.

This would also allow for nested square roots.

17.5-8+16a+sqrt(144sqrt(144))*18/5.5

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

No branches or pull requests

1 participant