\[x \cdot \log \left(\frac{x}{y}\right) - z
\]
↓
\[\begin{array}{l}
t_0 := \log \left(\sqrt[3]{x}\right)\\
\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(2 \cdot t_0 + \left(t_0 - \log y\right)\right) - z\\
\end{array}
\]
(FPCore (x y z) :precision binary64 (- (* x (log (/ x y))) z))
↓
(FPCore (x y z)
:precision binary64
(let* ((t_0 (log (cbrt x))))
(if (<= y -5e-310)
(- (* x (- (log (- x)) (log (- y)))) z)
(- (* x (+ (* 2.0 t_0) (- t_0 (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 t_0 = log(cbrt(x));
double tmp;
if (y <= -5e-310) {
tmp = (x * (log(-x) - log(-y))) - z;
} else {
tmp = (x * ((2.0 * t_0) + (t_0 - log(y)))) - z;
}
return tmp;
}
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 t_0 = Math.log(Math.cbrt(x));
double tmp;
if (y <= -5e-310) {
tmp = (x * (Math.log(-x) - Math.log(-y))) - z;
} else {
tmp = (x * ((2.0 * t_0) + (t_0 - 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)
t_0 = log(cbrt(x))
tmp = 0.0
if (y <= -5e-310)
tmp = Float64(Float64(x * Float64(log(Float64(-x)) - log(Float64(-y)))) - z);
else
tmp = Float64(Float64(x * Float64(Float64(2.0 * t_0) + Float64(t_0 - log(y)))) - z);
end
return tmp
end
code[x_, y_, z_] := N[(N[(x * N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
↓
code[x_, y_, z_] := Block[{t$95$0 = N[Log[N[Power[x, 1/3], $MachinePrecision]], $MachinePrecision]}, 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[(N[(2.0 * t$95$0), $MachinePrecision] + N[(t$95$0 - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]]
x \cdot \log \left(\frac{x}{y}\right) - z
↓
\begin{array}{l}
t_0 := \log \left(\sqrt[3]{x}\right)\\
\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(2 \cdot t_0 + \left(t_0 - \log y\right)\right) - z\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.5% |
|---|
| Cost | 32708 |
|---|
\[\begin{array}{l}
t_0 := \log \left(\sqrt{y}\right)\\
\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(\left(\log x - t_0\right) - t_0\right) - z\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 11.32% |
|---|
| Cost | 20425 |
|---|
\[\begin{array}{l}
t_0 := x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 10^{+308}\right):\\
\;\;\;\;x \cdot \log \left(y \cdot x\right) - z\\
\mathbf{else}:\\
\;\;\;\;t_0 - z\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 11.98% |
|---|
| 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 10^{+308}:\\
\;\;\;\;t_0 - z\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 13.35% |
|---|
| Cost | 13648 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+214}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\
\mathbf{elif}\;x \leq -2.8 \cdot 10^{-159}:\\
\;\;\;\;\left(-z\right) - x \cdot \log \left(\frac{y}{x}\right)\\
\mathbf{elif}\;x \leq 10^{-178}:\\
\;\;\;\;-z\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+136}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 6.99% |
|---|
| Cost | 13644 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{+213}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right)\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{-159}:\\
\;\;\;\;\left(-z\right) - x \cdot \log \left(\frac{y}{x}\right)\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-308}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 0.48% |
|---|
| 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 7 |
|---|
| Error | 33.09% |
|---|
| Cost | 7577 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{+70}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{+55}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{elif}\;z \leq -1.8 \cdot 10^{-32}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-132} \lor \neg \left(z \leq 2.25 \cdot 10^{-86}\right) \land z \leq 4 \cdot 10^{-33}:\\
\;\;\;\;x \cdot \left(-\log \left(\frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 33.41% |
|---|
| Cost | 7514 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+70}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq -6 \cdot 10^{+55} \lor \neg \left(z \leq -1.15 \cdot 10^{-36}\right) \land \left(z \leq 9 \cdot 10^{-132} \lor \neg \left(z \leq 1.02 \cdot 10^{-86}\right) \land z \leq 6.2 \cdot 10^{-38}\right):\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 47.98% |
|---|
| Cost | 128 |
|---|
\[-z
\]