From: Bruno Lalande (bruno.lalande_at_[hidden])
Date: 2008-02-15 04:49:20
> "These rules are chosen to be compatible with the behaviour of
> > ISO/IEC 9899:1999 Programming languages - C and with the Draft
> > Technical Report on C++ Library Extensions, 2005-06-24, section
> > 5.2.1, paragraph 5.
> > http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf
> > "
> Right the idea is to be compatible with what C99 and C++0x do when an
> integer argument is passed to a math function.
OK I have read this section of the draft and now I understand better the
purpose of promote_args, so I will use it in order to to be C99 and C++0x
> The other issue is that if:
> returned an integer, then presumably it can only return 0, which isn't
> exactly right :-)
Just to see if it was even possible, I've implemented what I had talked
about before. It takes this issue into account. Basically, here is the
output of my test program with the result of pow on several types and their
pow<2>(2) = (i)4
pow<2>(2.0) = (d)4
pow<2>(2.0f) = (f)4
pow<-2>(2) = (d)0.25
pow<-2>(2.0) = (d)0.25
pow<-2>(2.0f) = (d)0.25
And regarding the way in which I did it, I "guess" a use with
Boost.Unitswould give the expected result. Something like:
pow<3>((length)5) = (volume)125;
But the most important is to implement the promote_args version. I will
provide this soon. After that we can always propose, as Paul said, a special
version with a different name.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk