Boost logo

Boost :

From: rwgk_at_[hidden]
Date: 2001-04-18 17:00:20


--- In boost_at_y..., "David Abrahams" <abrahams_at_m...> wrote:
> The formal review of Paul Bristow's math constants library begins
today and
> runs through Wed April 25th. Please have a look and post your
comments to
> this list.
>
> Regards,
>
> Dave Abrahams
> Review Manager

I have not been following the Math Constants thread in this forum.
Here is what came to my mind after browsing through the html
documentation:

- What are the reasons for including support for C in Boost?

- The heavy use of macros seems very unfortunate.
  Especially, something like BOOST_UNITY looks like pretty bad
  namespace pollution to me.

- Naively I was expecting something like:

  namespace boost {
    namespace math {
      namespace F {
        const float pi = 3.14159265358979323846264338327950288F;
        //...
      }
      namespace D {
        const double pi = 3.14159265358979323846264338327950288;
        //...
      }
      namespace L {
        const long double pi = 3.14159265358979323846264338327950288L;
        //...
      }
      template <typename T> // just for the idea, details might need
work
      pi(const T&) { return boost::math::L::pi; }
      //...
    }
  }

  Usage:

  int main(void)
  {
    using boost::math::F::pi;
    //... code that uses pi (more than once)
  }

  template <typename T>
  circumference(T radius)
  {
    return 2 * boost::math::pi(static_cast<T>(0)) * radius;
  }

- The header file math_constants.h seems to be generated by
  a the defineConstants.cpp program. Wouldn't it be possible to make
  the program also generate a real C++ header that does not contain
  any macros?

Ralf


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