matja said:i_a = (1/(y_1-y_2))*((i_1*(y_s-y_2))+(i_2*(y_1-y_s)));
i_1 = 200 and i_1 = 255
The result is still i_a = 871

matja said:Works fine for me :
y_1 = 100; i_1 = 200;
y_2 = 200; i_2 = 255;
y_s = 150;
i_a = (1/(y_1-y_2))*((i_1*(y_s-y_2))+(i_2*(y_1-y_s)));
i_a is 227.5 - half way between 200 and 255, as expected.
Are you using floats?