Rethinking Numeric

John Ralls jralls at ceridwen.us
Sun May 25 10:07:59 EDT 2014


On 25 May 2014, at 01:54, Christian Stimming (mobil) <christian at cstimming.de> wrote:

> Thanks for starting the discussion. 
> 
> If we've reached the point where our int64 rational numbers do not fit our problem requirements anymore, I'd rather look for a different number representation that fits our application domain better. I'm thinking about replacing rational numbers by decimal floating point numbers. That is, a number is represented by m * 10^e with the mantissa m and exponent e as signed integers. This is different from our normal *binary* floating point in that we use the exponent with base 10. However, all common rules for floating point can be applied just as normal. By the way, maybe there is even a standard comparable to IEEE 754 available? 
> 
> Just another possible way to proceed for solving this problem...

How exactly is this different from IEEE 754, other than one gets more bits by putting the mantissa in a separate int64_t? How is it not binary? Is there a reference implementation? Database support? Remember, one of the requirements is that the database fields need to be summable in queries, so any database we use for the backend has to support the numeric representation. The ones on offer in the popular SQL databases are 64-bit int, 64-bit IEEE 754, and in all but SQLite3, fixed-point.

Regards,
John Ralls








More information about the gnucash-devel mailing list