Live data from Hacker News

Fixed – Fixed-place decimal math library for Go

github.com

71–73 of 73 posts

Re: Fixed – Fixed-place decimal math library for Go

#71
post #59

As the author of Fixed, I'd like to make a few comments: 1. If you are above 100 billion, you are probably dropping the the 'fractions' and dealing with whole numbers. Most databases don't have their columns configured as Decimal(64,64) for 128 digits. It's not practical. So I would store the amounts above 100 billion in another value - the billions unit. And if you are 100s of billion, I am pretty certain you're not…

> if you are 100s of billion, I am pretty certain you're not concerned with .0000001 dollars

Be careful with that logic. Salami fraud takes advantage of low precision. You need to maintain enough precision to make it not worthwhile for your transaction volume.

Re: Fixed – Fixed-place decimal math library for Go

#72
post #50

Earlier quoted context omitted.

That's not how floating point works though. The precision is by definition floating. With a sufficiently large number, your least significant bit of precision might be in the 10s or 100s or more of dollars (or whatever currency). Your issue then is that if you combine a large enough number with anything, then you get precision loss and money just starts disappearing (or appearing out of nowhere). Even if your hyperin…

A double has 15 digits. Which counts more money than exists anywhere added up. Not a problem I'm thinking?

And ieee floating point still can't store 10¢ exactly.

Re: Fixed – Fixed-place decimal math library for Go

#73
post #50

Earlier quoted context omitted.

That's not how floating point works though. The precision is by definition floating. With a sufficiently large number, your least significant bit of precision might be in the 10s or 100s or more of dollars (or whatever currency). Your issue then is that if you combine a large enough number with anything, then you get precision loss and money just starts disappearing (or appearing out of nowhere). Even if your hyperin…

A double has 15 digits. Which counts more money than exists anywhere added up. Not a problem I'm thinking?

I dunno, South korea's M2 would need 17 or 18 digits to represent I think.

Edit: Japan too.

Say south korea has a few years of hyperinflation, not even anywhere close to zimbabwe bad, and you'd have money disappearing right & left.

Post reply on HN