Let we have:
v1, v2 = signed integer values;
i1, i2 = unsigned integer relative importance (weights) of values;
What is the right way to combine those values into integral evaluation?
v = (v1+v2)/2 + (v2-v1)*(i2/i1) + (v1-v2)*(i1/i2);
Is it the right formula? Can it be transformed for speed up calculation on generic Intel platform?
Evaluation interpolation
Moderator: Ras
-
Aleks Peshkov
- Posts: 967
- Joined: Sun Nov 19, 2006 9:16 pm
- Location: Russia
- Full name: Aleks Peshkov
-
Piotr Cichy
- Posts: 75
- Joined: Sun Jul 30, 2006 11:13 pm
- Location: Kalisz, Poland
Re: Evaluation interpolation
I don't understand your formula.
For values:
v1=0
v2=100
i1=3
i2=1
We get v=-217 which is not inside the range v1...v2.
My proposal:
v=(v1*i1+v2*i2)/(i1+i2)
which gives v=25
For values:
v1=0
v2=100
i1=3
i2=1
We get v=-217 which is not inside the range v1...v2.
My proposal:
v=(v1*i1+v2*i2)/(i1+i2)
which gives v=25