(FPCore (a1 a2 b1 b2) :precision binary64 (/ (* a1 a2) (* b1 b2)))
(FPCore (a1 a2 b1 b2)
:precision binary64
(let* ((t_0 (/ (* a1 a2) (* b1 b2))) (t_1 (* (/ a1 b1) (/ a2 b2))))
(if (<= t_0 (- INFINITY))
t_1
(if (<= t_0 -1.117539720539455e-304)
t_0
(if (<= t_0 0.0)
(* (/ a1 (* (cbrt b1) (cbrt b1))) (/ (/ a2 (cbrt b1)) b2))
(if (<= t_0 9.809131235010281e+288) t_0 t_1))))))double code(double a1, double a2, double b1, double b2) {
return (a1 * a2) / (b1 * b2);
}
double code(double a1, double a2, double b1, double b2) {
double t_0 = (a1 * a2) / (b1 * b2);
double t_1 = (a1 / b1) * (a2 / b2);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= -1.117539720539455e-304) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (a1 / (cbrt(b1) * cbrt(b1))) * ((a2 / cbrt(b1)) / b2);
} else if (t_0 <= 9.809131235010281e+288) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double a1, double a2, double b1, double b2) {
return (a1 * a2) / (b1 * b2);
}
public static double code(double a1, double a2, double b1, double b2) {
double t_0 = (a1 * a2) / (b1 * b2);
double t_1 = (a1 / b1) * (a2 / b2);
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_0 <= -1.117539720539455e-304) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (a1 / (Math.cbrt(b1) * Math.cbrt(b1))) * ((a2 / Math.cbrt(b1)) / b2);
} else if (t_0 <= 9.809131235010281e+288) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(a1, a2, b1, b2) return Float64(Float64(a1 * a2) / Float64(b1 * b2)) end
function code(a1, a2, b1, b2) t_0 = Float64(Float64(a1 * a2) / Float64(b1 * b2)) t_1 = Float64(Float64(a1 / b1) * Float64(a2 / b2)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = t_1; elseif (t_0 <= -1.117539720539455e-304) tmp = t_0; elseif (t_0 <= 0.0) tmp = Float64(Float64(a1 / Float64(cbrt(b1) * cbrt(b1))) * Float64(Float64(a2 / cbrt(b1)) / b2)); elseif (t_0 <= 9.809131235010281e+288) tmp = t_0; else tmp = t_1; end return tmp end
code[a1_, a2_, b1_, b2_] := N[(N[(a1 * a2), $MachinePrecision] / N[(b1 * b2), $MachinePrecision]), $MachinePrecision]
code[a1_, a2_, b1_, b2_] := Block[{t$95$0 = N[(N[(a1 * a2), $MachinePrecision] / N[(b1 * b2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(a1 / b1), $MachinePrecision] * N[(a2 / b2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, -1.117539720539455e-304], t$95$0, If[LessEqual[t$95$0, 0.0], N[(N[(a1 / N[(N[Power[b1, 1/3], $MachinePrecision] * N[Power[b1, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(a2 / N[Power[b1, 1/3], $MachinePrecision]), $MachinePrecision] / b2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 9.809131235010281e+288], t$95$0, t$95$1]]]]]]
\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
t_1 := \frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq -1.117539720539455 \cdot 10^{-304}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\frac{a1}{\sqrt[3]{b1} \cdot \sqrt[3]{b1}} \cdot \frac{\frac{a2}{\sqrt[3]{b1}}}{b2}\\
\mathbf{elif}\;t_0 \leq 9.809131235010281 \cdot 10^{+288}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.2 |
|---|---|
| Target | 11.2 |
| Herbie | 2.2 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0 or 9.80913123501028139e288 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 61.4
Applied times-frac_binary649.0
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.11753972053945503e-304 or 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 9.80913123501028139e288Initial program 0.8
Applied associate-/r*_binary648.4
Applied *-un-lft-identity_binary648.4
Applied div-inv_binary648.4
Applied times-frac_binary641.2
Applied associate-*l/_binary641.2
Simplified0.8
if -1.11753972053945503e-304 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0Initial program 13.4
Applied associate-/r*_binary646.1
Applied *-un-lft-identity_binary646.1
Applied add-cube-cbrt_binary646.2
Applied times-frac_binary643.4
Applied times-frac_binary642.4
Simplified2.4
Final simplification2.2
herbie shell --seed 2022138
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))