The equation y = atan2(u1,u2) computes y such
that tan(y) = u1/u2 and y is in the range -π
< y ≤ π. Usually u1, u2 is provided in
such a form that u1 = sin(y) and u2 = cos(y). If
one of the two input values (either u1 or u2) is
zero then the call of atan2 is still possible.
However, if both input values are zero then atan2 returns
an error. The present implementation yields y = 0 if both
input values are below Modelica.Constants.eps. Hence, the
problem with the Modelica Standard Library atan2-call can
be avoided.
function atan2 extends Modelica.Math.baseIcon2; input Real u1 = 1 "Value of first axis"; input Real u2 = 1 "Value of second axis"; output Modelica.SIunits.Angle y; end atan2;