Brian Aker wrote:
Hi!
On Feb 8, 2009, at 9:13 AM, Antony T Curtis wrote:
That was why I was surprised that an existing 'big integer' library
wasn't used when my_decimal first hit the tree.
There was at the time a big NIH going on around this.
Do you have a suggestion for a better one? I'd love to see someone go
through and replace this code and have us shift to sometime that makes
sense.
Well, there is the Falcon BigInt, but I guess that violates the
"innovation happens elsewhere" philosophy.
The Falcon BigInt is not quite complete. It has the big stuff --
including an arbitrary precision divide implemented by Chris Powers --
but is missing add and subtract. I'm doing those for Nimbus and will
give the code back to Falcon, so there wouldn't be any licensing
issues. It does have a nice serialization facility, though.
Falcon also has a class ScaledBinary to translate between the MySQL
bastard decimal format and BigInt.
So between the "here" of Falcon and the "elsewhere" of Nimbus, you
should have all the silliness bases covered.
But as I have mentioned before, dropping into arbitrary precision binary
to handle currency is really foolish. A 64 bit int can hold a lot of
dollars and cents and is a hell of a lot faster than arbitrary precision
binary. It does, however, require a mastery of 7th grade mathematics to
work out the conversions.
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp