Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2003-06-18 14:23:24


Gennaro Prota wrote:

>In fact it's not a matter of speed, but of precision. I'm sure there
>are compilers where the -sin(pi/2.) in the example code is faster than
>-sin(pi/two ). However an overload allows you to specify that the
>value of, say, arccos(-1) [math::acos(minus_one)] is exactly pi.

Also, using constructs like this is easier for the programmer. You don't
have to search to see if there is a pi/2 constant and find out what it is
called, you simply use:
   boost::pi / boost::two
or whatever. This also makes it easier to read, rather than
   arccos_minusone
and
   pi_2

What about 2/pi:
   2_pi // illegal
   _2_pi or two_pi // counter intuitive

Using overloads makes it easier to extend this set in a clean, consistent
way.

Regards,
Reece

_________________________________________________________________
Use MSN Messenger to send music and pics to your friends
http://www.msn.co.uk/messenger


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