Submitted by: Rainer
Severity: Major, pic16/18 family, mikroPascal 6.02 and older
Status: Solved (will be implemented in next release.)
Description:
Routines for floating point comparing (<, >, >=, <=, ==, !=) used in complex expressions such as
Code: Select all
var
__value : real;
res : byte;
...
res := (__value < 1.00001) or (__value > 10.00001);
...
Note: In this case, complex expression are considered to be expression in which there is more than one function call (either system (implicitly called by compiler) or other explicit function calls made by user). All floating point operators are implemented as system functions. Only floating point compare operators are affected by this bug, all other operators will work. So, do not use them in complex expressions such as above.
Workaround:
Brake complex expressions in a number of simple expressions which do not have more than one function call as described above. Also, compare result variables, if there are any, should be declared as volatile. Here is an example:
Code: Select all
__value : real;
res : byte; volatile;
...
res := __value < 1.00001;
res := res or (__value > 10.00001);
...