Opened 15 years ago

Last modified 15 years ago

#1161 closed defect (fixed)

Weird integer arithmethics

Reported by: asodja Owned by: asodja
Priority: high Milestone:
Component: Instantiation Version: 1.5.0RC2
Keywords: Cc: asodja,

Description

It wrongly calculates the expressions like 3*(2^p) => 3, when p == 1' or 3*(2p) => 27, when p == 3'.

In all cases is p of type Integer. If it is declared as Real, the results of expression evaluations are correct.
Expression is also correctly evaluated when integer value is inserted instead of variable, e.g. `3*(23) => 24'.

The example class is attached and this error appears in omc shell, for example:

{{>>> p := 3

3

3*(2p)

27
}}

Attachments (1)

Arith.mo (183 bytes ) - added by asodja 15 years ago.

Download all attachments as: .zip

Change History (3)

by asodja, 15 years ago

Attachment: Arith.mo added

comment:1 by asodja, 15 years ago

The error seems to be a swap of base and exponent in some rule. Instead of {{p := 5; 3*(2p) => 96}} is calculated {{3*(p2) => 75}}.

comment:2 by Per Östlund, 15 years ago

This was a problem with one of the simplification rules, which has now been corrected.

Note: See TracTickets for help on using tickets.