Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modelica.Math.Vectors.normalize contains smooth(0,noEvent(...)) #1759

Closed
modelica-trac-importer opened this issue Jan 15, 2017 · 7 comments
Closed
Assignees
Labels
bug Critical/severe issue L: Math Issue addresses Modelica.Math
Milestone

Comments

@modelica-trac-importer
Copy link

Reported by stefanv on 11 Aug 2015 19:10 UTC
To the best of my knowledge, smooth and noEvent have no meaning inside functions.


Migrated-From: https://trac.modelica.org/Modelica/ticket/1759

@modelica-trac-importer modelica-trac-importer added bug Critical/severe issue L: Math Issue addresses Modelica.Math labels Jan 15, 2017
@modelica-trac-importer
Copy link
Author

Modified by beutlich on 18 Aug 2015 12:25 UTC

@modelica-trac-importer
Copy link
Author

Comment by otter on 28 Sep 2015 07:16 UTC
Replying to [ticket:1759 stefanv]:

To the best of my knowledge, smooth and noEvent have no meaning inside functions.

Fixed in cf31373:
Added the following comment in the code (trunk):

 This function has the inline annotation. If the function is inlined:
     - "smooth(..)" defines how often the expression can be differentiated
       (if symbolic processing is performed). 
     - "noEvent(..)" prevents event handling of the if-clause,
       in order to guard against division by zero.

@modelica-trac-importer
Copy link
Author

Modified by otter on 28 Sep 2015 07:17 UTC

@modelica-trac-importer
Copy link
Author

Comment by stefanv on 28 Sep 2015 13:48 UTC
But this means that the semantics of a function are different depending on whether or not it is successfully inlined. That should not be the case, and a tool that inlines a function should automatically add smooth and noEvent where needed.

@modelica-trac-importer
Copy link
Author

Comment by sjoelund.se on 28 Sep 2015 20:46 UTC
Replying to [comment:4 stefanv]:

But this means that the semantics of a function are different depending on whether or not it is successfully inlined. That should not be the case, and a tool that inlines a function should automatically add smooth and noEvent where needed.

Functions generate events when GenerateEvents=true. But it is not set here.

@modelica-trac-importer
Copy link
Author

Comment by otter on 13 Dec 2015 06:54 UTC
Fixed in 207cb79 by
removed noEvent (had no effect since inlining a function adds automatically noEvent).

Replying to [comment:4 stefanv]:

But this means that the semantics of a function are different depending on whether or not it is successfully inlined. That should not be the case, and a tool that inlines a function should automatically add smooth and noEvent where needed.

A tool cannot automatically add "smooth" because in general it cannot figure out how "smooth" an if-expression is.

If the function is not inlined, "smooth(..)" has no effect. If it is inlined, it gives additional information to the Modelica tool. The tool may or may not use this information (smooth(..) is defined in this way).

@modelica-trac-importer
Copy link
Author

Changelog modified by otter on 13 Dec 2015 06:54 UTC
Math.Vectors.normalize: Removed unnecessary noEvent(..)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Critical/severe issue L: Math Issue addresses Modelica.Math
Projects
None yet
Development

No branches or pull requests

2 participants