Autor Thema: SCALE_B doesn't work correctly  (Gelesen 4680 mal)

0 Mitglieder und 1 Gast betrachten dieses Thema.

Argus

  • Gast
SCALE_B doesn't work correctly
« am: 01. März 2012, 16:19:51 »
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