Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[x \cdot \log \left(\frac{x}{y}\right) - z
\]
↓
\[\begin{array}{l}
\mathbf{if}\;y \leq 0:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
\]
(FPCore (x y z) :precision binary64 (- (* x (log (/ x y))) z)) ↓
(FPCore (x y z)
:precision binary64
(if (<= y 0.0)
(- (* x (- (log (- x)) (log (- y)))) z)
(- (* x (- (log x) (log y))) z))) double code(double x, double y, double z) {
return (x * log((x / y))) - z;
}
↓
double code(double x, double y, double z) {
double tmp;
if (y <= 0.0) {
tmp = (x * (log(-x) - log(-y))) - z;
} else {
tmp = (x * (log(x) - log(y))) - z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * log((x / y))) - z
end function
↓
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 0.0d0) then
tmp = (x * (log(-x) - log(-y))) - z
else
tmp = (x * (log(x) - log(y))) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
return (x * Math.log((x / y))) - z;
}
↓
public static double code(double x, double y, double z) {
double tmp;
if (y <= 0.0) {
tmp = (x * (Math.log(-x) - Math.log(-y))) - z;
} else {
tmp = (x * (Math.log(x) - Math.log(y))) - z;
}
return tmp;
}
def code(x, y, z):
return (x * math.log((x / y))) - z
↓
def code(x, y, z):
tmp = 0
if y <= 0.0:
tmp = (x * (math.log(-x) - math.log(-y))) - z
else:
tmp = (x * (math.log(x) - math.log(y))) - z
return tmp
function code(x, y, z)
return Float64(Float64(x * log(Float64(x / y))) - z)
end
↓
function code(x, y, z)
tmp = 0.0
if (y <= 0.0)
tmp = Float64(Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))) - z);
else
tmp = Float64(Float64(x * Float64(log(x) - log(y))) - z);
end
return tmp
end
function tmp = code(x, y, z)
tmp = (x * log((x / y))) - z;
end
↓
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= 0.0)
tmp = (x * (log(-x) - log(-y))) - z;
else
tmp = (x * (log(x) - log(y))) - z;
end
tmp_2 = tmp;
end
code[x_, y_, z_] := N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
↓
code[x_, y_, z_] := If[LessEqual[y, 0.0], N[(N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(x * N[(N[Log[x], $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
x \cdot \log \left(\frac{x}{y}\right) - z
↓
\begin{array}{l}
\mathbf{if}\;y \leq 0:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}