Last active
December 24, 2015 07:29
-
-
Save thorade/6763767 to your computer and use it in GitHub Desktop.
Modelica function that checks whether the (Real) input may be treated as an integer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isInteger | |
"returns true if input u is an Integer, else false" | |
input Real u; | |
output Boolean y; | |
algorithm | |
y := if abs(u-integer(u))<Modelica.Constants.small then true else false; | |
end isInteger; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment