
(FPCore (a1 a2 b1 b2) :precision binary64 (/ (* a1 a2) (* b1 b2)))
double code(double a1, double a2, double b1, double b2) {
return (a1 * a2) / (b1 * b2);
}
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
public static double code(double a1, double a2, double b1, double b2) {
return (a1 * a2) / (b1 * b2);
}
def code(a1, a2, b1, b2): return (a1 * a2) / (b1 * b2)
function code(a1, a2, b1, b2) return Float64(Float64(a1 * a2) / Float64(b1 * b2)) end
function tmp = code(a1, a2, b1, b2) tmp = (a1 * a2) / (b1 * b2); end
code[a1_, a2_, b1_, b2_] := N[(N[(a1 * a2), $MachinePrecision] / N[(b1 * b2), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a1 \cdot a2}{b1 \cdot b2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a1 a2 b1 b2) :precision binary64 (/ (* a1 a2) (* b1 b2)))
double code(double a1, double a2, double b1, double b2) {
return (a1 * a2) / (b1 * b2);
}
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
public static double code(double a1, double a2, double b1, double b2) {
return (a1 * a2) / (b1 * b2);
}
def code(a1, a2, b1, b2): return (a1 * a2) / (b1 * b2)
function code(a1, a2, b1, b2) return Float64(Float64(a1 * a2) / Float64(b1 * b2)) end
function tmp = code(a1, a2, b1, b2) tmp = (a1 * a2) / (b1 * b2); end
code[a1_, a2_, b1_, b2_] := N[(N[(a1 * a2), $MachinePrecision] / N[(b1 * b2), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a1 \cdot a2}{b1 \cdot b2}
\end{array}
NOTE: a1 and a2 should be sorted in increasing order before calling this function.
NOTE: b1 and b2 should be sorted in increasing order before calling this function.
(FPCore (a1 a2 b1 b2)
:precision binary64
(let* ((t_0 (/ (* a1 a2) (* b1 b2))))
(if (<= t_0 (- INFINITY))
(* a1 (/ (/ a2 b2) b1))
(if (<= t_0 -1e-250)
t_0
(if (<= t_0 5e-285)
(* (/ a2 b2) (/ a1 b1))
(if (<= t_0 5e+289) t_0 (/ (/ a1 b1) (/ b2 a2))))))))assert(a1 < a2);
assert(b1 < b2);
double code(double a1, double a2, double b1, double b2) {
double t_0 = (a1 * a2) / (b1 * b2);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = a1 * ((a2 / b2) / b1);
} else if (t_0 <= -1e-250) {
tmp = t_0;
} else if (t_0 <= 5e-285) {
tmp = (a2 / b2) * (a1 / b1);
} else if (t_0 <= 5e+289) {
tmp = t_0;
} else {
tmp = (a1 / b1) / (b2 / a2);
}
return tmp;
}
assert a1 < a2;
assert 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 <= -Double.POSITIVE_INFINITY) {
tmp = a1 * ((a2 / b2) / b1);
} else if (t_0 <= -1e-250) {
tmp = t_0;
} else if (t_0 <= 5e-285) {
tmp = (a2 / b2) * (a1 / b1);
} else if (t_0 <= 5e+289) {
tmp = t_0;
} else {
tmp = (a1 / b1) / (b2 / a2);
}
return tmp;
}
[a1, a2] = sort([a1, a2]) [b1, b2] = sort([b1, b2]) def code(a1, a2, b1, b2): t_0 = (a1 * a2) / (b1 * b2) tmp = 0 if t_0 <= -math.inf: tmp = a1 * ((a2 / b2) / b1) elif t_0 <= -1e-250: tmp = t_0 elif t_0 <= 5e-285: tmp = (a2 / b2) * (a1 / b1) elif t_0 <= 5e+289: tmp = t_0 else: tmp = (a1 / b1) / (b2 / a2) return tmp
a1, a2 = sort([a1, a2]) b1, b2 = sort([b1, b2]) function code(a1, a2, b1, b2) t_0 = Float64(Float64(a1 * a2) / Float64(b1 * b2)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(a1 * Float64(Float64(a2 / b2) / b1)); elseif (t_0 <= -1e-250) tmp = t_0; elseif (t_0 <= 5e-285) tmp = Float64(Float64(a2 / b2) * Float64(a1 / b1)); elseif (t_0 <= 5e+289) tmp = t_0; else tmp = Float64(Float64(a1 / b1) / Float64(b2 / a2)); end return tmp end
a1, a2 = num2cell(sort([a1, a2])){:}
b1, b2 = num2cell(sort([b1, b2])){:}
function tmp_2 = code(a1, a2, b1, b2)
t_0 = (a1 * a2) / (b1 * b2);
tmp = 0.0;
if (t_0 <= -Inf)
tmp = a1 * ((a2 / b2) / b1);
elseif (t_0 <= -1e-250)
tmp = t_0;
elseif (t_0 <= 5e-285)
tmp = (a2 / b2) * (a1 / b1);
elseif (t_0 <= 5e+289)
tmp = t_0;
else
tmp = (a1 / b1) / (b2 / a2);
end
tmp_2 = tmp;
end
NOTE: a1 and a2 should be sorted in increasing order before calling this function.
NOTE: b1 and b2 should be sorted in increasing order before calling this function.
code[a1_, a2_, b1_, b2_] := Block[{t$95$0 = N[(N[(a1 * a2), $MachinePrecision] / N[(b1 * b2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(a1 * N[(N[(a2 / b2), $MachinePrecision] / b1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -1e-250], t$95$0, If[LessEqual[t$95$0, 5e-285], N[(N[(a2 / b2), $MachinePrecision] * N[(a1 / b1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+289], t$95$0, N[(N[(a1 / b1), $MachinePrecision] / N[(b2 / a2), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[a1, a2] = \mathsf{sort}([a1, a2])\\
[b1, b2] = \mathsf{sort}([b1, b2])\\
\\
\begin{array}{l}
t_0 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b2}}{b1}\\
\mathbf{elif}\;t_0 \leq -1 \cdot 10^{-250}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-285}:\\
\;\;\;\;\frac{a2}{b2} \cdot \frac{a1}{b1}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+289}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a1}{b1}}{\frac{b2}{a2}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 79.4%
times-frac92.2%
associate-*l/94.6%
associate-*r/94.6%
Simplified94.6%
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.0000000000000001e-250 or 5.00000000000000018e-285 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 5.00000000000000031e289Initial program 99.0%
if -1.0000000000000001e-250 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 5.00000000000000018e-285Initial program 75.7%
times-frac92.5%
Simplified92.5%
if 5.00000000000000031e289 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 57.0%
times-frac96.3%
associate-*l/85.9%
associate-*r/92.7%
Simplified92.7%
associate-*r/85.9%
associate-*l/96.3%
clear-num96.3%
un-div-inv99.2%
Applied egg-rr99.2%
Final simplification96.5%
NOTE: a1 and a2 should be sorted in increasing order before calling this function.
NOTE: b1 and b2 should be sorted in increasing order before calling this function.
(FPCore (a1 a2 b1 b2)
:precision binary64
(let* ((t_0 (/ (* a1 a2) (* b1 b2))))
(if (<= t_0 (- INFINITY))
(* a1 (/ (/ a2 b2) b1))
(if (or (<= t_0 -1e-250) (and (not (<= t_0 5e-285)) (<= t_0 5e+289)))
t_0
(* (/ a2 b2) (/ a1 b1))))))assert(a1 < a2);
assert(b1 < b2);
double code(double a1, double a2, double b1, double b2) {
double t_0 = (a1 * a2) / (b1 * b2);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = a1 * ((a2 / b2) / b1);
} else if ((t_0 <= -1e-250) || (!(t_0 <= 5e-285) && (t_0 <= 5e+289))) {
tmp = t_0;
} else {
tmp = (a2 / b2) * (a1 / b1);
}
return tmp;
}
assert a1 < a2;
assert 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 <= -Double.POSITIVE_INFINITY) {
tmp = a1 * ((a2 / b2) / b1);
} else if ((t_0 <= -1e-250) || (!(t_0 <= 5e-285) && (t_0 <= 5e+289))) {
tmp = t_0;
} else {
tmp = (a2 / b2) * (a1 / b1);
}
return tmp;
}
[a1, a2] = sort([a1, a2]) [b1, b2] = sort([b1, b2]) def code(a1, a2, b1, b2): t_0 = (a1 * a2) / (b1 * b2) tmp = 0 if t_0 <= -math.inf: tmp = a1 * ((a2 / b2) / b1) elif (t_0 <= -1e-250) or (not (t_0 <= 5e-285) and (t_0 <= 5e+289)): tmp = t_0 else: tmp = (a2 / b2) * (a1 / b1) return tmp
a1, a2 = sort([a1, a2]) b1, b2 = sort([b1, b2]) function code(a1, a2, b1, b2) t_0 = Float64(Float64(a1 * a2) / Float64(b1 * b2)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(a1 * Float64(Float64(a2 / b2) / b1)); elseif ((t_0 <= -1e-250) || (!(t_0 <= 5e-285) && (t_0 <= 5e+289))) tmp = t_0; else tmp = Float64(Float64(a2 / b2) * Float64(a1 / b1)); end return tmp end
a1, a2 = num2cell(sort([a1, a2])){:}
b1, b2 = num2cell(sort([b1, b2])){:}
function tmp_2 = code(a1, a2, b1, b2)
t_0 = (a1 * a2) / (b1 * b2);
tmp = 0.0;
if (t_0 <= -Inf)
tmp = a1 * ((a2 / b2) / b1);
elseif ((t_0 <= -1e-250) || (~((t_0 <= 5e-285)) && (t_0 <= 5e+289)))
tmp = t_0;
else
tmp = (a2 / b2) * (a1 / b1);
end
tmp_2 = tmp;
end
NOTE: a1 and a2 should be sorted in increasing order before calling this function.
NOTE: b1 and b2 should be sorted in increasing order before calling this function.
code[a1_, a2_, b1_, b2_] := Block[{t$95$0 = N[(N[(a1 * a2), $MachinePrecision] / N[(b1 * b2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(a1 * N[(N[(a2 / b2), $MachinePrecision] / b1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$0, -1e-250], And[N[Not[LessEqual[t$95$0, 5e-285]], $MachinePrecision], LessEqual[t$95$0, 5e+289]]], t$95$0, N[(N[(a2 / b2), $MachinePrecision] * N[(a1 / b1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[a1, a2] = \mathsf{sort}([a1, a2])\\
[b1, b2] = \mathsf{sort}([b1, b2])\\
\\
\begin{array}{l}
t_0 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b2}}{b1}\\
\mathbf{elif}\;t_0 \leq -1 \cdot 10^{-250} \lor \neg \left(t_0 \leq 5 \cdot 10^{-285}\right) \land t_0 \leq 5 \cdot 10^{+289}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{a2}{b2} \cdot \frac{a1}{b1}\\
\end{array}
\end{array}
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 79.4%
times-frac92.2%
associate-*l/94.6%
associate-*r/94.6%
Simplified94.6%
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.0000000000000001e-250 or 5.00000000000000018e-285 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 5.00000000000000031e289Initial program 99.0%
if -1.0000000000000001e-250 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 5.00000000000000018e-285 or 5.00000000000000031e289 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 70.8%
times-frac93.5%
Simplified93.5%
Final simplification96.2%
NOTE: a1 and a2 should be sorted in increasing order before calling this function. NOTE: b1 and b2 should be sorted in increasing order before calling this function. (FPCore (a1 a2 b1 b2) :precision binary64 (if (<= b1 -1.4e+133) (* a1 (/ (/ a2 b2) b1)) (* (/ a2 b2) (/ a1 b1))))
assert(a1 < a2);
assert(b1 < b2);
double code(double a1, double a2, double b1, double b2) {
double tmp;
if (b1 <= -1.4e+133) {
tmp = a1 * ((a2 / b2) / b1);
} else {
tmp = (a2 / b2) * (a1 / b1);
}
return tmp;
}
NOTE: a1 and a2 should be sorted in increasing order before calling this function.
NOTE: b1 and b2 should be sorted in increasing order before calling this 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) :: tmp
if (b1 <= (-1.4d+133)) then
tmp = a1 * ((a2 / b2) / b1)
else
tmp = (a2 / b2) * (a1 / b1)
end if
code = tmp
end function
assert a1 < a2;
assert b1 < b2;
public static double code(double a1, double a2, double b1, double b2) {
double tmp;
if (b1 <= -1.4e+133) {
tmp = a1 * ((a2 / b2) / b1);
} else {
tmp = (a2 / b2) * (a1 / b1);
}
return tmp;
}
[a1, a2] = sort([a1, a2]) [b1, b2] = sort([b1, b2]) def code(a1, a2, b1, b2): tmp = 0 if b1 <= -1.4e+133: tmp = a1 * ((a2 / b2) / b1) else: tmp = (a2 / b2) * (a1 / b1) return tmp
a1, a2 = sort([a1, a2]) b1, b2 = sort([b1, b2]) function code(a1, a2, b1, b2) tmp = 0.0 if (b1 <= -1.4e+133) tmp = Float64(a1 * Float64(Float64(a2 / b2) / b1)); else tmp = Float64(Float64(a2 / b2) * Float64(a1 / b1)); end return tmp end
a1, a2 = num2cell(sort([a1, a2])){:}
b1, b2 = num2cell(sort([b1, b2])){:}
function tmp_2 = code(a1, a2, b1, b2)
tmp = 0.0;
if (b1 <= -1.4e+133)
tmp = a1 * ((a2 / b2) / b1);
else
tmp = (a2 / b2) * (a1 / b1);
end
tmp_2 = tmp;
end
NOTE: a1 and a2 should be sorted in increasing order before calling this function. NOTE: b1 and b2 should be sorted in increasing order before calling this function. code[a1_, a2_, b1_, b2_] := If[LessEqual[b1, -1.4e+133], N[(a1 * N[(N[(a2 / b2), $MachinePrecision] / b1), $MachinePrecision]), $MachinePrecision], N[(N[(a2 / b2), $MachinePrecision] * N[(a1 / b1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a1, a2] = \mathsf{sort}([a1, a2])\\
[b1, b2] = \mathsf{sort}([b1, b2])\\
\\
\begin{array}{l}
\mathbf{if}\;b1 \leq -1.4 \cdot 10^{+133}:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b2}}{b1}\\
\mathbf{else}:\\
\;\;\;\;\frac{a2}{b2} \cdot \frac{a1}{b1}\\
\end{array}
\end{array}
if b1 < -1.40000000000000008e133Initial program 87.9%
times-frac74.4%
associate-*l/85.3%
associate-*r/87.7%
Simplified87.7%
if -1.40000000000000008e133 < b1 Initial program 84.4%
times-frac85.9%
Simplified85.9%
Final simplification86.2%
NOTE: a1 and a2 should be sorted in increasing order before calling this function. NOTE: b1 and b2 should be sorted in increasing order before calling this function. (FPCore (a1 a2 b1 b2) :precision binary64 (if (<= b1 -5e+127) (* (/ a2 b1) (/ a1 b2)) (* (/ a2 b2) (/ a1 b1))))
assert(a1 < a2);
assert(b1 < b2);
double code(double a1, double a2, double b1, double b2) {
double tmp;
if (b1 <= -5e+127) {
tmp = (a2 / b1) * (a1 / b2);
} else {
tmp = (a2 / b2) * (a1 / b1);
}
return tmp;
}
NOTE: a1 and a2 should be sorted in increasing order before calling this function.
NOTE: b1 and b2 should be sorted in increasing order before calling this 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) :: tmp
if (b1 <= (-5d+127)) then
tmp = (a2 / b1) * (a1 / b2)
else
tmp = (a2 / b2) * (a1 / b1)
end if
code = tmp
end function
assert a1 < a2;
assert b1 < b2;
public static double code(double a1, double a2, double b1, double b2) {
double tmp;
if (b1 <= -5e+127) {
tmp = (a2 / b1) * (a1 / b2);
} else {
tmp = (a2 / b2) * (a1 / b1);
}
return tmp;
}
[a1, a2] = sort([a1, a2]) [b1, b2] = sort([b1, b2]) def code(a1, a2, b1, b2): tmp = 0 if b1 <= -5e+127: tmp = (a2 / b1) * (a1 / b2) else: tmp = (a2 / b2) * (a1 / b1) return tmp
a1, a2 = sort([a1, a2]) b1, b2 = sort([b1, b2]) function code(a1, a2, b1, b2) tmp = 0.0 if (b1 <= -5e+127) tmp = Float64(Float64(a2 / b1) * Float64(a1 / b2)); else tmp = Float64(Float64(a2 / b2) * Float64(a1 / b1)); end return tmp end
a1, a2 = num2cell(sort([a1, a2])){:}
b1, b2 = num2cell(sort([b1, b2])){:}
function tmp_2 = code(a1, a2, b1, b2)
tmp = 0.0;
if (b1 <= -5e+127)
tmp = (a2 / b1) * (a1 / b2);
else
tmp = (a2 / b2) * (a1 / b1);
end
tmp_2 = tmp;
end
NOTE: a1 and a2 should be sorted in increasing order before calling this function. NOTE: b1 and b2 should be sorted in increasing order before calling this function. code[a1_, a2_, b1_, b2_] := If[LessEqual[b1, -5e+127], N[(N[(a2 / b1), $MachinePrecision] * N[(a1 / b2), $MachinePrecision]), $MachinePrecision], N[(N[(a2 / b2), $MachinePrecision] * N[(a1 / b1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a1, a2] = \mathsf{sort}([a1, a2])\\
[b1, b2] = \mathsf{sort}([b1, b2])\\
\\
\begin{array}{l}
\mathbf{if}\;b1 \leq -5 \cdot 10^{+127}:\\
\;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a2}{b2} \cdot \frac{a1}{b1}\\
\end{array}
\end{array}
if b1 < -5.0000000000000004e127Initial program 88.8%
times-frac74.0%
associate-*l/84.0%
associate-*r/86.2%
Simplified86.2%
Taylor expanded in a1 around 0 88.8%
*-commutative88.8%
times-frac76.8%
Simplified76.8%
if -5.0000000000000004e127 < b1 Initial program 84.2%
times-frac86.2%
Simplified86.2%
Final simplification84.8%
NOTE: a1 and a2 should be sorted in increasing order before calling this function. NOTE: b1 and b2 should be sorted in increasing order before calling this function. (FPCore (a1 a2 b1 b2) :precision binary64 (* a1 (/ (/ a2 b2) b1)))
assert(a1 < a2);
assert(b1 < b2);
double code(double a1, double a2, double b1, double b2) {
return a1 * ((a2 / b2) / b1);
}
NOTE: a1 and a2 should be sorted in increasing order before calling this function.
NOTE: b1 and b2 should be sorted in increasing order before calling this 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
code = a1 * ((a2 / b2) / b1)
end function
assert a1 < a2;
assert b1 < b2;
public static double code(double a1, double a2, double b1, double b2) {
return a1 * ((a2 / b2) / b1);
}
[a1, a2] = sort([a1, a2]) [b1, b2] = sort([b1, b2]) def code(a1, a2, b1, b2): return a1 * ((a2 / b2) / b1)
a1, a2 = sort([a1, a2]) b1, b2 = sort([b1, b2]) function code(a1, a2, b1, b2) return Float64(a1 * Float64(Float64(a2 / b2) / b1)) end
a1, a2 = num2cell(sort([a1, a2])){:}
b1, b2 = num2cell(sort([b1, b2])){:}
function tmp = code(a1, a2, b1, b2)
tmp = a1 * ((a2 / b2) / b1);
end
NOTE: a1 and a2 should be sorted in increasing order before calling this function. NOTE: b1 and b2 should be sorted in increasing order before calling this function. code[a1_, a2_, b1_, b2_] := N[(a1 * N[(N[(a2 / b2), $MachinePrecision] / b1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a1, a2] = \mathsf{sort}([a1, a2])\\
[b1, b2] = \mathsf{sort}([b1, b2])\\
\\
a1 \cdot \frac{\frac{a2}{b2}}{b1}
\end{array}
Initial program 84.9%
times-frac84.4%
associate-*l/85.3%
associate-*r/86.7%
Simplified86.7%
Final simplification86.7%
(FPCore (a1 a2 b1 b2) :precision binary64 (* (/ a1 b1) (/ a2 b2)))
double code(double a1, double a2, double b1, double b2) {
return (a1 / b1) * (a2 / b2);
}
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 / b1) * (a2 / b2)
end function
public static double code(double a1, double a2, double b1, double b2) {
return (a1 / b1) * (a2 / b2);
}
def code(a1, a2, b1, b2): return (a1 / b1) * (a2 / b2)
function code(a1, a2, b1, b2) return Float64(Float64(a1 / b1) * Float64(a2 / b2)) end
function tmp = code(a1, a2, b1, b2) tmp = (a1 / b1) * (a2 / b2); end
code[a1_, a2_, b1_, b2_] := N[(N[(a1 / b1), $MachinePrecision] * N[(a2 / b2), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a1}{b1} \cdot \frac{a2}{b2}
\end{array}
herbie shell --seed 2023302
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))