Opened 6 years ago

Last modified 12 months ago

#5529 closed discussion

Unsufficient precision when storing sine phases — at Version 1

Reported by: massimo ceraolo Owned by: Adeel Asghar
Priority: normal Milestone: 2.0.0
Component: OMEdit Version: v1.14.0-dev-nightly
Keywords: Cc:

Description (last modified by massimo ceraolo)

1) Load Modelica.Blocks.Sources.Sine or Modelica.Electrical.Sources.Sine
2) Click on the model icon and choose as phase 90 (they are degrees)
3) Click again on the icon: the phase is now 90.002.

This is because phases are stored in the model in radians as 6-digit strings corresponding to simple precision.

I think that more should be used. I understand that it is not optimal to use the full double-precision for all model numbers, since .mo readability would reduce. I would not like to see 1.00000000000001 just to say 1.
Probably a good compromise is to convert internal binary representation in decimal form using, say, 10-12 digits, and truncating final zeros, whenever present.

Change History (1)

comment:1 by massimo ceraolo, 6 years ago

Description: modified (diff)
Priority: highnormal
Type: defectdiscussion
Note: See TracTickets for help on using tickets.