(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (sqrt (* a (* x t))))
(t_2 (* x (- (* y z) (* t a))))
(t_3 (* j (- (* t c) (* y i))))
(t_4 (+ (- t_2 (* b (- (* z c) (* a i)))) t_3))
(t_5 (- (* c (* z b)) (* i (* a b)))))
(if (<= t_4 (- INFINITY))
(+ t_3 (- (- (* y (* x z)) (* t_1 t_1)) t_5))
(if (<= t_4 5.397426652011775e+307)
t_4
(+ (- t_2 t_5) (- (* c (* t j)) (* i (* y j))))))))double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
}
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = sqrt((a * (x * t)));
double t_2 = x * ((y * z) - (t * a));
double t_3 = j * ((t * c) - (y * i));
double t_4 = (t_2 - (b * ((z * c) - (a * i)))) + t_3;
double t_5 = (c * (z * b)) - (i * (a * b));
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = t_3 + (((y * (x * z)) - (t_1 * t_1)) - t_5);
} else if (t_4 <= 5.397426652011775e+307) {
tmp = t_4;
} else {
tmp = (t_2 - t_5) + ((c * (t * j)) - (i * (y * j)));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)));
}
public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = Math.sqrt((a * (x * t)));
double t_2 = x * ((y * z) - (t * a));
double t_3 = j * ((t * c) - (y * i));
double t_4 = (t_2 - (b * ((z * c) - (a * i)))) + t_3;
double t_5 = (c * (z * b)) - (i * (a * b));
double tmp;
if (t_4 <= -Double.POSITIVE_INFINITY) {
tmp = t_3 + (((y * (x * z)) - (t_1 * t_1)) - t_5);
} else if (t_4 <= 5.397426652011775e+307) {
tmp = t_4;
} else {
tmp = (t_2 - t_5) + ((c * (t * j)) - (i * (y * j)));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i, j): return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y)))
def code(x, y, z, t, a, b, c, i, j): t_1 = math.sqrt((a * (x * t))) t_2 = x * ((y * z) - (t * a)) t_3 = j * ((t * c) - (y * i)) t_4 = (t_2 - (b * ((z * c) - (a * i)))) + t_3 t_5 = (c * (z * b)) - (i * (a * b)) tmp = 0 if t_4 <= -math.inf: tmp = t_3 + (((y * (x * z)) - (t_1 * t_1)) - t_5) elif t_4 <= 5.397426652011775e+307: tmp = t_4 else: tmp = (t_2 - t_5) + ((c * (t * j)) - (i * (y * j))) return tmp
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))) end
function code(x, y, z, t, a, b, c, i, j) t_1 = sqrt(Float64(a * Float64(x * t))) t_2 = Float64(x * Float64(Float64(y * z) - Float64(t * a))) t_3 = Float64(j * Float64(Float64(t * c) - Float64(y * i))) t_4 = Float64(Float64(t_2 - Float64(b * Float64(Float64(z * c) - Float64(a * i)))) + t_3) t_5 = Float64(Float64(c * Float64(z * b)) - Float64(i * Float64(a * b))) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = Float64(t_3 + Float64(Float64(Float64(y * Float64(x * z)) - Float64(t_1 * t_1)) - t_5)); elseif (t_4 <= 5.397426652011775e+307) tmp = t_4; else tmp = Float64(Float64(t_2 - t_5) + Float64(Float64(c * Float64(t * j)) - Float64(i * Float64(y * j)))); end return tmp end
function tmp = code(x, y, z, t, a, b, c, i, j) tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (i * a)))) + (j * ((c * t) - (i * y))); end
function tmp_2 = code(x, y, z, t, a, b, c, i, j) t_1 = sqrt((a * (x * t))); t_2 = x * ((y * z) - (t * a)); t_3 = j * ((t * c) - (y * i)); t_4 = (t_2 - (b * ((z * c) - (a * i)))) + t_3; t_5 = (c * (z * b)) - (i * (a * b)); tmp = 0.0; if (t_4 <= -Inf) tmp = t_3 + (((y * (x * z)) - (t_1 * t_1)) - t_5); elseif (t_4 <= 5.397426652011775e+307) tmp = t_4; else tmp = (t_2 - t_5) + ((c * (t * j)) - (i * (y * j))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[Sqrt[N[(a * N[(x * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(j * N[(N[(t * c), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$2 - N[(b * N[(N[(z * c), $MachinePrecision] - N[(a * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(N[(c * N[(z * b), $MachinePrecision]), $MachinePrecision] - N[(i * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(t$95$3 + N[(N[(N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] - t$95$5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 5.397426652011775e+307], t$95$4, N[(N[(t$95$2 - t$95$5), $MachinePrecision] + N[(N[(c * N[(t * j), $MachinePrecision]), $MachinePrecision] - N[(i * N[(y * j), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\begin{array}{l}
t_1 := \sqrt{a \cdot \left(x \cdot t\right)}\\
t_2 := x \cdot \left(y \cdot z - t \cdot a\right)\\
t_3 := j \cdot \left(t \cdot c - y \cdot i\right)\\
t_4 := \left(t_2 - b \cdot \left(z \cdot c - a \cdot i\right)\right) + t_3\\
t_5 := c \cdot \left(z \cdot b\right) - i \cdot \left(a \cdot b\right)\\
\mathbf{if}\;t_4 \leq -\infty:\\
\;\;\;\;t_3 + \left(\left(y \cdot \left(x \cdot z\right) - t_1 \cdot t_1\right) - t_5\right)\\
\mathbf{elif}\;t_4 \leq 5.397426652011775 \cdot 10^{+307}:\\
\;\;\;\;t_4\\
\mathbf{else}:\\
\;\;\;\;\left(t_2 - t_5\right) + \left(c \cdot \left(t \cdot j\right) - i \cdot \left(y \cdot j\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




Bits error versus c




Bits error versus i




Bits error versus j
Results
| Original | 12.2 |
|---|---|
| Target | 16.1 |
| Herbie | 6.2 |
if (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) < -inf.0Initial program 64.0
Taylor expanded in c around 0 44.2
Taylor expanded in y around 0 27.7
Applied add-sqr-sqrt_binary6435.4
if -inf.0 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) < 5.3974266520117751e307Initial program 0.9
Applied cancel-sign-sub-inv_binary640.9
if 5.3974266520117751e307 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) Initial program 63.4
Taylor expanded in c around 0 45.7
Taylor expanded in c around 0 26.1
Final simplification6.2
herbie shell --seed 2022130
(FPCore (x y z t a b c i j)
:name "Linear.Matrix:det33 from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< t -8.120978919195912e-33) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t -4.712553818218485e-169) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2.0) (pow (* i y) 2.0))) (+ (* c t) (* i y)))) (if (< t -7.633533346031584e-308) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t 1.0535888557455487e-139) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2.0) (pow (* i y) 2.0))) (+ (* c t) (* i y)))) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j)))))))
(+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))