Re: [Boost-users] [proto] generation of adaptive precision floating-point geometric predicates

Here's where I'm stuck. In the case of the expression (a + b)*(c - d), the addition and subtraction should be replaced by the appropriate sequences before the multiplication gets expanded to yield the final sequence:
See if the following works for you. I try to replace a # b with
sum(#_approx(a,b), #_error(a,b)). The display_expr looked correct, but
I didn't check very carefully.
#include
{};
typedef proto::terminal<var>::type Var; int main() { Var a, b, c, d; proto::display_expr(grammar()( (a+b)*(c-d) )); }

Hi Manjunath,
See if the following works for you. I try to replace a # b with sum(#_approx(a,b), #_error(a,b)). The display_expr looked correct, but I didn't check very carefully.
Thanks much for your suggestion. However, I should have explained myself better in my first message. In the case of multiplication, I would like to expand the product according to the distributive law. For example: (a1 + a2 + ... + aN)*(b1 + b2 + ... + bM) Becomes: a1*b1 + ... + a1*bM + ... aN*b1 + ... + aN*bM I can see how to accomplish this with a recursive metafunction but I'm not sure how to express it using proto. Thanks, andrew
participants (2)
-
Andrew Durward
-
Manjunath Kudlur