From: Cromwell Enage (sponage_at_[hidden])
Date: 2005-03-23 23:25:31
--- Bruce Trask <Bruce.Trask_at_[hidden]> wrote:
> Hi Cromwell,
> Got your email from the boost archive list. I just
> posted a question regarding representing floats in a
> mpl type of way. Aleksey referred me to you and
> of the work you have done in this area.
Ah, good. Someone still remembers me :)
> I was planning on using float_<9900001, 5> with the
> first part being the mantissa and the second being
> the exponent.
Does it stand for 990000100000 or 990000.1? One of
the reasons I held off on tackling boost::mpl::fixed
is not knowing what representation is both doable in
MPL and most readable to the user.
> Have you had success representing floats and doubles
> using the boost techniques?
Success has been limited.
I'm currently representing compile-time floating-point
numbers in terms of fractions and mixed numbers. More
numbers can be represented in exact form this way.
For applications requiring moderate precision, my
implementations of boost::mpl::fraction and
boost::mpl::rational should suffice (though I'll have
to study the recent discussions on rational operations
to see if there's room for improvement).
For applications requiring extreme precision (e.g.
calculating PI at compile time), I've attempted to
boost::mpl::big_fraction, and boost::mpl::big_rational
as arbitrary-precision variants. It is here where I
run into trouble; using MinGW 3.4.2 on an "average
user"'s computer, I can barely compile a single divide
operation on big_integrals, and it usually takes a
half-hour to do so. I need to somehow make
big_integral more efficient before tackling
big_fraction and big_rational.
If you weren't able to obtain my work so far, it's
I'll have to update the documentation's look and feel
before moving it to the new File Vault, but feel free
to try it out and submit improvements.
> Thanks in advance.
> Bruce Trask
Cromwell D. Enage
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk