Fork me on GitHub
#clr
<
2024-07-21
>
dmiller20:07:36

The recent report of a little bug in the Quantize method of BigDecimal caused me to dig into the implementation details. When I recently ported the code from C# to F#, I didn't really think much about it. It was straightforward. (The bug was in the original C# code.) It took me longer than I care to share how long it took me to get my head back into the general principles of arbitrary decision decimal numbers. In order to speed things up for future me, I wrote up a few notes. Thanks to @mark.mendell for pointing out the bug. Though I do wonder what cause anyone would have to be using Ceiling mode on a BigDecimal. (Which is to say, using BigDecimal at all.) https://dmiller.github.io/clojure-clr-next/general/2024/07/21/whats-the-point.html

👍 5
1
Bediako George14:07:01

We are really appreciative of your help with this issue! To answer your question regarding the use of ceil with big decimals, we (Georgetown Software House) have written a lightweight spreadsheet engine (Pebble Stream), compatible with Excel, designed to run Excel functions in the cloud. Our customers are accountants and financial engineers that are very familiar with Excel, and are excited to not have to wait for their Excel models to get ported to C# or Java for scalability. Instead, they can run them directly on our cloud ready spreadsheet engine instead. They are also excited to have those models run with arbitrary precision. When you have to calculate sharing thousands of allocations amongst a multi-tiered structure of thousands of partners in Japanese Yen or Indian Rupees, and you can’t be off by a single yen or rupee, having 30 points of precision is very attractive, especially when tax rounding is involved. Think about summing the results of massive Pi Products where almost every multiplied value is less than 1. When running an entire set of spreadsheets in big decimal mode, every Excel function is required to receive and return big decimal numbers, and some of those functions, like Excel’s VDB function, internally require the use of ceil. This is why we are very appreciative of your work. Thank you for your quick response!

dmiller21:07:28

Thank you for the explanation. I'm excited to hear of your use of it.

1