
--- Dan McLeran <dan.mcleran@seagate.com> wrote:
I also do some static assertions and I was thinking of adding static functionality to add, multiply, divide, etc. at compile time. One could do this if one knew the lhs & rhs values at compile-time.
Have you checked out MPL? <http://www.boost.org/libs/mpl/doc/> If you haven't done so, check out the section on "Numeric Metafunctions".
I would love to figure out how to trick the compiler into evaluating a floating point, non-type argument but so far I haven't found it (a few ideas though :)
This makes me think about something like representing the float in unsigned format: sign, exponent, mantissa. You could figure out how to add and subtract, etc. the floats in this form and use meta-programming techniques to do some floating-point math with the compiler.
Peder Holt and I are doing some work in that area. Peder's work is in the "metamath" sections of the Sandbox CVS <http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/>; as soon as I fix a couple of bugs, I'll upload my work to the Vault <http://boost-consulting.com/vault/>. In the meantime, keep track of the "metadouble" threads and any discussions regarding MPL and numerics. Cromwell D. Enage __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com