Earlier quoted context omitted.
A domain name is not a programming language name, oh look this cool stuff I have done in ISOCPP. You can watch Rob Pike publicly correcting someone at the end of his "Go 2 Draft Specifications" session during Q&A. https://www.youtube.com/watch?v=RIvL2ONhFBI
Golang Golang Golang Golang ...and nothing bad happens. Maybe Bob should have thought of a better name instead of trying to become the least successful prescriptionist since that guy insisting it’s “thou”, not “you”.
Fixed – Fixed-place decimal math library for Go
61–70 of 73 posts
Re: Fixed – Fixed-place decimal math library for Go
#62As 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…
Any ideas on handling Ethereum gas, which is uint256?
Uint256 comes from the fact that it is native word size for EVM and that is because of crypto operations.
Re: Fixed – Fixed-place decimal math library for Go
#63As 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…
type Billions fixed.Fixed
and then add operators to allow Fixed to be added, String() would add a B at the end etc. So 0.1 is 100 million, etc.
Like I said, if you are summing into the billions, you are probably not concerned about .00001 pennies
Re: Fixed – Fixed-place decimal math library for Go
#64As 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…
Any ideas on handling Ethereum gas, which is uint256?
Re: Fixed – Fixed-place decimal math library for Go
#65Earlier quoted context omitted.
No, this lib is not suitable for financial computing. It might be good for game development.
The github page comes right out and says "[it] is ideally suited for high performance trading financial systems". Clearly, that's the intention behind the library. This would be essentially useless in game development (which is my field). In gamedev it's pretty much 32-bit floats all the way down, and very little else. Very small fixed point types are occasionally used in shaders (Cg provides a native 12-bit fixed po…
Re: Fixed – Fixed-place decimal math library for Go
#66Ada had proper fixed point types in 1983 already, and added additional requirements for the implementation of decimal fixed point types as part of the 1995 language revision. Other languages ... may benefit from its example.
Re: Fixed – Fixed-place decimal math library for Go
#67Earlier quoted context omitted.
No, this lib is not suitable for financial computing. It might be good for game development.
The github page comes right out and says "[it] is ideally suited for high performance trading financial systems". Clearly, that's the intention behind the library. This would be essentially useless in game development (which is my field). In gamedev it's pretty much 32-bit floats all the way down, and very little else. Very small fixed point types are occasionally used in shaders (Cg provides a native 12-bit fixed po…
Re: Fixed – Fixed-place decimal math library for Go
#68I'm not an expert but a finance library without a choice of rounding modes and using floating point for division and multiplication is a bit strange? Why those decisions?
It appears to be using this: https://engineering.shopspring.com/decimal-an-arbitrary-prec...
Re: Fixed – Fixed-place decimal math library for Go
#69Earlier quoted context omitted.
Six or seven digits of precision (like all floating point) is good enough, and far better than exactly 2 digits of decimal. Millions of times better. Fractions do little for interest rates, which are transcendental functions and sometimes even irrational.
If you are using floats in financial transactions you are doing it incredibly wrong. Never use floating points for that, ever. It is insanely problematic and bug prown.
Re: Fixed – Fixed-place decimal math library for Go
#70Earlier quoted context omitted.
Six or seven digits of precision (like all floating point) is good enough, and far better than exactly 2 digits of decimal. Millions of times better. Fractions do little for interest rates, which are transcendental functions and sometimes even irrational.
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…