-
Notifications
You must be signed in to change notification settings - Fork 38.4k
SPR-9164 - Added BigDecimal capabilities to SpEl numeric operators #80
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
SPR-9164 - Added BigDecimal capabilities to SpEl numeric operators #80
Conversation
In addition to the contributor guidelines, you might find it helpful, Giovanni, to simply browse through the commit log to see how other commits look. You can easily do this with |
I amended my work, rebasing on current Spring's master. I hope that this'll be the right time. @cbeams: you commented my choice:
This is a choice: to not risk the calculation error due to the double approximation (is this the same error that this issue want to fix?). Using the BigDecimal as first choice, we get away from this risk. Do you agree? |
@cbeams @giovannidalloglio regarding test for Double first or test for BigDecimal first: If one operand is Double and the other is BigDecimal, then the operation should treat both as BigDecimal. So the test for BigDecimal first is correct. |
|
||
evaluate("3 le 5", true, Boolean.class); | ||
evaluate("5 le 3", false, Boolean.class); | ||
evaluate("3 le 5", true, Boolean.class); | ||
evaluate("5 le 3", false, Boolean.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These new two lines are just a duplicate of the two lines preceding them??
Apart from the duplicate tests this looks ok to me. Two further comments:
rather than
and this PR uses the latter. |
Issue: SPR-9164 Prior to this change, SpEL supported numeric operations for int, float, ... 'new java.math.BigDecimal('0.1') > 0' evaluates to false (BigDecimal is truncated to int) This commit introduces support for BigDecimal operations 'new java.math.BigDecimal('0.1') > 0' evaluates to true (the comparison is made with bigDecimals) In the meantime (from the pull request to now), SpEL advanced [operator++, between]. Now is everything covered, updated and fixed. In addition, some polish (like Phil Webb commit e83bdda)
* SPR-9164: Add BigDecimal support for SpEl numeric operations
Great pull request! This has now been merged into master with a few minor tweaks. Thanks! |
This commit makes messageEncoders a required argument for building a client request - those are needed to actually encode the body object as a reactive stream to be written to the HTTP request body. Removed raw types usage in DefaultHttpRequestBuilder. DefaultHttpRequestBuilder now uses a UriTemplateHandler to expand URI templates + variables into a concrete URI. Fixes spring-projects#80, fixes spring-projects#85, fixes spring-projects#86
This commit makes messageEncoders a required argument for building a client request - those are needed to actually encode the body object as a reactive stream to be written to the HTTP request body. Removed raw types usage in DefaultHttpRequestBuilder. DefaultHttpRequestBuilder now uses a UriTemplateHandler to expand URI templates + variables into a concrete URI. Fixes spring-projects#80, fixes spring-projects#85, fixes spring-projects#86
Clean version of old pull request #54
This should cover part of SPR-9164
[added BigDecimal support to SpEl numerics calculations.]
PS: I have signed and agree to the terms of the SpringSource Individual Contributor License Agreement.