zeroshade commented on issue #35310:
URL: https://github.com/apache/arrow/issues/35310#issuecomment-1521930259

   @purplefox We do parse the decimal directly. The issue is that we need to 
convert the parsed value to an integer by multiplying by 10^(scale). ie: 
2112.33 -> 2112.33 * 10^2 ->  211233 (internal representation in decimal128). 
In addition, sometimes we *want* the rounding to occur based on the passed in 
precision/scale. If you parse a string value but set the precision low enough, 
it will round appropriately.
   
   Unless you mean writing the code to parse the string itself without using 
`big.ParseFloat`, and that's certainly an option but I wouldn't call it simpler 
as there are a lot of edge cases that would have to be covered which we get for 
free by using `big.ParseFloat` such as handling Infinity, and NaN etc. You can 
see an example in the C++ code which does implement the parsing itself since 
they didn't have something like the `math/big` library that already existed.
   
   


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