Boost logo

Boost :

From: Paul A. Bristow (boost_at_[hidden])
Date: 2001-10-30 07:52:55


> -----Original Message-----
> From: Stewart, Robert [mailto:stewart_at_[hidden]]
> Sent: Monday, October 29, 2001 5:54 PM
> To: 'boost_at_[hidden]'
> Subject: RE: [boost] Math constants - naming convention?
>
> I prefer all uppercase for constants. This helps them stand
> apart from most other code.

Many people use all caps for MACROS.
And there are lots of precedents for lower case.

> 1. Upper case.
> 2. Separate words with _.
>
> > half_pi // prefer _ rather than halfPi (even though I prefer this!)
> > quarter_pi // rather than pi_div_4 - looks nicer
> > third_pi //
> > two_thirds_pi // long but can't have 2/3_pi
> > // two_div_three_pi is nasty
> > // pi_2_3rd - I don't like much.
> > two_pi // cos can't have 2_pi
>
> There's is some prior art using things like pi_2_3rd in binders,
> but I think
> specifying fraction names is clearer, when it's in your native language.
> Specifically, if English weren't my native language, I would
> think pi_2 more readable than half_pi.

I think most people using C++ have enough English to understand the few
words
we are likely to use.

> PI_SQRT_2

I really don't like this at all - I think it is most confusing - you HAVE to
know the rules.
SQRT_2_pi is obvious.

> These suggest using a common root prefix, "ROOT" perhaps, followed by the
> number of the root: 3 for cube, 4 for fourth, etc. Note that there is no
> "_" between "ROOT" and the number, since the number indicates
> which kind of root rather than a multiplier.
>
This is rational but I feel over the top - we only need 2, 3 & 4 (if that).
PI_pow_4 perhaps instead?

> This could be turned into a functional arrangement:
> POW_2_3_2 but is that 2/3 ** 2 or 2 ** 3/2?

This is trying to be too clever?

> E_POW_PI_1_4 // combination of previous ideas
> Reverse the order since the important aspect is phi, not ln():
>
> PHI_LN

I disagree here - I think ln_phi is much more intutive.


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