Boost logo

Boost :

From: Ed Brey (edbrey_at_[hidden])
Date: 2001-10-29 12:40:48


From: "Paul A. Bristow" <boost_at_[hidden]>
> [Naming conventions for math constants, mostly clipped.]

I generally think that the approach and rationale is quite reasonable. I especially agree that canonical forms like x_div_y are overkill, since the set of names is by its nature quite limited.

> pi_sqr // pi * pi or ?
My preference would be squared over sqr, since squared is reasonably short and quite different from sqrt.

> gamma_third
It's not clear to me what number this is.

I question the need for some constants. As a general rule, I would say that any constant that the compiler can be reasonably expected to come up an exact value on its own should not be included, for example, half, third, and quarter. ("third" came out OK on my compiler, anyway.) OR is it expected that something like "half" will look better in code that .5 or 1/2.? minus_ln_ln_2 also seems like a good candidate for the compiler to do on its own. Even numeric_limits doesn't provide a minus_infinity.

Finally, why would one want sin_x or cos_x? These are just pi variants (or simple integers). I don't see any reason to go past primitives.

> five_div_6 // shorter than five_div_six
This brings up the question of how far into the set of rational numbers we should forray. This seems kind of deep. I'd prefer to not go there at all if we can trust the compiler to do a descent job on its own.


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