(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma 27.0 (* a b) (* 2.0 x))))
(if (<= z 4.469489406442574e-111)
(fma (* y (* z t)) -9.0 t_1)
(fma (* t (* z y)) -9.0 t_1))))double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(27.0, (a * b), (2.0 * x));
double tmp;
if (z <= 4.469489406442574e-111) {
tmp = fma((y * (z * t)), -9.0, t_1);
} else {
tmp = fma((t * (z * y)), -9.0, t_1);
}
return tmp;
}
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function code(x, y, z, t, a, b) t_1 = fma(27.0, Float64(a * b), Float64(2.0 * x)) tmp = 0.0 if (z <= 4.469489406442574e-111) tmp = fma(Float64(y * Float64(z * t)), -9.0, t_1); else tmp = fma(Float64(t * Float64(z * y)), -9.0, t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 4.469489406442574e-111], N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * -9.0 + t$95$1), $MachinePrecision], N[(N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision] * -9.0 + t$95$1), $MachinePrecision]]]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\begin{array}{l}
t_1 := \mathsf{fma}\left(27, a \cdot b, 2 \cdot x\right)\\
\mathbf{if}\;z \leq 4.469489406442574 \cdot 10^{-111}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(z \cdot t\right), -9, t_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot \left(z \cdot y\right), -9, t_1\right)\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a




Bits error versus b
| Original | 3.2 |
|---|---|
| Target | 3.8 |
| Herbie | 0.5 |
if z < 4.46948940644257399e-111Initial program 4.0
Taylor expanded in a around 0 3.9
Taylor expanded in x around 0 0.6
Simplified3.8
Taylor expanded in t around 0 0.6
Simplified0.6
if 4.46948940644257399e-111 < z Initial program 0.5
Taylor expanded in a around 0 0.4
Taylor expanded in x around 0 10.8
Simplified0.4
Taylor expanded in t around 0 10.8
Simplified10.7
Applied egg-rr0.4
Final simplification0.5
herbie shell --seed 2022153
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b)))
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))