|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-06-13 06:39:02
Peder Holt <peder.holt_at_[hidden]> writes:
> On 6/12/05, David Abrahams <dave_at_[hidden]> wrote:
>> Peder Holt <peder.holt_at_[hidden]> writes:
>>
>> <snip>
>>
>> [Please try to limit the amount of quoted text in your postings]
>
> Ok :)
>
>> >>
>> >> double< 3,1415927 ,E<+6> >
>> >
>
> One more problem:
> It is not possible to write e.g. the number 3.00011 in the above notation:
> double_<3,00011>
> First of all, 00011 is interpreted as 9. Second, there is no way to
> distinguish this from:
> double_<3,9> (as I know of)
Right... I knew about that problem and somehow it disappeared for me
as I wrote out the example :(
> The alternatives would then be: double_<31415927,E<-7> > (which is
> basically the same as what Andy does in his physical quantities
> library)
> DOUBLE(3,00011,E<0>) where 1 is temporarily prepended to 0001 to
> preserve the preceding zeros.
That's not a bad concept, although "the andy method" also looks pretty
nice to me, and avoids the macro.
>> > I discovered that using base 2 exponent in stead of base 10 exponent
>>
>> I don't understand what you mean her. Where is this exponent used?
>> Does the user specify the exponent in base 2 (probably not)? YOu must
>> mean in the representation?
>
> I mean the representation.
Ah, well that's what the machine's FPU does too.
> I just need to find the correct
> transformation between the E<N> notation and the 2^M notation.
Yup. I'm sure you can find well-researched information about that
somewhere.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk