round filter: perform cast to i128 if precision is 0#899
Open
Raymi306 wants to merge 2 commits intoKeats:masterfrom
Open
round filter: perform cast to i128 if precision is 0#899Raymi306 wants to merge 2 commits intoKeats:masterfrom
Raymi306 wants to merge 2 commits intoKeats:masterfrom
Conversation
Keats
reviewed
Feb 12, 2024
|
|
||
| // Do we need to return an integer or a float? | ||
| if precision == 0 { | ||
| Ok(to_value(intermediate_result as i128).unwrap()) |
Owner
There was a problem hiding this comment.
isn't i128 in serde_json converted to a string?
Contributor
Author
|
I truthfully am not super familiar with serde_json, perhaps i need a better
test for this. I originally was using i64 but thought that i128 might
better handle some of the big numbers an f64 might represent.
…On Mon, Feb 12, 2024, 8:21 AM Vincent Prouillet ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/builtins/filters/number.rs
<#899 (comment)>:
> only common, ceil and floor are allowed",
- method
- ))),
+ method
+ )))
+ }
+ };
+
+ // Do we need to return an integer or a float?
+ if precision == 0 {
+ Ok(to_value(intermediate_result as i128).unwrap())
isn't i128 in serde_json converted to a string?
—
Reply to this email directly, view it on GitHub
<#899 (review)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKYK2OTOGOBEAALFCVQJZL3YTIJMHAVCNFSM6AAAAABDCMTXASVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNZVGIZDGMJXGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For issue #889
Perform an additional check on precision, and cast to an integer if it is 0.