SCALE_B (75, 50, 100, -100, 200) should return 50, but actually it returns 450.
It needs to change the program code as I show below for fixing the problem:
IF I_HI = I_LO THEN
SCALE_B := O_LO;
ELSE
SCALE_B :=(O_HI - O_LO) / BYTE_TO_REAL(I_HI - I_LO) *( BYTE_TO_REAL(LIMIT(I_LO, X, I_HI) - I_LO)) + O_LO;
END_IF