
(FPCore (a b c d) :precision binary64 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = ((b * c) - (a * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d): return ((b * c) - (a * d)) / ((c * c) + (d * d))
function code(a, b, c, d) return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))) end
function tmp = code(a, b, c, d) tmp = ((b * c) - (a * d)) / ((c * c) + (d * d)); end
code[a_, b_, c_, d_] := N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c d) :precision binary64 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = ((b * c) - (a * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d): return ((b * c) - (a * d)) / ((c * c) + (d * d))
function code(a, b, c, d) return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))) end
function tmp = code(a, b, c, d) tmp = ((b * c) - (a * d)) / ((c * c) + (d * d)); end
code[a_, b_, c_, d_] := N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\end{array}
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ b (hypot c d))) (t_1 (/ c (hypot c d))))
(if (or (<= d -3.5e+145) (not (<= d 9.4e+123)))
(fma t_1 t_0 (/ a (- d)))
(fma t_1 t_0 (* a (/ d (- (pow (hypot c d) 2.0))))))))
double code(double a, double b, double c, double d) {
double t_0 = b / hypot(c, d);
double t_1 = c / hypot(c, d);
double tmp;
if ((d <= -3.5e+145) || !(d <= 9.4e+123)) {
tmp = fma(t_1, t_0, (a / -d));
} else {
tmp = fma(t_1, t_0, (a * (d / -pow(hypot(c, d), 2.0))));
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(b / hypot(c, d)) t_1 = Float64(c / hypot(c, d)) tmp = 0.0 if ((d <= -3.5e+145) || !(d <= 9.4e+123)) tmp = fma(t_1, t_0, Float64(a / Float64(-d))); else tmp = fma(t_1, t_0, Float64(a * Float64(d / Float64(-(hypot(c, d) ^ 2.0))))); end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[d, -3.5e+145], N[Not[LessEqual[d, 9.4e+123]], $MachinePrecision]], N[(t$95$1 * t$95$0 + N[(a / (-d)), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$0 + N[(a * N[(d / (-N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], 2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \frac{c}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;d \leq -3.5 \cdot 10^{+145} \lor \neg \left(d \leq 9.4 \cdot 10^{+123}\right):\\
\;\;\;\;\mathsf{fma}\left(t\_1, t\_0, \frac{a}{-d}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, t\_0, a \cdot \frac{d}{-{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)\\
\end{array}
\end{array}
if d < -3.5000000000000001e145 or 9.39999999999999958e123 < d Initial program 32.6%
div-sub32.6%
*-commutative32.6%
fma-define32.6%
add-sqr-sqrt32.6%
times-frac33.2%
fmm-def33.2%
fma-define33.2%
hypot-define33.2%
fma-define33.2%
hypot-define46.2%
associate-/l*54.1%
fma-define54.1%
add-sqr-sqrt54.1%
pow254.1%
Applied egg-rr54.1%
Taylor expanded in d around inf 98.7%
if -3.5000000000000001e145 < d < 9.39999999999999958e123Initial program 76.5%
div-sub73.2%
*-commutative73.2%
fma-define73.2%
add-sqr-sqrt73.2%
times-frac75.7%
fmm-def75.7%
fma-define75.7%
hypot-define75.8%
fma-define75.8%
hypot-define91.3%
associate-/l*91.4%
fma-define91.4%
add-sqr-sqrt91.4%
pow291.4%
Applied egg-rr91.4%
Final simplification93.5%
(FPCore (a b c d) :precision binary64 (if (<= (/ (- (* c b) (* d a)) (+ (* c c) (* d d))) 1e+245) (* (/ 1.0 (hypot c d)) (/ (fma b c (* (- d) a)) (hypot c d))) (fma (/ c (hypot c d)) (/ b (hypot c d)) (/ (- a) d))))
double code(double a, double b, double c, double d) {
double tmp;
if ((((c * b) - (d * a)) / ((c * c) + (d * d))) <= 1e+245) {
tmp = (1.0 / hypot(c, d)) * (fma(b, c, (-d * a)) / hypot(c, d));
} else {
tmp = fma((c / hypot(c, d)), (b / hypot(c, d)), (-a / d));
}
return tmp;
}
function code(a, b, c, d) tmp = 0.0 if (Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(Float64(c * c) + Float64(d * d))) <= 1e+245) tmp = Float64(Float64(1.0 / hypot(c, d)) * Float64(fma(b, c, Float64(Float64(-d) * a)) / hypot(c, d))); else tmp = fma(Float64(c / hypot(c, d)), Float64(b / hypot(c, d)), Float64(Float64(-a) / d)); end return tmp end
code[a_, b_, c_, d_] := If[LessEqual[N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+245], N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(b * c + N[((-d) * a), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] + N[((-a) / d), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d} \leq 10^{+245}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{\mathsf{fma}\left(b, c, \left(-d\right) \cdot a\right)}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{-a}{d}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < 1.00000000000000004e245Initial program 79.8%
fma-define79.8%
*-un-lft-identity79.8%
add-sqr-sqrt79.8%
times-frac79.8%
fma-define79.8%
hypot-define79.8%
fmm-def79.8%
distribute-rgt-neg-in79.8%
fma-define79.8%
hypot-define96.0%
Applied egg-rr96.0%
if 1.00000000000000004e245 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) Initial program 21.0%
div-sub15.1%
*-commutative15.1%
fma-define15.1%
add-sqr-sqrt15.1%
times-frac20.9%
fmm-def20.9%
fma-define20.9%
hypot-define20.9%
fma-define20.9%
hypot-define59.0%
associate-/l*63.3%
fma-define63.3%
add-sqr-sqrt63.3%
pow263.3%
Applied egg-rr63.3%
Taylor expanded in d around inf 72.8%
Final simplification89.8%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (fma (/ c (hypot c d)) (/ b (hypot c d)) (/ (- a) d))))
(if (<= d -8.5e-43)
t_0
(if (<= d 5.5e-119)
(/ (- b (* (/ d c) a)) c)
(if (<= d 2.05e+76) (/ (- (* c b) (* d a)) (fma c c (* d d))) t_0)))))
double code(double a, double b, double c, double d) {
double t_0 = fma((c / hypot(c, d)), (b / hypot(c, d)), (-a / d));
double tmp;
if (d <= -8.5e-43) {
tmp = t_0;
} else if (d <= 5.5e-119) {
tmp = (b - ((d / c) * a)) / c;
} else if (d <= 2.05e+76) {
tmp = ((c * b) - (d * a)) / fma(c, c, (d * d));
} else {
tmp = t_0;
}
return tmp;
}
function code(a, b, c, d) t_0 = fma(Float64(c / hypot(c, d)), Float64(b / hypot(c, d)), Float64(Float64(-a) / d)) tmp = 0.0 if (d <= -8.5e-43) tmp = t_0; elseif (d <= 5.5e-119) tmp = Float64(Float64(b - Float64(Float64(d / c) * a)) / c); elseif (d <= 2.05e+76) tmp = Float64(Float64(Float64(c * b) - Float64(d * a)) / fma(c, c, Float64(d * d))); else tmp = t_0; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(c / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] + N[((-a) / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.5e-43], t$95$0, If[LessEqual[d, 5.5e-119], N[(N[(b - N[(N[(d / c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 2.05e+76], N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{-a}{d}\right)\\
\mathbf{if}\;d \leq -8.5 \cdot 10^{-43}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 5.5 \cdot 10^{-119}:\\
\;\;\;\;\frac{b - \frac{d}{c} \cdot a}{c}\\
\mathbf{elif}\;d \leq 2.05 \cdot 10^{+76}:\\
\;\;\;\;\frac{c \cdot b - d \cdot a}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d < -8.50000000000000056e-43 or 2.0499999999999999e76 < d Initial program 47.9%
div-sub47.9%
*-commutative47.9%
fma-define47.9%
add-sqr-sqrt47.9%
times-frac49.2%
fmm-def49.2%
fma-define49.2%
hypot-define49.2%
fma-define49.2%
hypot-define65.8%
associate-/l*71.2%
fma-define71.2%
add-sqr-sqrt71.2%
pow271.2%
Applied egg-rr71.2%
Taylor expanded in d around inf 90.1%
if -8.50000000000000056e-43 < d < 5.49999999999999959e-119Initial program 72.6%
Taylor expanded in c around inf 89.7%
mul-1-neg89.7%
unsub-neg89.7%
associate-/l*89.7%
Simplified89.7%
if 5.49999999999999959e-119 < d < 2.0499999999999999e76Initial program 91.5%
fma-define91.5%
Simplified91.5%
Final simplification90.2%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (fma c c (* d d))))
(t_1 (/ (- b (* (/ d c) a)) c)))
(if (<= c -7e+90)
t_1
(if (<= c -1.05e-87)
t_0
(if (<= c 1.05e-146)
(/ (- (/ (* c b) d) a) d)
(if (<= c 1.65e+139) t_0 t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = ((c * b) - (d * a)) / fma(c, c, (d * d));
double t_1 = (b - ((d / c) * a)) / c;
double tmp;
if (c <= -7e+90) {
tmp = t_1;
} else if (c <= -1.05e-87) {
tmp = t_0;
} else if (c <= 1.05e-146) {
tmp = (((c * b) / d) - a) / d;
} else if (c <= 1.65e+139) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(Float64(Float64(c * b) - Float64(d * a)) / fma(c, c, Float64(d * d))) t_1 = Float64(Float64(b - Float64(Float64(d / c) * a)) / c) tmp = 0.0 if (c <= -7e+90) tmp = t_1; elseif (c <= -1.05e-87) tmp = t_0; elseif (c <= 1.05e-146) tmp = Float64(Float64(Float64(Float64(c * b) / d) - a) / d); elseif (c <= 1.65e+139) tmp = t_0; else tmp = t_1; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b - N[(N[(d / c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -7e+90], t$95$1, If[LessEqual[c, -1.05e-87], t$95$0, If[LessEqual[c, 1.05e-146], N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 1.65e+139], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\
t_1 := \frac{b - \frac{d}{c} \cdot a}{c}\\
\mathbf{if}\;c \leq -7 \cdot 10^{+90}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -1.05 \cdot 10^{-87}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;c \leq 1.05 \cdot 10^{-146}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{elif}\;c \leq 1.65 \cdot 10^{+139}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -6.9999999999999997e90 or 1.6500000000000001e139 < c Initial program 30.3%
Taylor expanded in c around inf 78.8%
mul-1-neg78.8%
unsub-neg78.8%
associate-/l*80.2%
Simplified80.2%
if -6.9999999999999997e90 < c < -1.05000000000000004e-87 or 1.05e-146 < c < 1.6500000000000001e139Initial program 85.7%
fma-define85.7%
Simplified85.7%
if -1.05000000000000004e-87 < c < 1.05e-146Initial program 70.7%
div-sub63.3%
*-commutative63.3%
fma-define63.3%
add-sqr-sqrt63.3%
times-frac61.1%
fmm-def61.1%
fma-define61.1%
hypot-define61.1%
fma-define61.1%
hypot-define63.6%
associate-/l*70.9%
fma-define70.9%
add-sqr-sqrt70.9%
pow270.9%
Applied egg-rr70.9%
Taylor expanded in d around inf 96.6%
Final simplification87.6%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (+ (* c c) (* d d))))
(t_1 (/ (- b (* (/ d c) a)) c)))
(if (<= c -2.45e+90)
t_1
(if (<= c -4.6e-87)
t_0
(if (<= c 1.16e-146)
(/ (- (/ (* c b) d) a) d)
(if (<= c 3.7e+140) t_0 t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d));
double t_1 = (b - ((d / c) * a)) / c;
double tmp;
if (c <= -2.45e+90) {
tmp = t_1;
} else if (c <= -4.6e-87) {
tmp = t_0;
} else if (c <= 1.16e-146) {
tmp = (((c * b) / d) - a) / d;
} else if (c <= 3.7e+140) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d))
t_1 = (b - ((d / c) * a)) / c
if (c <= (-2.45d+90)) then
tmp = t_1
else if (c <= (-4.6d-87)) then
tmp = t_0
else if (c <= 1.16d-146) then
tmp = (((c * b) / d) - a) / d
else if (c <= 3.7d+140) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d));
double t_1 = (b - ((d / c) * a)) / c;
double tmp;
if (c <= -2.45e+90) {
tmp = t_1;
} else if (c <= -4.6e-87) {
tmp = t_0;
} else if (c <= 1.16e-146) {
tmp = (((c * b) / d) - a) / d;
} else if (c <= 3.7e+140) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d)) t_1 = (b - ((d / c) * a)) / c tmp = 0 if c <= -2.45e+90: tmp = t_1 elif c <= -4.6e-87: tmp = t_0 elif c <= 1.16e-146: tmp = (((c * b) / d) - a) / d elif c <= 3.7e+140: tmp = t_0 else: tmp = t_1 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(Float64(c * c) + Float64(d * d))) t_1 = Float64(Float64(b - Float64(Float64(d / c) * a)) / c) tmp = 0.0 if (c <= -2.45e+90) tmp = t_1; elseif (c <= -4.6e-87) tmp = t_0; elseif (c <= 1.16e-146) tmp = Float64(Float64(Float64(Float64(c * b) / d) - a) / d); elseif (c <= 3.7e+140) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d)); t_1 = (b - ((d / c) * a)) / c; tmp = 0.0; if (c <= -2.45e+90) tmp = t_1; elseif (c <= -4.6e-87) tmp = t_0; elseif (c <= 1.16e-146) tmp = (((c * b) / d) - a) / d; elseif (c <= 3.7e+140) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b - N[(N[(d / c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -2.45e+90], t$95$1, If[LessEqual[c, -4.6e-87], t$95$0, If[LessEqual[c, 1.16e-146], N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 3.7e+140], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
t_1 := \frac{b - \frac{d}{c} \cdot a}{c}\\
\mathbf{if}\;c \leq -2.45 \cdot 10^{+90}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -4.6 \cdot 10^{-87}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;c \leq 1.16 \cdot 10^{-146}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{elif}\;c \leq 3.7 \cdot 10^{+140}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -2.4500000000000001e90 or 3.70000000000000003e140 < c Initial program 30.3%
Taylor expanded in c around inf 78.8%
mul-1-neg78.8%
unsub-neg78.8%
associate-/l*80.2%
Simplified80.2%
if -2.4500000000000001e90 < c < -4.6000000000000003e-87 or 1.16e-146 < c < 3.70000000000000003e140Initial program 85.7%
if -4.6000000000000003e-87 < c < 1.16e-146Initial program 70.7%
div-sub63.3%
*-commutative63.3%
fma-define63.3%
add-sqr-sqrt63.3%
times-frac61.1%
fmm-def61.1%
fma-define61.1%
hypot-define61.1%
fma-define61.1%
hypot-define63.6%
associate-/l*70.9%
fma-define70.9%
add-sqr-sqrt70.9%
pow270.9%
Applied egg-rr70.9%
Taylor expanded in d around inf 96.6%
Final simplification87.6%
(FPCore (a b c d) :precision binary64 (if (or (<= d -1.5e-42) (not (<= d 4.4e-21))) (/ (- (* b (/ c d)) a) d) (/ (- b (* (/ d c) a)) c)))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -1.5e-42) || !(d <= 4.4e-21)) {
tmp = ((b * (c / d)) - a) / d;
} else {
tmp = (b - ((d / c) * a)) / c;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((d <= (-1.5d-42)) .or. (.not. (d <= 4.4d-21))) then
tmp = ((b * (c / d)) - a) / d
else
tmp = (b - ((d / c) * a)) / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -1.5e-42) || !(d <= 4.4e-21)) {
tmp = ((b * (c / d)) - a) / d;
} else {
tmp = (b - ((d / c) * a)) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -1.5e-42) or not (d <= 4.4e-21): tmp = ((b * (c / d)) - a) / d else: tmp = (b - ((d / c) * a)) / c return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -1.5e-42) || !(d <= 4.4e-21)) tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d); else tmp = Float64(Float64(b - Float64(Float64(d / c) * a)) / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((d <= -1.5e-42) || ~((d <= 4.4e-21))) tmp = ((b * (c / d)) - a) / d; else tmp = (b - ((d / c) * a)) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -1.5e-42], N[Not[LessEqual[d, 4.4e-21]], $MachinePrecision]], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], N[(N[(b - N[(N[(d / c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.5 \cdot 10^{-42} \lor \neg \left(d \leq 4.4 \cdot 10^{-21}\right):\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - \frac{d}{c} \cdot a}{c}\\
\end{array}
\end{array}
if d < -1.50000000000000014e-42 or 4.4000000000000001e-21 < d Initial program 55.6%
fma-define55.7%
*-un-lft-identity55.7%
add-sqr-sqrt55.6%
times-frac55.6%
fma-define55.6%
hypot-define55.6%
fmm-def55.6%
distribute-rgt-neg-in55.6%
fma-define55.6%
hypot-define71.2%
Applied egg-rr71.2%
inv-pow71.2%
add-sqr-sqrt71.1%
unpow-prod-down71.0%
hypot-undefine55.4%
+-commutative55.4%
hypot-define71.0%
hypot-undefine55.4%
+-commutative55.4%
hypot-define71.0%
Applied egg-rr71.0%
Taylor expanded in d around inf 75.0%
+-commutative75.0%
mul-1-neg75.0%
unsub-neg75.0%
associate-/l*78.3%
Simplified78.3%
if -1.50000000000000014e-42 < d < 4.4000000000000001e-21Initial program 75.7%
Taylor expanded in c around inf 85.9%
mul-1-neg85.9%
unsub-neg85.9%
associate-/l*85.9%
Simplified85.9%
Final simplification81.5%
(FPCore (a b c d) :precision binary64 (if (or (<= d -8e-41) (not (<= d 1.02e-14))) (/ (- a) d) (/ (- b (* (/ d c) a)) c)))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -8e-41) || !(d <= 1.02e-14)) {
tmp = -a / d;
} else {
tmp = (b - ((d / c) * a)) / c;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((d <= (-8d-41)) .or. (.not. (d <= 1.02d-14))) then
tmp = -a / d
else
tmp = (b - ((d / c) * a)) / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -8e-41) || !(d <= 1.02e-14)) {
tmp = -a / d;
} else {
tmp = (b - ((d / c) * a)) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -8e-41) or not (d <= 1.02e-14): tmp = -a / d else: tmp = (b - ((d / c) * a)) / c return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -8e-41) || !(d <= 1.02e-14)) tmp = Float64(Float64(-a) / d); else tmp = Float64(Float64(b - Float64(Float64(d / c) * a)) / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((d <= -8e-41) || ~((d <= 1.02e-14))) tmp = -a / d; else tmp = (b - ((d / c) * a)) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -8e-41], N[Not[LessEqual[d, 1.02e-14]], $MachinePrecision]], N[((-a) / d), $MachinePrecision], N[(N[(b - N[(N[(d / c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -8 \cdot 10^{-41} \lor \neg \left(d \leq 1.02 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - \frac{d}{c} \cdot a}{c}\\
\end{array}
\end{array}
if d < -8.00000000000000005e-41 or 1.02e-14 < d Initial program 54.7%
Taylor expanded in c around 0 68.2%
associate-*r/68.2%
neg-mul-168.2%
Simplified68.2%
if -8.00000000000000005e-41 < d < 1.02e-14Initial program 76.3%
Taylor expanded in c around inf 84.1%
mul-1-neg84.1%
unsub-neg84.1%
associate-/l*84.1%
Simplified84.1%
Final simplification75.2%
(FPCore (a b c d) :precision binary64 (if (<= d -1.28e-42) (/ (- (* b (/ c d)) a) d) (if (<= d 8.2e-21) (/ (- b (* (/ d c) a)) c) (/ (- (* c (/ b d)) a) d))))
double code(double a, double b, double c, double d) {
double tmp;
if (d <= -1.28e-42) {
tmp = ((b * (c / d)) - a) / d;
} else if (d <= 8.2e-21) {
tmp = (b - ((d / c) * a)) / c;
} else {
tmp = ((c * (b / d)) - a) / d;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if (d <= (-1.28d-42)) then
tmp = ((b * (c / d)) - a) / d
else if (d <= 8.2d-21) then
tmp = (b - ((d / c) * a)) / c
else
tmp = ((c * (b / d)) - a) / d
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if (d <= -1.28e-42) {
tmp = ((b * (c / d)) - a) / d;
} else if (d <= 8.2e-21) {
tmp = (b - ((d / c) * a)) / c;
} else {
tmp = ((c * (b / d)) - a) / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if d <= -1.28e-42: tmp = ((b * (c / d)) - a) / d elif d <= 8.2e-21: tmp = (b - ((d / c) * a)) / c else: tmp = ((c * (b / d)) - a) / d return tmp
function code(a, b, c, d) tmp = 0.0 if (d <= -1.28e-42) tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d); elseif (d <= 8.2e-21) tmp = Float64(Float64(b - Float64(Float64(d / c) * a)) / c); else tmp = Float64(Float64(Float64(c * Float64(b / d)) - a) / d); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (d <= -1.28e-42) tmp = ((b * (c / d)) - a) / d; elseif (d <= 8.2e-21) tmp = (b - ((d / c) * a)) / c; else tmp = ((c * (b / d)) - a) / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[d, -1.28e-42], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[d, 8.2e-21], N[(N[(b - N[(N[(d / c), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(c * N[(b / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.28 \cdot 10^{-42}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{elif}\;d \leq 8.2 \cdot 10^{-21}:\\
\;\;\;\;\frac{b - \frac{d}{c} \cdot a}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\
\end{array}
\end{array}
if d < -1.27999999999999994e-42Initial program 57.5%
fma-define57.5%
*-un-lft-identity57.5%
add-sqr-sqrt57.5%
times-frac57.5%
fma-define57.5%
hypot-define57.5%
fmm-def57.5%
distribute-rgt-neg-in57.5%
fma-define57.5%
hypot-define68.9%
Applied egg-rr68.9%
inv-pow68.9%
add-sqr-sqrt68.8%
unpow-prod-down68.7%
hypot-undefine57.3%
+-commutative57.3%
hypot-define68.7%
hypot-undefine57.3%
+-commutative57.3%
hypot-define68.7%
Applied egg-rr68.7%
Taylor expanded in d around inf 73.3%
+-commutative73.3%
mul-1-neg73.3%
unsub-neg73.3%
associate-/l*77.2%
Simplified77.2%
if -1.27999999999999994e-42 < d < 8.19999999999999988e-21Initial program 75.7%
Taylor expanded in c around inf 85.9%
mul-1-neg85.9%
unsub-neg85.9%
associate-/l*85.9%
Simplified85.9%
if 8.19999999999999988e-21 < d Initial program 53.7%
Taylor expanded in d around -inf 76.7%
mul-1-neg76.7%
+-commutative76.7%
remove-double-neg76.7%
sub-neg76.7%
neg-mul-176.7%
distribute-neg-frac276.7%
cancel-sign-sub-inv76.7%
metadata-eval76.7%
*-lft-identity76.7%
+-commutative76.7%
mul-1-neg76.7%
unsub-neg76.7%
*-commutative76.7%
associate-/l*82.2%
Simplified82.2%
Final simplification82.3%
(FPCore (a b c d) :precision binary64 (if (or (<= d -7.2e-41) (not (<= d 2e-14))) (/ a (- d)) (/ b c)))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -7.2e-41) || !(d <= 2e-14)) {
tmp = a / -d;
} else {
tmp = b / c;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((d <= (-7.2d-41)) .or. (.not. (d <= 2d-14))) then
tmp = a / -d
else
tmp = b / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -7.2e-41) || !(d <= 2e-14)) {
tmp = a / -d;
} else {
tmp = b / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -7.2e-41) or not (d <= 2e-14): tmp = a / -d else: tmp = b / c return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -7.2e-41) || !(d <= 2e-14)) tmp = Float64(a / Float64(-d)); else tmp = Float64(b / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((d <= -7.2e-41) || ~((d <= 2e-14))) tmp = a / -d; else tmp = b / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -7.2e-41], N[Not[LessEqual[d, 2e-14]], $MachinePrecision]], N[(a / (-d)), $MachinePrecision], N[(b / c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -7.2 \cdot 10^{-41} \lor \neg \left(d \leq 2 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{a}{-d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\end{array}
if d < -7.2e-41 or 2e-14 < d Initial program 54.7%
Taylor expanded in c around 0 68.2%
associate-*r/68.2%
neg-mul-168.2%
Simplified68.2%
if -7.2e-41 < d < 2e-14Initial program 76.3%
Taylor expanded in c around inf 62.2%
Final simplification65.6%
(FPCore (a b c d) :precision binary64 (if (or (<= d -1.55e+190) (not (<= d 2.6e+185))) (/ a d) (/ b c)))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -1.55e+190) || !(d <= 2.6e+185)) {
tmp = a / d;
} else {
tmp = b / c;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((d <= (-1.55d+190)) .or. (.not. (d <= 2.6d+185))) then
tmp = a / d
else
tmp = b / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -1.55e+190) || !(d <= 2.6e+185)) {
tmp = a / d;
} else {
tmp = b / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -1.55e+190) or not (d <= 2.6e+185): tmp = a / d else: tmp = b / c return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -1.55e+190) || !(d <= 2.6e+185)) tmp = Float64(a / d); else tmp = Float64(b / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((d <= -1.55e+190) || ~((d <= 2.6e+185))) tmp = a / d; else tmp = b / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -1.55e+190], N[Not[LessEqual[d, 2.6e+185]], $MachinePrecision]], N[(a / d), $MachinePrecision], N[(b / c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.55 \cdot 10^{+190} \lor \neg \left(d \leq 2.6 \cdot 10^{+185}\right):\\
\;\;\;\;\frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\end{array}
if d < -1.5500000000000001e190 or 2.60000000000000001e185 < d Initial program 35.3%
Taylor expanded in c around 0 86.5%
associate-*r/86.5%
neg-mul-186.5%
Simplified86.5%
neg-sub086.5%
sub-neg86.5%
add-sqr-sqrt41.9%
sqrt-unprod55.4%
sqr-neg55.4%
sqrt-unprod17.3%
add-sqr-sqrt36.8%
Applied egg-rr36.8%
+-lft-identity36.8%
Simplified36.8%
if -1.5500000000000001e190 < d < 2.60000000000000001e185Initial program 71.2%
Taylor expanded in c around inf 47.4%
Final simplification45.3%
(FPCore (a b c d) :precision binary64 (if (or (<= d -8e+99) (not (<= d 1.05e+47))) (/ a d) (/ a c)))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -8e+99) || !(d <= 1.05e+47)) {
tmp = a / d;
} else {
tmp = a / c;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((d <= (-8d+99)) .or. (.not. (d <= 1.05d+47))) then
tmp = a / d
else
tmp = a / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -8e+99) || !(d <= 1.05e+47)) {
tmp = a / d;
} else {
tmp = a / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -8e+99) or not (d <= 1.05e+47): tmp = a / d else: tmp = a / c return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -8e+99) || !(d <= 1.05e+47)) tmp = Float64(a / d); else tmp = Float64(a / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((d <= -8e+99) || ~((d <= 1.05e+47))) tmp = a / d; else tmp = a / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -8e+99], N[Not[LessEqual[d, 1.05e+47]], $MachinePrecision]], N[(a / d), $MachinePrecision], N[(a / c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -8 \cdot 10^{+99} \lor \neg \left(d \leq 1.05 \cdot 10^{+47}\right):\\
\;\;\;\;\frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\end{array}
if d < -7.9999999999999997e99 or 1.05e47 < d Initial program 41.2%
Taylor expanded in c around 0 72.0%
associate-*r/72.0%
neg-mul-172.0%
Simplified72.0%
neg-sub072.0%
sub-neg72.0%
add-sqr-sqrt33.8%
sqrt-unprod38.9%
sqr-neg38.9%
sqrt-unprod12.7%
add-sqr-sqrt24.3%
Applied egg-rr24.3%
+-lft-identity24.3%
Simplified24.3%
if -7.9999999999999997e99 < d < 1.05e47Initial program 78.7%
fma-define78.7%
*-un-lft-identity78.7%
add-sqr-sqrt78.7%
times-frac78.7%
fma-define78.7%
hypot-define78.7%
fmm-def78.7%
distribute-rgt-neg-in78.7%
fma-define78.7%
hypot-define87.3%
Applied egg-rr87.3%
Taylor expanded in c around inf 43.0%
mul-1-neg43.0%
unsub-neg43.0%
*-commutative43.0%
Simplified43.0%
Taylor expanded in d around -inf 9.9%
Final simplification15.5%
(FPCore (a b c d) :precision binary64 (/ a c))
double code(double a, double b, double c, double d) {
return a / c;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = a / c
end function
public static double code(double a, double b, double c, double d) {
return a / c;
}
def code(a, b, c, d): return a / c
function code(a, b, c, d) return Float64(a / c) end
function tmp = code(a, b, c, d) tmp = a / c; end
code[a_, b_, c_, d_] := N[(a / c), $MachinePrecision]
\begin{array}{l}
\\
\frac{a}{c}
\end{array}
Initial program 64.2%
fma-define64.2%
*-un-lft-identity64.2%
add-sqr-sqrt64.2%
times-frac64.2%
fma-define64.2%
hypot-define64.2%
fmm-def64.2%
distribute-rgt-neg-in64.2%
fma-define64.2%
hypot-define76.9%
Applied egg-rr76.9%
Taylor expanded in c around inf 32.2%
mul-1-neg32.2%
unsub-neg32.2%
*-commutative32.2%
Simplified32.2%
Taylor expanded in d around -inf 9.7%
(FPCore (a b c d) :precision binary64 (if (< (fabs d) (fabs c)) (/ (- b (* a (/ d c))) (+ c (* d (/ d c)))) (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d))))))
double code(double a, double b, double c, double d) {
double tmp;
if (fabs(d) < fabs(c)) {
tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
} else {
tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if (abs(d) < abs(c)) then
tmp = (b - (a * (d / c))) / (c + (d * (d / c)))
else
tmp = (-a + (b * (c / d))) / (d + (c * (c / d)))
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if (Math.abs(d) < Math.abs(c)) {
tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
} else {
tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if math.fabs(d) < math.fabs(c): tmp = (b - (a * (d / c))) / (c + (d * (d / c))) else: tmp = (-a + (b * (c / d))) / (d + (c * (c / d))) return tmp
function code(a, b, c, d) tmp = 0.0 if (abs(d) < abs(c)) tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / Float64(c + Float64(d * Float64(d / c)))); else tmp = Float64(Float64(Float64(-a) + Float64(b * Float64(c / d))) / Float64(d + Float64(c * Float64(c / d)))); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (abs(d) < abs(c)) tmp = (b - (a * (d / c))) / (c + (d * (d / c))); else tmp = (-a + (b * (c / d))) / (d + (c * (c / d))); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Less[N[Abs[d], $MachinePrecision], N[Abs[c], $MachinePrecision]], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c + N[(d * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-a) + N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d + N[(c * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|d\right| < \left|c\right|:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-a\right) + b \cdot \frac{c}{d}}{d + c \cdot \frac{c}{d}}\\
\end{array}
\end{array}
herbie shell --seed 2024117
(FPCore (a b c d)
:name "Complex division, imag part"
:precision binary64
:alt
(! :herbie-platform default (if (< (fabs d) (fabs c)) (/ (- b (* a (/ d c))) (+ c (* d (/ d c)))) (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d))))))
(/ (- (* b c) (* a d)) (+ (* c c) (* d d))))