Boost logo

Boost :

From: k.hagan_at_[hidden]
Date: 2001-02-12 09:05:38


On the subject of providing constants in float, double and long
double flavours...

1 x86 family processors have built-in constants for pi and several
  logarithms which are accurate to 66 bits. (This is 2-bits more
  than a register.) A compiler might provide

    #define PI __pi__

  where __pi__ tells the code generator to use a fldpi instruction
  rather than loading a value from memory. Does the desirability of
  this implementation option restrict our choice of syntax, or can
  compilers work equally happily with

    namespace math_constants {
      inline long double pi() { return __pi__; }
    }

2 The same processors also typically have no loss in performance
  if asked to evaluate expressions at full precision instead of a
  more reduced precision. If a compiler vendor used the same over-
  precise value for all three common floating point types, perhaps
  using the "__pi__" trick for all three, would this conform to our
  expectations?


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