(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ 1.0 y)))
(t_1 (/ (* (- 1.0 x) y) (+ 1.0 y)))
(t_2
(+
(/ 1.0 (+ 1.0 y))
(fma
-2.0
t_0
(fma
2.0
(* y (pow (+ 1.0 y) -2.0))
(fma 2.0 (pow t_0 2.0) (* x t_0)))))))
(if (<= t_1 0.98)
t_2
(if (<= t_1 1.0)
(-
(+ (/ 1.0 y) (+ x (/ x (pow y 2.0))))
(+ (/ x y) (cbrt (pow y -6.0))))
t_2))))double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
double code(double x, double y) {
double t_0 = y / (1.0 + y);
double t_1 = ((1.0 - x) * y) / (1.0 + y);
double t_2 = (1.0 / (1.0 + y)) + fma(-2.0, t_0, fma(2.0, (y * pow((1.0 + y), -2.0)), fma(2.0, pow(t_0, 2.0), (x * t_0))));
double tmp;
if (t_1 <= 0.98) {
tmp = t_2;
} else if (t_1 <= 1.0) {
tmp = ((1.0 / y) + (x + (x / pow(y, 2.0)))) - ((x / y) + cbrt(pow(y, -6.0)));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y) return Float64(1.0 - Float64(Float64(Float64(1.0 - x) * y) / Float64(y + 1.0))) end
function code(x, y) t_0 = Float64(y / Float64(1.0 + y)) t_1 = Float64(Float64(Float64(1.0 - x) * y) / Float64(1.0 + y)) t_2 = Float64(Float64(1.0 / Float64(1.0 + y)) + fma(-2.0, t_0, fma(2.0, Float64(y * (Float64(1.0 + y) ^ -2.0)), fma(2.0, (t_0 ^ 2.0), Float64(x * t_0))))) tmp = 0.0 if (t_1 <= 0.98) tmp = t_2; elseif (t_1 <= 1.0) tmp = Float64(Float64(Float64(1.0 / y) + Float64(x + Float64(x / (y ^ 2.0)))) - Float64(Float64(x / y) + cbrt((y ^ -6.0)))); else tmp = t_2; end return tmp end
code[x_, y_] := N[(1.0 - N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := Block[{t$95$0 = N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * t$95$0 + N[(2.0 * N[(y * N[Power[N[(1.0 + y), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[Power[t$95$0, 2.0], $MachinePrecision] + N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.98], t$95$2, If[LessEqual[t$95$1, 1.0], N[(N[(N[(1.0 / y), $MachinePrecision] + N[(x + N[(x / N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] + N[Power[N[Power[y, -6.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
t_0 := \frac{y}{1 + y}\\
t_1 := \frac{\left(1 - x\right) \cdot y}{1 + y}\\
t_2 := \frac{1}{1 + y} + \mathsf{fma}\left(-2, t_0, \mathsf{fma}\left(2, y \cdot {\left(1 + y\right)}^{-2}, \mathsf{fma}\left(2, {t_0}^{2}, x \cdot t_0\right)\right)\right)\\
\mathbf{if}\;t_1 \leq 0.98:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 1:\\
\;\;\;\;\left(\frac{1}{y} + \left(x + \frac{x}{{y}^{2}}\right)\right) - \left(\frac{x}{y} + \sqrt[3]{{y}^{-6}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}




Bits error versus x




Bits error versus y
| Original | 22.2 |
|---|---|
| Target | 0.2 |
| Herbie | 0.3 |
if (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) < 0.97999999999999998 or 1 < (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) Initial program 10.7
Simplified0.4
Applied egg-rr18.9
Taylor expanded in x around inf 13.7
Simplified11.3
Applied egg-rr0.3
if 0.97999999999999998 < (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) < 1Initial program 59.3
Simplified59.3
Taylor expanded in y around inf 0.3
Applied egg-rr0.3
Final simplification0.3
herbie shell --seed 2022156
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:herbie-target
(if (< y -3693.8482788297247) (- (/ 1.0 y) (- (/ x y) x)) (if (< y 6799310503.41891) (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))) (- (/ 1.0 y) (- (/ x y) x))))
(- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))