What is the best way to constrain the conditions below.
Arrays x and y are sized dynamically and each value is rangebound. The sum of products of array x and y should be less than a certain value. X[i]Y[i] + X[i+1]Y[i+1] + … < Val
I know I can create another array Z which can hold the product such as Z[i]=X[i]Y[i} etc and then apply Z.sum to < Val.
However, is there a more efficient single line solution to SoP?
Oh I see. Yeah, without exposure to the wide range of usage, it is really difficult to realize the full potential of such expressions. I dont think any book explains this.
Thanks Dave.
There is no point in suggesting a solution when one does not understand what the implication of that is.
Casting int’() takes care of overflow cases in situations where variables of x, y are declared to be of insufficient width, as ‘sum’ can cause the result to be.