Boost logo

Boost :

From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2001-04-25 12:18:21


Ed Brey wrote:
> Some users
> will want constant folding and some will want binary (i.e. hand-crafted)
> precision.

Having binary precision (i.e. some handcrafted hex value coerced
into a float) does not inhibit constant folding per se; the
implementor may have such optimization in its compiler. Besides,
constant-folding surely is an optimization thing and thus a
quality-of-implementation issue anyway.

Also, the user can emulate constant-folding by defining
additional variables any time, e.g.
  const double three_pi = 3*constants<double>::pi()
for those rare cases where it really matters speed-wise.

Contrary to integer constant folding, where some integer
multiplications can be replaced by clever shift and add
sequences, I don't believe that floating point compile-time
constants versus floating point variables with fixed content
provide significant advantage to the compiler.

Unless other arguments show up, I'm feeling rather strongly
about not having "tailored_constants<>". Keep it simple.

Jens Maurer


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