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


##########
arrow-cast/src/parse.rs:
##########
@@ -2780,6 +2827,55 @@ mod tests {
         }
     }
 
+    #[test]
+    fn test_parse_decimal_rounding() {
+        let test_rounding_for_e_notation_varying_scale = [
+            ("1.2345e4", "12345", 2),
+            ("12345e-5", "0.12", 2),
+            ("12345E-5", "0.123", 3),
+            ("12345e-5", "0.1235", 4),
+            ("1265E-4", ".127", 3),
+            ("12.345e3", "12345.000", 3),
+            ("1.2345e4", "12345", 0),
+            ("1.2345e3", "1235", 0),
+            ("1.23e-3", "0", 0),
+            ("123e-2", "1", 0),
+            ("-1e-15", "-0.0000000000", 10),
+            ("1e-15", "0.0000000000", 10),
+            ("1e15", "1000000000000000", 2),
+        ];

Review Comment:
   lets also add couple more  tests on negative
   
   ```
           // Edge cases
           assert_eq!(round_to_places(-2.5, 0), -3.0); // Negative half 
rounding up
           assert_eq!(round_to_places(-2.49, 0), -2.0); // Just below rounding 
negative
           // Whole numbers (should remain unchanged)
           assert_eq!(round_to_places(-100.0, 2), -100.0);
   ```



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