Uh oh!
There was an error while loading. Please reload this page.
ARROW-12814: [C++][Gandiva] Implements ABS, FLOOR, PI, SQRT, SIGN, LSHIFT, RSHIFT, CEIL, TRUNC, LN and LOG2 functions - #10350
Conversation
There was a problem hiding this comment.
I am curious whether all platforms can convert 64-bit integer to long double without loss of digits. (i.e. size(long double) > size(int64)).
There was a problem hiding this comment.
@kiszk I checked that by the IEE-754 convention, the numbers in double precision should use at least 8 bytes to construct their representation, so I think that there would not have any digit loss in conversion.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Can we ensure that the same semantics (shift logical or shift arithmetic) on all platforms using just >>?
There was a problem hiding this comment.
@kiszk Thanks for your revision, I checked the C++ reference, and I noticed that the shift operators have undefined or implementation-choice behavior for signed and negative numbers.
So as in this Pull Request, we are implementing the Arithmetical Shift, we can cast the input parameters to their respective unsigned types and then apply the shift operators and they will have the same behavior in all platforms. Do you agree with the solution?
Uh oh!
There was an error while loading. Please reload this page.
kiszk
commented
May 19, 2021
#10274 handles abs operation well. |
70399da to
124a58dCompareI included the |
There was a problem hiding this comment.
Does it mean that we will accept the loss of digits in INT64?
There was a problem hiding this comment.
@kiszk Thanks for your revision! Please, could you explain how would occur digit loss here? I did not understand what you said.
There was a problem hiding this comment.
Sorry, I thought the previous version of abs is to cast int64 to double long. But, now, gdv_fn_abs_int64 handles as int64. Correct?
6b7a038 to
1b0747bCompare@kiszk I applied all suggestions you proposed, could you check if the corrections are fine? Thanks in advance for the review! |
198a993 to
aeea171Compareaeea171 to
5d186beCompare9d4f95c to
1ac8f04Compare1ac8f04 to
a1f2aadCompareanthonylouisbsb
commented
Jun 1, 2021
The |
a1f2aad to
098861cComparejpedroantunes
commented
Jun 3, 2021
The |
33e97d9 to
c242520CompareUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Why did you choose this threshold? On fabs documentation it uses 6 places for decimal part, shouldn't it be 0.000005 a better value for AlmostEquals threshold?
There was a problem hiding this comment.
I think choosing an adequate does not have a simple and unique answer like is shown in these articles:
- https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
- https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
I choose that number because it is the value defined in the float header as default threshold . For huge and small numbers, I think the developer should set the threshold manually when he is calling the method.
There was a problem hiding this comment.
I will change the method to use the FLT_EPSILON from the macro
9173083 to
848fe4eCompare848fe4e to
0a521efCompareanthonylouisbsb
commented
Sep 14, 2021
@kiszk I applied all suggestions you made in the PR. Could you take another look at the PR and see if it is ready to be merged? |
0a521ef to
7c74202CompareUh oh!
There was an error while loading. Please reload this page.
7c74202 to
a66a367Comparekiszk
commented
Oct 15, 2021
Sorry for late review. It looks good to me. I would like to ask another review. |
a66a367 to
b94b1a1Compareb94b1a1 to
cc0e9faCompareanthonylouisbsb
commented
Nov 23, 2021
kszucs
commented
Dec 6, 2021
ping @pitrou |
e6a1c05 to
cb9ce06Comparecb9ce06 to
59778bfCompareanthonylouisbsb
commented
Jan 10, 2022
@pitrou can you take a look at this PR? Because I want to close it as soon as possible |
anthonylouisbsb
commented
Jan 25, 2022
@pitrou can you take a look at it? |
pitrou
commented
Jan 25, 2022
I would rather if a Gandiva developer vetted this PR. @pravindra perhaps? |
There was a problem hiding this comment.
What should happen if there is overflow?
overflow is an in-out parameter.. for some of the later calls overflow could be false - will that cause an issue?
There was a problem hiding this comment.
@vvellanki I add a check for that case and it will throw an error if that situation occurs, check that commit: d25a630
59778bf to
879a346Compared25a630 to
9f450bfCompareamol-
commented
Mar 30, 2023
Closing because it has been untouched for a while, in case it's still relevant feel free to reopen and move it forward 👍 |
Implements the
ABS,FLOOR,PI,SQRT,SIGN,LSHIFT,RSHIFT,CEILandTRUNC.The RANDOM functions are already implemented in Gandiva.