|
Boost : |
From: Matthew Austern (austern_at_[hidden])
Date: 2001-05-17 12:31:35
"Paul A. Bristow" wrote:
>
> Matt Austern wrote
>
> > I'm not convinced that 1 and 0 belong in a numeric constants class; they
> > seem more like things that belong in a numeric type traits class, or maybe
> > even something that's still more general. There are plenty of types for
> > which you can reasonably ask for the additive or multiplicative identity
> > element, but where these transcendental constants make no sense.
> > (Integers,
> > NxN matrices, quaternions,... There's a sensible "zero" even for
> > strings.)
>
> Agree with what you say
>
> - but since math_constants in a separate namespace,
> is there any significant disadvantage
> to having them with other numeric constants?
> Completeness has some merit?
But we don't have completeness. We never can.
You've got sqrt(2), but not, if I'm remembering right,
sqrt(3) or sqrt(5). You've got pi and e, but not, if
I'm remembering right, Euler's constant (a.k.a. gamma).
You don't have the zeros of the Bessel functions. And
once you start including derived quantities, there's
no end to it: do you include pi/2, pi/3, 2*pi, 4*pi,
a/pi, pi^2...? How about e^2 (a.k.a. exp(2)), or ln(2),
or ln(10)? All of those are useful.
Please note: I'm not criticizing you for providing an
incomplete selection of constants. You have to draw
a line somewhere, and I don't know of any non-arbitrary
way to draw one.
--Matt
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk