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 -5 \cdot 10^{-310}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log x - \left(z + x \cdot \log y\right)\\
\end{array}
\]
(FPCore (x y z) :precision binary64 (- (* x (log (/ x y))) z)) ↓
(FPCore (x y z)
:precision binary64
(if (<= y -5e-310)
(- (* x (- (log (- x)) (log (- y)))) z)
(- (* x (log x)) (+ z (* x (log y)))))) 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 <= -5e-310) {
tmp = (x * (log(-x) - log(-y))) - z;
} else {
tmp = (x * log(x)) - (z + (x * log(y)));
}
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 <= (-5d-310)) then
tmp = (x * (log(-x) - log(-y))) - z
else
tmp = (x * log(x)) - (z + (x * log(y)))
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 <= -5e-310) {
tmp = (x * (Math.log(-x) - Math.log(-y))) - z;
} else {
tmp = (x * Math.log(x)) - (z + (x * Math.log(y)));
}
return tmp;
}
def code(x, y, z):
return (x * math.log((x / y))) - z
↓
def code(x, y, z):
tmp = 0
if y <= -5e-310:
tmp = (x * (math.log(-x) - math.log(-y))) - z
else:
tmp = (x * math.log(x)) - (z + (x * math.log(y)))
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 <= -5e-310)
tmp = Float64(Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))) - z);
else
tmp = Float64(Float64(x * log(x)) - Float64(z + Float64(x * log(y))));
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 <= -5e-310)
tmp = (x * (log(-x) - log(-y))) - z;
else
tmp = (x * log(x)) - (z + (x * log(y)));
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, -5e-310], N[(N[(x * N[(N[Log[(-x)], $MachinePrecision] - N[Log[(-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[(x * N[Log[x], $MachinePrecision]), $MachinePrecision] - N[(z + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
x \cdot \log \left(\frac{x}{y}\right) - z
↓
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-310}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log x - \left(z + x \cdot \log y\right)\\
\end{array}
Alternatives Alternative 1 Error 8.0 Cost 26760
\[\begin{array}{l}
t_0 := \log \left(\frac{x}{y}\right)\\
t_1 := x \cdot t_0\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;-z\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+267}:\\
\;\;\;\;\mathsf{fma}\left(t_0, x, -z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right)\\
\end{array}
\]
Alternative 2 Error 8.0 Cost 26696
\[\begin{array}{l}
t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;-z\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+267}:\\
\;\;\;\;t_0 - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right)\\
\end{array}
\]
Alternative 3 Error 8.1 Cost 20424
\[\begin{array}{l}
t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;-z\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+302}:\\
\;\;\;\;t_0 - z\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\]
Alternative 4 Error 6.5 Cost 13512
\[\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-68}:\\
\;\;\;\;\left(-z\right) - x \cdot \log \left(\frac{y}{x}\right)\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-306}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
\]
Alternative 5 Error 0.3 Cost 13508
\[\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-310}:\\
\;\;\;\;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}
\]
Alternative 6 Error 22.0 Cost 7313
\[\begin{array}{l}
\mathbf{if}\;z \leq -215000000000:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+18} \lor \neg \left(z \leq 4.8 \cdot 10^{+98}\right) \land z \leq 6 \cdot 10^{+133}:\\
\;\;\;\;x \cdot \left(-\log \left(\frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\]
Alternative 7 Error 21.2 Cost 6984
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+19}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\]
Alternative 8 Error 31.8 Cost 128
\[-z
\]
Alternative 9 Error 62.6 Cost 64
\[z
\]