Opened 14 years ago

Last modified 7 years ago

#1469 closed defect

Bugs related to division by zero — at Version 2

Reported by: Martin Sjölund Owned by: Martin Sjölund
Priority: high Milestone: Future
Component: Backend Version:
Keywords: Cc: Martin Sjölund, Patrick Täuber

Description (last modified by Per Östlund)

class A
  constant Real x = 0;
  Real r = x/x;
end A;

Gives
r = 0.0
Both wrong result, and no assertion added.

class A
  Real x = 0;
  Real r = x/x;
end A;

Gives
r = 1.0
No assertion is added.

Change History (2)

comment:1 by Martin Sjölund, 14 years ago

Note: 1.0 / 0.0 should become inf, 0.0 / 0.0 nan (if anything)

comment:2 by Per Östlund, 10 years ago

Cc: sjoelund.se, → sjoelund.se
Component: Backend
Description: modified (diff)

The first example now gives an error and fails in r25153, instead of giving an error and continuing. The second example still behaves the same. It could be fixed by removing the x/x = 1 rule in ExpressionSimplify, but I'm not sure what that will affect. Interesting to note is that Dymola says r = 1.0 in both cases though.

Note: See TracTickets for help on using tickets.