Opened 12 years ago

Closed 12 years ago

#1825 closed defect (fixed)

Error filling array with A:B:C notation

Reported by: julian.wyszynski Owned by: Per Östlund
Priority: high Milestone: 1.9.0
Component: Frontend Version:
Keywords: Cc:

Description (last modified by Martin Sjölund)

The following model can't be simulated in OMShell:

model TestModel
  Real Variable1[25];
equation 
  Variable1 = -2.4:0.2:2.4;
end TestModel;

There are 25 values shown in the OMShell but only 24 are excepted.

Change History (5)

comment:1 by Per Östlund, 12 years ago

Owner: changed from somebody to Per Östlund
Status: newaccepted

comment:2 by Martin Sjölund, 12 years ago

Description: modified (diff)

comment:3 by Martin Sjölund, 12 years ago

This works better since doubles have rounding errors in them, but I guess Per will have a look and try to fix the initial problem (in this version you will also get 0.0 as an element, yours gave -0.00000000000000005551115123125783):

model TestModel
  Real Variable1[25];
equation 
  Variable1 = {0.1*i for i in -24:2:24};
end TestModel;

comment:4 by Martin Sjölund, 12 years ago

Component: BackendFrontend

comment:5 by Per Östlund, 12 years ago

Resolution: fixed
Status: acceptedclosed

Fixed in r13016, real ranges are now a bit more robust with regards to rounding errors.

Note: See TracTickets for help on using tickets.