From: Paul A. Bristow (boost_at_[hidden])
Date: 2001-10-24 11:12:56
This has been proposed before by the speed freaks,
BUT it was widely felt that
is was REALLY important to be able to write
double area = pi * r * r;
Without this, the constants would just not be widely used.
But as you show, current compilers favour functions,
so Michael Kenniston [Msk_at_[hidden]] can up with his cunning scheme
(sadly too cunning for at least one compiler?)
I could produce the functions you suggest, as I did before,
but using the generator program.
But I am reluctant to add further confusion.
Do you believe that the code is invalid C++?
(Or is the compiler wrong?)
PS I am right in concluding from these assembler examples
that the code generated is not bad, but that peoples mileage
And that comprehensive benchmarking is going to be difficult and
> -----Original Message-----
> From: Greg Colvin [mailto:gcolvin_at_[hidden]]
> Sent: Wednesday, October 24, 2001 12:14 AM
> To: boost_at_[hidden]
> Subject: Re: [boost] Math constants for naive and gurus? - which
> constants do you want?
> > Many thanks for your work on this. Looks promising, but may
> > be worth also producing the plain const double/float/long double files
> > as well for the time being at least?
> > Paul
> The plain const was actually less efficient for some platforms.
> The only problems I see with the template function approach is
> the extra typing:
> v = pi
> is certainly easier than
> v = constant<pi_tag,double>
> but it is not amenable to more precise implementations.
> How about a compromise:
> v = pi<double>()
> and so on for all the other constants? I think this can be
> made to work with even the most brain-dead compilers.
> Info: http://www.boost.org Unsubscribe:
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk