(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 (/ (/ a2 b1) b2))))
(if (<= t_0 -3.490612777261886e+283)
t_1
(if (<= t_0 -1.166e-321)
t_0
(if (<= t_0 0.0)
(* (/ a1 b1) (/ a2 b2))
(if (<= t_0 3.7245197859932976e+273) 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 * ((a2 / b1) / b2);
double tmp;
if (t_0 <= -3.490612777261886e+283) {
tmp = t_1;
} else if (t_0 <= -1.166e-321) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (a1 / b1) * (a2 / b2);
} else if (t_0 <= 3.7245197859932976e+273) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(a1, a2, b1, b2)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: b1
real(8), intent (in) :: b2
code = (a1 * a2) / (b1 * b2)
end function
real(8) function code(a1, a2, b1, b2)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: b1
real(8), intent (in) :: b2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (a1 * a2) / (b1 * b2)
t_1 = a1 * ((a2 / b1) / b2)
if (t_0 <= (-3.490612777261886d+283)) then
tmp = t_1
else if (t_0 <= (-1.166d-321)) then
tmp = t_0
else if (t_0 <= 0.0d0) then
tmp = (a1 / b1) * (a2 / b2)
else if (t_0 <= 3.7245197859932976d+273) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
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 * ((a2 / b1) / b2);
double tmp;
if (t_0 <= -3.490612777261886e+283) {
tmp = t_1;
} else if (t_0 <= -1.166e-321) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (a1 / b1) * (a2 / b2);
} else if (t_0 <= 3.7245197859932976e+273) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(a1, a2, b1, b2): return (a1 * a2) / (b1 * b2)
def code(a1, a2, b1, b2): t_0 = (a1 * a2) / (b1 * b2) t_1 = a1 * ((a2 / b1) / b2) tmp = 0 if t_0 <= -3.490612777261886e+283: tmp = t_1 elif t_0 <= -1.166e-321: tmp = t_0 elif t_0 <= 0.0: tmp = (a1 / b1) * (a2 / b2) elif t_0 <= 3.7245197859932976e+273: 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(a1 * Float64(Float64(a2 / b1) / b2)) tmp = 0.0 if (t_0 <= -3.490612777261886e+283) tmp = t_1; elseif (t_0 <= -1.166e-321) tmp = t_0; elseif (t_0 <= 0.0) tmp = Float64(Float64(a1 / b1) * Float64(a2 / b2)); elseif (t_0 <= 3.7245197859932976e+273) tmp = t_0; else tmp = t_1; end return tmp end
function tmp = code(a1, a2, b1, b2) tmp = (a1 * a2) / (b1 * b2); end
function tmp_2 = code(a1, a2, b1, b2) t_0 = (a1 * a2) / (b1 * b2); t_1 = a1 * ((a2 / b1) / b2); tmp = 0.0; if (t_0 <= -3.490612777261886e+283) tmp = t_1; elseif (t_0 <= -1.166e-321) tmp = t_0; elseif (t_0 <= 0.0) tmp = (a1 / b1) * (a2 / b2); elseif (t_0 <= 3.7245197859932976e+273) tmp = t_0; else tmp = t_1; end tmp_2 = 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[(a1 * N[(N[(a2 / b1), $MachinePrecision] / b2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -3.490612777261886e+283], t$95$1, If[LessEqual[t$95$0, -1.166e-321], t$95$0, If[LessEqual[t$95$0, 0.0], N[(N[(a1 / b1), $MachinePrecision] * N[(a2 / b2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 3.7245197859932976e+273], 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 := a1 \cdot \frac{\frac{a2}{b1}}{b2}\\
\mathbf{if}\;t_0 \leq -3.490612777261886 \cdot 10^{+283}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq -1.166 \cdot 10^{-321}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{elif}\;t_0 \leq 3.7245197859932976 \cdot 10^{+273}:\\
\;\;\;\;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.3 |
|---|---|
| Target | 11.1 |
| Herbie | 3.1 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -3.49061277726188584e283 or 3.72451978599329762e273 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 56.3
Applied div-inv_binary6456.3
Applied associate-*l*_binary6439.7
Applied *-un-lft-identity_binary6439.7
Applied times-frac_binary6439.1
Applied associate-*r*_binary6416.3
Simplified16.2
Applied un-div-inv_binary6416.2
if -3.49061277726188584e283 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.16599e-321 or 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 3.72451978599329762e273Initial program 0.8
if -1.16599e-321 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0Initial program 13.1
Applied times-frac_binary642.2
Final simplification3.1
herbie shell --seed 2022129
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))