(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 (<= t 2.1378191698666908e-69) (+ (- (* x 2.0) (* (* t y) (* 9.0 z))) (* (* a 27.0) b)) (+ (- (* x 2.0) (* t (* z (* y 9.0)))) (* 27.0 (* a b)))))
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 (t <= 2.1378191698666908e-69) {
tmp = ((x * 2.0) - ((t * y) * (9.0 * z))) + ((a * 27.0) * b);
} else {
tmp = ((x * 2.0) - (t * (z * (y * 9.0)))) + (27.0 * (a * b));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (t <= 2.1378191698666908d-69) then
tmp = ((x * 2.0d0) - ((t * y) * (9.0d0 * z))) + ((a * 27.0d0) * b)
else
tmp = ((x * 2.0d0) - (t * (z * (y * 9.0d0)))) + (27.0d0 * (a * b))
end if
code = tmp
end function
public static 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);
}
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 2.1378191698666908e-69) {
tmp = ((x * 2.0) - ((t * y) * (9.0 * z))) + ((a * 27.0) * b);
} else {
tmp = ((x * 2.0) - (t * (z * (y * 9.0)))) + (27.0 * (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
def code(x, y, z, t, a, b): tmp = 0 if t <= 2.1378191698666908e-69: tmp = ((x * 2.0) - ((t * y) * (9.0 * z))) + ((a * 27.0) * b) else: tmp = ((x * 2.0) - (t * (z * (y * 9.0)))) + (27.0 * (a * b)) 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 (t <= 2.1378191698666908e-69) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(t * y) * Float64(9.0 * z))) + Float64(Float64(a * 27.0) * b)); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(z * Float64(y * 9.0)))) + Float64(27.0 * Float64(a * b))); end return tmp end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= 2.1378191698666908e-69) tmp = ((x * 2.0) - ((t * y) * (9.0 * z))) + ((a * 27.0) * b); else tmp = ((x * 2.0) - (t * (z * (y * 9.0)))) + (27.0 * (a * b)); end tmp_2 = 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[t, 2.1378191698666908e-69], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(t * y), $MachinePrecision] * N[(9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(27.0 * N[(a * b), $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}\;t \leq 2.1378191698666908 \cdot 10^{-69}:\\
\;\;\;\;\left(x \cdot 2 - \left(t \cdot y\right) \cdot \left(9 \cdot z\right)\right) + \left(a \cdot 27\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right) + 27 \cdot \left(a \cdot b\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
Results
| Original | 3.1 |
|---|---|
| Target | 3.6 |
| Herbie | 0.7 |
if t < 2.1378191698666908e-69Initial program 6.6
Applied egg-rr6.7
Applied egg-rr0.2
if 2.1378191698666908e-69 < t Initial program 1.1
Taylor expanded in a around 0 1.0
Final simplification0.7
herbie shell --seed 2022134
(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)))