You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 18, 2019. It is now read-only.
let retVar = tempDecl(typeStr, &varDecls /*BUFD*/)
1852
-
let &preExp += '<%retVar%> = std::sqrt(<%argStr%>);<%\n%>'
1853
-
'<%retVar%>'
1850
+
(if isPositiveOrZero(e1) then
1851
+
let typeStr = expTypeShort(attr.ty )
1852
+
let retVar = tempDecl(typeStr, &varDecls /*BUFD*/)
1853
+
let &preExp += '<%retVar%> = std::sqrt(<%argStr%>);<%\n%>'
1854
+
1855
+
'<%retVar%>'
1856
+
else
1857
+
let tmp = tempDecl(expTypeFromExpModelica(e1), &varDecls)
1858
+
let cstr = ExpressionDumpTpl.dumpExp(e1,"\"")
1859
+
let &preExp +=
1860
+
<<
1861
+
<%tmp%> = <%argStr%>;
1862
+
<%assertCommonVar('<%tmp%> >= 0.0', '"Model error: Argument of sqrt(<%Util.escapeModelicaStringToCString(cstr)%>) should be >= 0"', context, &varDecls, dummyInfo)%>
1863
+
>>
1864
+
'sqrt(<%tmp%>)')
1854
1865
1855
1866
// built-in mathematical functions
1856
1867
case CALL(path=IDENT(name="sin"), expLst={e1})
@@ -2974,6 +2985,39 @@ template functionClosure(String funcName, String closureArgs, Type t, Type t_ori
//string error_msg = "The following assertion has been violated %sat time %f", initial() ? "during initialization " : "", data->localData[0]->timeValue);
0 commit comments