(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t) x))
(t_2 (fma (/ y (+ x 1.0)) (/ z t_1) (/ (- x (/ x t_1)) (+ x 1.0))))
(t_3 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0)))
(t_4 (+ x (/ y t))))
(if (<= t_3 -0.0021035457814129388)
t_2
(if (<= t_3 2.881325035097028e-114)
(/ (- t_4 (/ x (* z t))) (+ x 1.0))
(if (<= t_3 INFINITY) t_2 (/ t_4 (+ x 1.0)))))))double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = fma((y / (x + 1.0)), (z / t_1), ((x - (x / t_1)) / (x + 1.0)));
double t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double t_4 = x + (y / t);
double tmp;
if (t_3 <= -0.0021035457814129388) {
tmp = t_2;
} else if (t_3 <= 2.881325035097028e-114) {
tmp = (t_4 - (x / (z * t))) / (x + 1.0);
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = t_4 / (x + 1.0);
}
return tmp;
}
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = fma(Float64(y / Float64(x + 1.0)), Float64(z / t_1), Float64(Float64(x - Float64(x / t_1)) / Float64(x + 1.0))) t_3 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0)) t_4 = Float64(x + Float64(y / t)) tmp = 0.0 if (t_3 <= -0.0021035457814129388) tmp = t_2; elseif (t_3 <= 2.881325035097028e-114) tmp = Float64(Float64(t_4 - Float64(x / Float64(z * t))) / Float64(x + 1.0)); elseif (t_3 <= Inf) tmp = t_2; else tmp = Float64(t_4 / Float64(x + 1.0)); end return tmp end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / t$95$1), $MachinePrecision] + N[(N[(x - N[(x / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -0.0021035457814129388], t$95$2, If[LessEqual[t$95$3, 2.881325035097028e-114], N[(N[(t$95$4 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$2, N[(t$95$4 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]]]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \mathsf{fma}\left(\frac{y}{x + 1}, \frac{z}{t_1}, \frac{x - \frac{x}{t_1}}{x + 1}\right)\\
t_3 := \frac{x + \frac{y \cdot z - x}{t_1}}{x + 1}\\
t_4 := x + \frac{y}{t}\\
\mathbf{if}\;t_3 \leq -0.0021035457814129388:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_3 \leq 2.881325035097028 \cdot 10^{-114}:\\
\;\;\;\;\frac{t_4 - \frac{x}{z \cdot t}}{x + 1}\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{t_4}{x + 1}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 7.5 |
|---|---|
| Target | 0.4 |
| Herbie | 0.2 |
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -0.0021035457814129388 or 2.88132503509702808e-114 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < +inf.0Initial program 5.1
Taylor expanded in y around 0 5.1
Simplified0.1
if -0.0021035457814129388 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 2.88132503509702808e-114Initial program 3.8
Taylor expanded in t around inf 0.4
Simplified0.4
if +inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 64.0
Applied egg-rr64.0
Taylor expanded in z around inf 0.0
Final simplification0.2
herbie shell --seed 2022133
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))