(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))))
(if (<= t_0 -2.428659076582579e-287)
t_0
(if (<= t_0 1.6417374084e-314)
(/ (/ (* a2 (/ a1 (* (cbrt b1) (cbrt b1)))) (cbrt b1)) b2)
(if (<= t_0 9.12141700165575e+273)
(/ 1.0 (/ (* b1 b2) (* a1 a2)))
(* (/ a1 b1) (/ a2 b2)))))))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 tmp;
if (t_0 <= -2.428659076582579e-287) {
tmp = t_0;
} else if (t_0 <= 1.6417374084e-314) {
tmp = ((a2 * (a1 / (cbrt(b1) * cbrt(b1)))) / cbrt(b1)) / b2;
} else if (t_0 <= 9.12141700165575e+273) {
tmp = 1.0 / ((b1 * b2) / (a1 * a2));
} else {
tmp = (a1 / b1) * (a2 / b2);
}
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 tmp;
if (t_0 <= -2.428659076582579e-287) {
tmp = t_0;
} else if (t_0 <= 1.6417374084e-314) {
tmp = ((a2 * (a1 / (Math.cbrt(b1) * Math.cbrt(b1)))) / Math.cbrt(b1)) / b2;
} else if (t_0 <= 9.12141700165575e+273) {
tmp = 1.0 / ((b1 * b2) / (a1 * a2));
} else {
tmp = (a1 / b1) * (a2 / b2);
}
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)) tmp = 0.0 if (t_0 <= -2.428659076582579e-287) tmp = t_0; elseif (t_0 <= 1.6417374084e-314) tmp = Float64(Float64(Float64(a2 * Float64(a1 / Float64(cbrt(b1) * cbrt(b1)))) / cbrt(b1)) / b2); elseif (t_0 <= 9.12141700165575e+273) tmp = Float64(1.0 / Float64(Float64(b1 * b2) / Float64(a1 * a2))); else tmp = Float64(Float64(a1 / b1) * Float64(a2 / b2)); 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]}, If[LessEqual[t$95$0, -2.428659076582579e-287], t$95$0, If[LessEqual[t$95$0, 1.6417374084e-314], N[(N[(N[(a2 * N[(a1 / N[(N[Power[b1, 1/3], $MachinePrecision] * N[Power[b1, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[b1, 1/3], $MachinePrecision]), $MachinePrecision] / b2), $MachinePrecision], If[LessEqual[t$95$0, 9.12141700165575e+273], N[(1.0 / N[(N[(b1 * b2), $MachinePrecision] / N[(a1 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a1 / b1), $MachinePrecision] * N[(a2 / b2), $MachinePrecision]), $MachinePrecision]]]]]
\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;t_0 \leq -2.428659076582579 \cdot 10^{-287}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 1.6417374084 \cdot 10^{-314}:\\
\;\;\;\;\frac{\frac{a2 \cdot \frac{a1}{\sqrt[3]{b1} \cdot \sqrt[3]{b1}}}{\sqrt[3]{b1}}}{b2}\\
\mathbf{elif}\;t_0 \leq 9.12141700165575 \cdot 10^{+273}:\\
\;\;\;\;\frac{1}{\frac{b1 \cdot b2}{a1 \cdot a2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\end{array}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.4 |
|---|---|
| Target | 11.0 |
| Herbie | 4.7 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -2.42865907658257895e-287Initial program 7.8
if -2.42865907658257895e-287 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 1.6417374084e-314Initial program 13.0
Applied associate-/r*_binary646.5
Applied add-cube-cbrt_binary646.6
Applied associate-/r*_binary646.6
Simplified4.2
if 1.6417374084e-314 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 9.1214170016557509e273Initial program 0.9
Applied clear-num_binary641.0
if 9.1214170016557509e273 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 55.4
Applied times-frac_binary648.0
Final simplification4.7
herbie shell --seed 2022131
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))