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

#435 Fix zero with scale to boolean (main) #437

Merged
merged 2 commits into from
Feb 26, 2024

Conversation

stevenylai
Copy link
Contributor

@stevenylai stevenylai commented Feb 22, 2024

Fixes #435 in the main branch

@Adler95
Copy link

Adler95 commented Feb 22, 2024

@stevenylai I don't think this is the appropriate fix, as it doesn't really solve the: #435.
The problem must be somewhere in the evaluation process since EvaluationValue already contains incorrect result.

@stevenylai
Copy link
Contributor Author

It's a follow-up for #417 where the fix is to replace .equals() with .compareTo(). We missed the int -> boolean conversion part from the previous fix.

@Adler95
Copy link

Adler95 commented Feb 22, 2024

All good. I agree with you that there is a necessity to replace .equals() with .compareTo(). I just wanted to point out that it doesn't fix the issues referenced in your PR comment. #435 :)

@stevenylai
Copy link
Contributor Author

But I have a test 0.0&&1 : false under InfixAndOperatorTest which fails until I applied the change. Isn't this verifying the correct behavior as you described in the issue? Or perhaps you think this test is not enough to replicate the issue?

@Adler95
Copy link

Adler95 commented Feb 22, 2024

@stevenylai I just did a bit more detailed review of the process (at first I thought that this method is not invoked during evaluation). I can see now that this is the proper fix. I apologize for the false information and thank you for providing the fix quickly. :)

Copy link
Collaborator

@uklimaschewski uklimaschewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, you were a little bit faster than me.
I have just one request: Can you not do the cast directly, but use the getNumberValue() method, instead?

src/main/java/com/ezylang/evalex/data/EvaluationValue.java Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Feb 24, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@uklimaschewski uklimaschewski merged commit ee40a3d into ezylang:main Feb 26, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

Broken boolean expression evaluation in version 3.1.0
3 participants