Math FPCore C Julia Wolfram TeX \[\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \leq -4800000000:\\
\;\;\;\;\frac{x + -1}{y} - -1\\
\mathbf{elif}\;x \leq 10^{+16}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{x}{y}, x\right)}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - -1\\
\end{array}
\]
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))) ↓
(FPCore (x y)
:precision binary64
(if (<= x -4800000000.0)
(- (/ (+ x -1.0) y) -1.0)
(if (<= x 1e+16) (/ (fma x (/ x y) x) (+ x 1.0)) (- (/ x y) -1.0)))) double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
↓
double code(double x, double y) {
double tmp;
if (x <= -4800000000.0) {
tmp = ((x + -1.0) / y) - -1.0;
} else if (x <= 1e+16) {
tmp = fma(x, (x / y), x) / (x + 1.0);
} else {
tmp = (x / y) - -1.0;
}
return tmp;
}
function code(x, y)
return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
end
↓
function code(x, y)
tmp = 0.0
if (x <= -4800000000.0)
tmp = Float64(Float64(Float64(x + -1.0) / y) - -1.0);
elseif (x <= 1e+16)
tmp = Float64(fma(x, Float64(x / y), x) / Float64(x + 1.0));
else
tmp = Float64(Float64(x / y) - -1.0);
end
return tmp
end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_] := If[LessEqual[x, -4800000000.0], N[(N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision] - -1.0), $MachinePrecision], If[LessEqual[x, 1e+16], N[(N[(x * N[(x / y), $MachinePrecision] + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - -1.0), $MachinePrecision]]]
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
↓
\begin{array}{l}
\mathbf{if}\;x \leq -4800000000:\\
\;\;\;\;\frac{x + -1}{y} - -1\\
\mathbf{elif}\;x \leq 10^{+16}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{x}{y}, x\right)}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - -1\\
\end{array}
Alternatives Alternative 1 Error 0.1 Cost 968
\[\begin{array}{l}
\mathbf{if}\;x \leq -4800000000:\\
\;\;\;\;\frac{x + -1}{y} - -1\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+16}:\\
\;\;\;\;\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - -1\\
\end{array}
\]
Alternative 2 Error 20.1 Cost 852
\[\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-66}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{-118}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-7}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+65}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\]
Alternative 3 Error 11.6 Cost 848
\[\begin{array}{l}
t_0 := \frac{x}{y} - -1\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-66}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{-118}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 4.7 \cdot 10^{-14}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 4 Error 11.1 Cost 848
\[\begin{array}{l}
t_0 := \frac{x}{y} - -1\\
t_1 := \frac{x}{1 + x}\\
\mathbf{if}\;x \leq -76:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{-61}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{-118}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 3100000000000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 5 Error 11.1 Cost 848
\[\begin{array}{l}
t_0 := \frac{x}{y} - -1\\
t_1 := \frac{x}{1 + x}\\
\mathbf{if}\;x \leq -75:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -7.8 \cdot 10^{-59}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{-118}:\\
\;\;\;\;\frac{x \cdot x}{y}\\
\mathbf{elif}\;x \leq 3100000000000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 6 Error 11.0 Cost 848
\[\begin{array}{l}
t_0 := \frac{x}{1 + x}\\
\mathbf{if}\;x \leq -76:\\
\;\;\;\;\frac{x + -1}{y} - -1\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-65}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{-118}:\\
\;\;\;\;\frac{x \cdot x}{y}\\
\mathbf{elif}\;x \leq 3100000000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - -1\\
\end{array}
\]
Alternative 7 Error 19.4 Cost 588
\[\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-7}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+66}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\]
Alternative 8 Error 28.8 Cost 328
\[\begin{array}{l}
\mathbf{if}\;x \leq -450000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-7}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\]
Alternative 9 Error 53.9 Cost 64
\[1
\]