huberylee commented on code in PR #35997:
URL: https://github.com/apache/arrow/pull/35997#discussion_r1377721356
##########
cpp/src/arrow/util/decimal_test.cc:
##########
@@ -868,24 +867,29 @@ template <typename T>
class TestDecimalFromRealFloat : public ::testing::Test {
protected:
std::vector<FromFloatTestParam> GetValues() {
- return {// 2**63 + 2**40 (exactly representable in a float's 24 bits of
precision)
- FromFloatTestParam{9.223373e+18f, 19, 0, "9223373136366403584"},
- FromFloatTestParam{-9.223373e+18f, 19, 0, "-9223373136366403584"},
- FromFloatTestParam{9.223373e+14f, 19, 4, "922337313636640.3584"},
- FromFloatTestParam{-9.223373e+14f, 19, 4, "-922337313636640.3584"},
- // 2**64 - 2**40 (exactly representable in a float)
- FromFloatTestParam{1.8446743e+19f, 20, 0, "18446742974197923840"},
- FromFloatTestParam{-1.8446743e+19f, 20, 0,
"-18446742974197923840"},
- // 2**64 + 2**41 (exactly representable in a float)
- FromFloatTestParam{1.8446746e+19f, 20, 0, "18446746272732807168"},
- FromFloatTestParam{-1.8446746e+19f, 20, 0,
"-18446746272732807168"},
- FromFloatTestParam{1.8446746e+15f, 20, 4, "1844674627273280.7168"},
- FromFloatTestParam{-1.8446746e+15f, 20, 4,
"-1844674627273280.7168"},
- // Almost 10**38 (minus 2**103)
- FromFloatTestParam{9.999999e+37f, 38, 0,
- "99999986661652122824821048795547566080"},
- FromFloatTestParam{-9.999999e+37f, 38, 0,
- "-99999986661652122824821048795547566080"}};
+ return {
+ // -- Stress the 24 bits of precision of a float
+ // 2**63 + 2**40
+ FromFloatTestParam{9.223373e+18f, 19, 0, "9223373136366403584"},
Review Comment:
> What do you call "the original value" in that context? Both values are
actually equal in `float32`:
>
> ```python
> >>> np.float32(5.76460752e13) == np.float32(57646073774080)
> True
> ```
I see what you mean. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]