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

Broken boolean expression evaluation in version 3.1.0 #435

Closed
Adler95 opened this issue Feb 15, 2024 · 0 comments · Fixed by #437 or #438
Closed

Broken boolean expression evaluation in version 3.1.0 #435

Adler95 opened this issue Feb 15, 2024 · 0 comments · Fixed by #437 or #438

Comments

@Adler95
Copy link

Adler95 commented Feb 15, 2024

With version 3.1.0, the boolean expression evaluation was broken. It seems that the problem takes effect only when scale of the BigDecimal is greater than zero.

Example (correct result) with scale 0:

        Expression expression = new Expression("a && b");

        EvaluationValue result = expression
                .with("a", BigDecimal.ZERO)
                .and("b", BigDecimal.ZERO)
                .evaluate();

        System.out.println(result.getBooleanValue()); // prints false

Example (wrong result) with scale 1:

        Expression expression = new Expression("a && b");
        
        EvaluationValue result = expression
                .with("a", new BigDecimal("0.0"))
                .and("b", new BigDecimal("0.0"))
                .evaluate();

        System.out.println(result.getBooleanValue()); // prints true
@Adler95 Adler95 changed the title Broken boolean expression evaluation in 3.1.0 version Broken boolean expression evaluation in version 3.1.0 Feb 15, 2024
@uklimaschewski uklimaschewski linked a pull request Feb 26, 2024 that will close this issue
uklimaschewski pushed a commit that referenced this issue Feb 26, 2024
* Fixes number to boolean conversion
uklimaschewski pushed a commit that referenced this issue Feb 26, 2024
* Fixes number to boolean conversion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant