(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 (if (<= z 3.322523053190084e-178) (- (fma (* 27.0 a) b (* 2.0 x)) (* 9.0 (* y (* z t)))) (fma a (* 27.0 b) (fma x 2.0 (* -9.0 (* t (* z y)))))))
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 tmp;
if (z <= 3.322523053190084e-178) {
tmp = fma((27.0 * a), b, (2.0 * x)) - (9.0 * (y * (z * t)));
} else {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (-9.0 * (t * (z * y)))));
}
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) tmp = 0.0 if (z <= 3.322523053190084e-178) tmp = Float64(fma(Float64(27.0 * a), b, Float64(2.0 * x)) - Float64(9.0 * Float64(y * Float64(z * t)))); else tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(-9.0 * Float64(t * Float64(z * y))))); 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_] := If[LessEqual[z, 3.322523053190084e-178], N[(N[(N[(27.0 * a), $MachinePrecision] * b + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;z \leq 3.322523053190084 \cdot 10^{-178}:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot a, b, 2 \cdot x\right) - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, -9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)\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 | 2.9 |
|---|---|
| Target | 3.4 |
| Herbie | 0.6 |
if z < 3.32252305319008375e-178Initial program 4.0
Simplified0.6
Taylor expanded in y around 0 0.6
Applied egg-rr0.6
if 3.32252305319008375e-178 < z Initial program 0.5
Taylor expanded in y around 0 0.5
Applied egg-rr0.6
Final simplification0.6
herbie shell --seed 2022133
(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)))