kazuyukitanimura commented on code in PR #7179:
URL: https://github.com/apache/arrow-rs/pull/7179#discussion_r2021410740


##########
arrow-cast/src/parse.rs:
##########
@@ -850,7 +850,16 @@ fn parse_e_notation<T: DecimalType>(
     }
 
     if exp < 0 {
-        result = result.div_wrapping(base.pow_wrapping(-exp as _));
+        let result_with_scale = result.div_wrapping(base.pow_wrapping(-exp as 
_));
+        let result_with_one_scale_up =
+            result.div_wrapping(base.pow_wrapping(-exp.add_wrapping(1) as _));

Review Comment:
   I assume this logic is correct, but just for me to understand. E.g. for 
`12345e-5`, would `exp` be `-5`? why is this adding `1`?



##########
arrow-cast/src/parse.rs:
##########
@@ -986,6 +1009,13 @@ pub fn parse_decimal<T: DecimalType>(
                 "parse decimal overflow ({s})"
             )));
         }
+        if scale == 0 {
+            result = result.div_wrapping(base.pow_wrapping(fractionals as u32))
+        }
+        //add one if >=5
+        if rounding_digit >= 5 {

Review Comment:
   Wondering where `>= 5` came from?



-- 
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]

Reply via email to