Opened 10 years ago

Last modified 8 years ago

#3097 closed defect

Relational operators give inconsistent results — at Version 1

Reported by: raph85@… Owned by: somebody
Priority: high Milestone: Future
Component: *unknown* Version: trunk
Keywords: Cc:

Description (last modified by Lennart Ochel)

In the following model, relational operators give inconsistent results when the compared variable is set using an "if-expression":

model Test
  Real y;
  Boolean b1 = y < 100.0;
  Boolean b2 = y <= 100.0;
  Boolean b3 = y == 100.0;
  Boolean b4 = y >= 100.0;
  Boolean b5 = y > 100.0;
equation
  y = if time > 2 then 100 else 0;
end Test;

The results show that b1 b2 and b3 are all true at the same time, which is illogical.

Change History (1)

comment:1 by Lennart Ochel, 10 years ago

Description: modified (diff)

Please not, == on Real numbers is only allowed inside function.
If the type of the discrete variable y is changed to Integer, then everything works fine.

Note: See TracTickets for help on using tickets.