Conversation
| /** | ||
| * Creates an expression that truncates this numeric expression to an integer. | ||
| * | ||
| * @return A new {@link Expression} representing an integer result from the trunc operation. |
There was a problem hiding this comment.
I think these docs explain that trunc and truncToPrecision return different values:
trunc returns an expression that represents the integer result from the trunc operation.
truncToPrecision returns an expression representing the trunc operation.
Which of these is true? Do these mean the same thing?
I noticed that round and roundToPrecision has the same docs inconsistency issue.
There was a problem hiding this comment.
I would say both of them are true? trunc focuses on removing the value in the fractional part entirely, like for a float 3.9 the result is the "integer" 3.0, but equal to 3 (considered to be the same with the assertion libraries). truncToPrecision isn't returning a "whole number", like trunc(3.1415, 2) returns 3.14, considering as a trunc operation but result is not an integer. Just try to follow the doc from javascript and nodejs here. But I can change both of them to be returning the trunc operation.
There was a problem hiding this comment.
But yea "representing a integer" can be a bit misleading. I removed this part.
Adds support for the arithmetic pipeline expressions:
randandtrunc.ported from firebase/firebase-js-sdk#9498