(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (* y y))) (t_1 (+ x t_0)))
(if (<= y -12134.734181339038)
(- (+ t_1 (/ (- 1.0 x) (pow y 3.0))) (+ (/ 1.0 (* y y)) (/ (+ x -1.0) y)))
(if (<= y 12997.544702284325)
(fma y (/ (+ x -1.0) (+ y 1.0)) 1.0)
(-
(+ t_1 (/ 1.0 (pow y 3.0)))
(/ (+ t_0 (+ (+ x -1.0) (/ 1.0 y))) y))))))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 = x / (y * y);
double t_1 = x + t_0;
double tmp;
if (y <= -12134.734181339038) {
tmp = (t_1 + ((1.0 - x) / pow(y, 3.0))) - ((1.0 / (y * y)) + ((x + -1.0) / y));
} else if (y <= 12997.544702284325) {
tmp = fma(y, ((x + -1.0) / (y + 1.0)), 1.0);
} else {
tmp = (t_1 + (1.0 / pow(y, 3.0))) - ((t_0 + ((x + -1.0) + (1.0 / y))) / y);
}
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(x / Float64(y * y)) t_1 = Float64(x + t_0) tmp = 0.0 if (y <= -12134.734181339038) tmp = Float64(Float64(t_1 + Float64(Float64(1.0 - x) / (y ^ 3.0))) - Float64(Float64(1.0 / Float64(y * y)) + Float64(Float64(x + -1.0) / y))); elseif (y <= 12997.544702284325) tmp = fma(y, Float64(Float64(x + -1.0) / Float64(y + 1.0)), 1.0); else tmp = Float64(Float64(t_1 + Float64(1.0 / (y ^ 3.0))) - Float64(Float64(t_0 + Float64(Float64(x + -1.0) + Float64(1.0 / y))) / y)); 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[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + t$95$0), $MachinePrecision]}, If[LessEqual[y, -12134.734181339038], N[(N[(t$95$1 + N[(N[(1.0 - x), $MachinePrecision] / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 12997.544702284325], N[(y * N[(N[(x + -1.0), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(t$95$1 + N[(1.0 / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(t$95$0 + N[(N[(x + -1.0), $MachinePrecision] + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
t_0 := \frac{x}{y \cdot y}\\
t_1 := x + t_0\\
\mathbf{if}\;y \leq -12134.734181339038:\\
\;\;\;\;\left(t_1 + \frac{1 - x}{{y}^{3}}\right) - \left(\frac{1}{y \cdot y} + \frac{x + -1}{y}\right)\\
\mathbf{elif}\;y \leq 12997.544702284325:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x + -1}{y + 1}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 + \frac{1}{{y}^{3}}\right) - \frac{t_0 + \left(\left(x + -1\right) + \frac{1}{y}\right)}{y}\\
\end{array}




Bits error versus x




Bits error versus y
| Original | 22.0 |
|---|---|
| Target | 0.3 |
| Herbie | 0.0 |
if y < -12134.73418133904Initial program 45.0
Simplified30.1
Taylor expanded in y around inf 0.0
Simplified0.0
Applied associate--r+_binary640.0
Simplified0.0
if -12134.73418133904 < y < 12997.544702284325Initial program 0.0
Simplified0.0
if 12997.544702284325 < y Initial program 44.6
Simplified28.1
Taylor expanded in y around inf 0.0
Simplified0.0
Applied div-inv_binary640.0
Applied *-un-lft-identity_binary640.0
Applied times-frac_binary640.0
Applied distribute-rgt-out_binary640.0
Applied cube-mult_binary640.0
Applied *-un-lft-identity_binary640.0
Applied times-frac_binary640.0
Applied distribute-lft-out_binary640.0
Applied cancel-sign-sub-inv_binary640.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2022131
(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))))