Boost logo

Boost :

Subject: Re: [boost] New numeric data type proposal
From: Damian Alberto Vicino (damian.vicino_at_[hidden])
Date: 2014-03-25 13:45:44


>> I didn’t see exact floating points in Boost.
>> Are they already implemented?
>> The idea is pretty similar, I even considered the option of removing Qn and using just 3 integer types for the representation, but using same strategy of only change Qd when needed by an operation.
>> If there is someone already working on that datatype I will like to join the effort.
>
> No they're not implemented - it's on the TODO list ;-)
>
> I actually don't *think* it would be that hard to implement, I just wondered what the pro's and cons of the different approaches were?
>
> Regards, John.

Do you have a place I can read about how the implementation of that one was intended?
I think the differences between the 2 should be in the implementation details and not in the interfaces.

The idea behind keeping the Qnum was to maximise the usable numbers in the mantissa.
In an scenario where the Q (num and denim) stabilises, the useful representable values of the mantissa is as large as possible.
While in the other approach, suppose that the Q should stabilise at 1500/1501 then, Qdenom is 1501, but 1500 is present multiplier of every mantissa.
This way you waste 1499 every 1500 numbers in the mantissa representation and probably need to increase the size of the mantissa (or not, depends on the use case).
In the other side, finding Qnum is not necessarily easy, it increases the quantity of computation needed to find the common factor between 2 operands and may increase the quantity of disagreements (1/3 and 2/3 are now not in agreement).

Regards, Damian


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk