Boost logo

Boost :

From: Paul A. Bristow (boost_at_[hidden])
Date: 2001-10-30 06:06:18


> -----Original Message-----
> From: Ed Brey [mailto:edbrey_at_[hidden]]

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

gamma(1/3) (gamma function - related to factorial(1/3)

> 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.)

In general, some of these will not be as close as possible,
so there is an accuracy gain. But only a few are common, 1/3, 2/3, 3/4,
1/10, 10 perhaps?

  OR is it expected that something
> like "half" will look better in code that .5 or 1/2.?

Yes I think it looks better. (But if you don't like it, don't use it!)
1/2 and 2 are exceptional in being exact in any sane FP representation.

> minus_ln_ln_2 also seems like a good candidate for the compiler
> to do on its own.

OK I just threw this in for good measure (Knuth Appendix A).
But if the constant IS negative, then its clearer to use it?

 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.

Because they may be more accurate and are clearer - but not too many.
>
> > 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.

OK, only an example of the naming convention.

Thanks

PaulDr Paul A Bristow, hetp Chromatography
Prizet Farmhouse
Kendal, Cumbria
LA8 8AB UK
+44 1539 561830
Mobile +44 7714 33 02 04
mailto:pbristow_at_[hidden]


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