
Boost : 
Subject: Re: [boost] Looking for some "real world" extended precision integer arithmetic tests
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 20120126 12:45:04
> * The expression template do *sometimes* reduce the number of arithmetic ops
> taking place  by applying the rules of arithmetic they can sometime
> simplify the expressions.
That's a little alarming actually. If the integer is fixed length that means it may overflow and of course will also truncate in division since it is integer. Just like the compiler, we can't apply an optimization that changes the result the code may produce when overflow and truncation are considered as part of the normal behavior of the type. Sometimes arithmetic is written specifically with overflow and truncation in mind. Since any arithmetic operation may overflow this can really tie your hands. For numerical uses of fixed int we may assume that the programmer designed the code in such a way that overflow should never happen, but for behavioral simulation of hardware with fixed width integer units the correct overflow behavior is the whole point.
By the way, I'm really excited about the expression template frontend. I like the elimination of unneeded copies and cutting down on the number of temporaries. I also think it is really cool that you are able to do the arithmetic transformations on the expression template trees. Are you using proto?
Regards,
Luke
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk