(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
(FPCore (x y z t) :precision binary64 (fma (/ y (+ x 1.0)) (pow (- t (/ x z)) -1.0) (/ (- x (/ x (- (* t z) x))) (+ 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) {
return fma((y / (x + 1.0)), pow((t - (x / z)), -1.0), ((x - (x / ((t * z) - x))) / (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) return fma(Float64(y / Float64(x + 1.0)), (Float64(t - Float64(x / z)) ^ -1.0), Float64(Float64(x - Float64(x / Float64(Float64(t * z) - x))) / 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_] := N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[Power[N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] + N[(N[(x - N[(x / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\mathsf{fma}\left(\frac{y}{x + 1}, {\left(t - \frac{x}{z}\right)}^{-1}, \frac{x - \frac{x}{t \cdot z - x}}{x + 1}\right)




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 7.2 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 7.2
Taylor expanded in y around 0 7.2
Simplified1.8
Applied egg-rr1.9
Taylor expanded in z around 0 0.1
Final simplification0.1
herbie shell --seed 2022134
(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)))