Boost logo

Boost :

From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2001-04-30 16:11:38


I don't think this has been suggested previously, but I am unclear
exactly how this works. Can you provide a fuller example please?

If performance is an issue (while compilers cannot yet handle in-lining it)
the user can always create a temporary const long? double pi
in his name scope and use that instead. This only involves
one extra assignment.

const long double pi = boost::math::pi;

But no extra cost when calculating lots of circumferences = pi * diameter;

If we provide enough constants (2 * pi, pi / 2 ...)
the likelihood of unfolding offering a serious gain will be reduced.

Thanks

Paul

> -----Original Message-----
> From: k.hagan_at_[hidden] [mailto:k.hagan_at_[hidden]]
> Sent: Friday, April 27, 2001 10:22 AM
> To: boost_at_[hidden]
> Subject: Re: [boost] Math Constants Library formal review results
>
>
> Paul wrote...
> > I fear you gurus are forgetting the confusion caused to novice
> > users by the requirement to write pi() rather than plain pi.
>
> That may be the case. I don't rate myself as a guru, but I can't
> see what all the fuss is about. If write pi() then it works and
> if I write pi then I get a syntax error. I can't think of an
> arithmetic context where a pointer to a function would quietly
> compile.
>
> > (The worse compiler even bombs if you forget the ()!)
>
> I treat compiler crashes as syntax errors. Usually they aren't,
> but the "fix" is the same -- change the code.
>
> > Are REALLY sure that just defining long doubles isn't simplest
> > and best? Casting down to double or float IS understood, even
> > by novices.
>
> Using just a long double constant might require an explicit cast
> to avoid provoking a compiler warning. I wouldn't want that. It
> also doesn't allow specialisation for other types, like interval
> or rational.
>
> I'm losing track of what has and hasn't been suggested. Have we
> considered specialising a class template with a static member?
>
> template<class T> class math
> {
> static T const pi;
> };
>
>
> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
>
>
> 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