(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))) (fma (/ y (+ x 1.0)) (/ z t_1) (/ (- x (/ x t_1)) (+ 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;
return fma((y / (x + 1.0)), (z / t_1), ((x - (x / t_1)) / (x + 1.0)));
}
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) return fma(Float64(y / Float64(x + 1.0)), Float64(z / t_1), Float64(Float64(x - Float64(x / t_1)) / Float64(x + 1.0))) 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]}, 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]]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\begin{array}{l}
t_1 := z \cdot t - x\\
\mathsf{fma}\left(\frac{y}{x + 1}, \frac{z}{t_1}, \frac{x - \frac{x}{t_1}}{x + 1}\right)
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 7.1 |
|---|---|
| Target | 0.4 |
| Herbie | 2.0 |
Initial program 7.1
Taylor expanded in y around 0 7.1
Simplified2.0
Final simplification2.0
herbie shell --seed 2022166
(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)))