New ask Hacker News story: Ask HN: How to handle financial calculations precisely? - Gadgets180™

It is a technical blog/website and you will get here all the technical stuff and we also post some tech news.

Header Ads

Post Top Ad

Responsive Ads Here

New ask Hacker News story: Ask HN: How to handle financial calculations precisely?

Share This
Ask HN: How to handle financial calculations precisely?
2 by fedeb95 | 0 comments on Hacker News.
I am talking of a Java world, but this extends to any language I think. Basically the problem is the following: given a set of (positive) floating point numbers, which sum up to x, how do I rescale them in the range [0, 1] so that this new set, when multiplied with x, gives the original set, up to the second decimal place? The max x I expect to encounter is probably in the order of 10000000000, just to be sure. I've run a quick property based test, and the results are precise only if I use BigDecimal with a MathContext with precision of 8, rounding half up. Is there some mathematical proof of how much precision I need for this problem?

Don't forget to subscribe our youtube channel Click here:- http://www.youtube.com/c/techgk Product of the day

No comments:

Post a Comment

Post Bottom Ad

Responsive Ads Here

Pages