
(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 13 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 (- (* (/ 1.0 (hypot c d)) (/ c (/ (hypot c d) b))) (/ (* d (/ a (hypot c d))) (hypot c d))))
double code(double a, double b, double c, double d) {
return ((1.0 / hypot(c, d)) * (c / (hypot(c, d) / b))) - ((d * (a / hypot(c, d))) / hypot(c, d));
}
public static double code(double a, double b, double c, double d) {
return ((1.0 / Math.hypot(c, d)) * (c / (Math.hypot(c, d) / b))) - ((d * (a / Math.hypot(c, d))) / Math.hypot(c, d));
}
def code(a, b, c, d): return ((1.0 / math.hypot(c, d)) * (c / (math.hypot(c, d) / b))) - ((d * (a / math.hypot(c, d))) / math.hypot(c, d))
function code(a, b, c, d) return Float64(Float64(Float64(1.0 / hypot(c, d)) * Float64(c / Float64(hypot(c, d) / b))) - Float64(Float64(d * Float64(a / hypot(c, d))) / hypot(c, d))) end
function tmp = code(a, b, c, d) tmp = ((1.0 / hypot(c, d)) * (c / (hypot(c, d) / b))) - ((d * (a / hypot(c, d))) / hypot(c, d)); end
code[a_, b_, c_, d_] := N[(N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(c / N[(N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(d * N[(a / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - \frac{d \cdot \frac{a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}
\end{array}
Initial program 60.4%
div-sub59.1%
sub-neg59.1%
*-un-lft-identity59.1%
add-sqr-sqrt59.1%
times-frac59.1%
fma-def59.1%
hypot-def59.1%
hypot-def64.5%
associate-/l*67.5%
add-sqr-sqrt67.5%
pow267.5%
hypot-def67.5%
Applied egg-rr67.5%
fma-neg67.5%
*-commutative67.5%
associate-/l*81.2%
associate-/r/77.9%
*-commutative77.9%
Simplified77.9%
*-un-lft-identity77.9%
unpow277.9%
times-frac85.6%
Applied egg-rr85.6%
associate-*l/85.7%
*-lft-identity85.7%
Simplified85.7%
associate-*r/98.3%
Applied egg-rr98.3%
Final simplification98.3%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* c b) (* d a)))
(t_1 (/ 1.0 (hypot c d)))
(t_2 (/ t_0 (+ (* c c) (* d d))))
(t_3 (/ a (hypot c d))))
(if (<= t_2 -5e+245)
(- (/ b c) (/ (* d t_3) (hypot c d)))
(if (<= t_2 2e+236)
(* t_1 (/ t_0 (hypot c d)))
(- (* t_1 (/ c (/ (hypot c d) b))) (* d (/ t_3 (hypot c d))))))))
double code(double a, double b, double c, double d) {
double t_0 = (c * b) - (d * a);
double t_1 = 1.0 / hypot(c, d);
double t_2 = t_0 / ((c * c) + (d * d));
double t_3 = a / hypot(c, d);
double tmp;
if (t_2 <= -5e+245) {
tmp = (b / c) - ((d * t_3) / hypot(c, d));
} else if (t_2 <= 2e+236) {
tmp = t_1 * (t_0 / hypot(c, d));
} else {
tmp = (t_1 * (c / (hypot(c, d) / b))) - (d * (t_3 / hypot(c, d)));
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = (c * b) - (d * a);
double t_1 = 1.0 / Math.hypot(c, d);
double t_2 = t_0 / ((c * c) + (d * d));
double t_3 = a / Math.hypot(c, d);
double tmp;
if (t_2 <= -5e+245) {
tmp = (b / c) - ((d * t_3) / Math.hypot(c, d));
} else if (t_2 <= 2e+236) {
tmp = t_1 * (t_0 / Math.hypot(c, d));
} else {
tmp = (t_1 * (c / (Math.hypot(c, d) / b))) - (d * (t_3 / Math.hypot(c, d)));
}
return tmp;
}
def code(a, b, c, d): t_0 = (c * b) - (d * a) t_1 = 1.0 / math.hypot(c, d) t_2 = t_0 / ((c * c) + (d * d)) t_3 = a / math.hypot(c, d) tmp = 0 if t_2 <= -5e+245: tmp = (b / c) - ((d * t_3) / math.hypot(c, d)) elif t_2 <= 2e+236: tmp = t_1 * (t_0 / math.hypot(c, d)) else: tmp = (t_1 * (c / (math.hypot(c, d) / b))) - (d * (t_3 / math.hypot(c, d))) return tmp
function code(a, b, c, d) t_0 = Float64(Float64(c * b) - Float64(d * a)) t_1 = Float64(1.0 / hypot(c, d)) t_2 = Float64(t_0 / Float64(Float64(c * c) + Float64(d * d))) t_3 = Float64(a / hypot(c, d)) tmp = 0.0 if (t_2 <= -5e+245) tmp = Float64(Float64(b / c) - Float64(Float64(d * t_3) / hypot(c, d))); elseif (t_2 <= 2e+236) tmp = Float64(t_1 * Float64(t_0 / hypot(c, d))); else tmp = Float64(Float64(t_1 * Float64(c / Float64(hypot(c, d) / b))) - Float64(d * Float64(t_3 / hypot(c, d)))); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (c * b) - (d * a); t_1 = 1.0 / hypot(c, d); t_2 = t_0 / ((c * c) + (d * d)); t_3 = a / hypot(c, d); tmp = 0.0; if (t_2 <= -5e+245) tmp = (b / c) - ((d * t_3) / hypot(c, d)); elseif (t_2 <= 2e+236) tmp = t_1 * (t_0 / hypot(c, d)); else tmp = (t_1 * (c / (hypot(c, d) / b))) - (d * (t_3 / hypot(c, d))); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(a / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+245], N[(N[(b / c), $MachinePrecision] - N[(N[(d * t$95$3), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+236], N[(t$95$1 * N[(t$95$0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[(c / N[(N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(d * N[(t$95$3 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot b - d \cdot a\\
t_1 := \frac{1}{\mathsf{hypot}\left(c, d\right)}\\
t_2 := \frac{t\_0}{c \cdot c + d \cdot d}\\
t_3 := \frac{a}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+245}:\\
\;\;\;\;\frac{b}{c} - \frac{d \cdot t\_3}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+236}:\\
\;\;\;\;t\_1 \cdot \frac{t\_0}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}} - d \cdot \frac{t\_3}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < -5.00000000000000034e245Initial program 45.9%
div-sub35.4%
sub-neg35.4%
*-un-lft-identity35.4%
add-sqr-sqrt35.4%
times-frac35.4%
fma-def35.4%
hypot-def35.4%
hypot-def41.2%
associate-/l*50.2%
add-sqr-sqrt50.2%
pow250.2%
hypot-def50.2%
Applied egg-rr50.2%
fma-neg50.2%
*-commutative50.2%
associate-/l*81.7%
associate-/r/77.0%
*-commutative77.0%
Simplified77.0%
*-un-lft-identity77.0%
unpow277.0%
times-frac81.9%
Applied egg-rr81.9%
associate-*l/81.9%
*-lft-identity81.9%
Simplified81.9%
associate-*r/95.4%
Applied egg-rr95.4%
Taylor expanded in c around inf 90.9%
if -5.00000000000000034e245 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < 2.00000000000000011e236Initial program 84.8%
*-un-lft-identity84.8%
add-sqr-sqrt84.8%
times-frac84.8%
hypot-def84.8%
hypot-def98.4%
Applied egg-rr98.4%
if 2.00000000000000011e236 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) Initial program 10.5%
div-sub8.8%
sub-neg8.8%
*-un-lft-identity8.8%
add-sqr-sqrt8.8%
times-frac8.8%
fma-def8.8%
hypot-def8.8%
hypot-def11.6%
associate-/l*18.1%
add-sqr-sqrt18.1%
pow218.1%
hypot-def18.1%
Applied egg-rr18.1%
fma-neg18.1%
*-commutative18.1%
associate-/l*60.6%
associate-/r/60.6%
*-commutative60.6%
Simplified60.6%
*-un-lft-identity60.6%
unpow260.6%
times-frac81.3%
Applied egg-rr81.3%
associate-*l/81.4%
*-lft-identity81.4%
Simplified81.4%
Final simplification92.9%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (* (/ 1.0 (hypot c d)) (/ c (/ (hypot c d) b))))
(t_1 (- t_0 (/ a d))))
(if (<= d -1.42e-26)
t_1
(if (<= d 1.1e-155)
(- (/ b c) (/ (* d (/ a (hypot c d))) (hypot c d)))
(if (<= d 1.8e+89) (- t_0 (* d (/ a (pow (hypot c d) 2.0)))) t_1)))))
double code(double a, double b, double c, double d) {
double t_0 = (1.0 / hypot(c, d)) * (c / (hypot(c, d) / b));
double t_1 = t_0 - (a / d);
double tmp;
if (d <= -1.42e-26) {
tmp = t_1;
} else if (d <= 1.1e-155) {
tmp = (b / c) - ((d * (a / hypot(c, d))) / hypot(c, d));
} else if (d <= 1.8e+89) {
tmp = t_0 - (d * (a / pow(hypot(c, d), 2.0)));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = (1.0 / Math.hypot(c, d)) * (c / (Math.hypot(c, d) / b));
double t_1 = t_0 - (a / d);
double tmp;
if (d <= -1.42e-26) {
tmp = t_1;
} else if (d <= 1.1e-155) {
tmp = (b / c) - ((d * (a / Math.hypot(c, d))) / Math.hypot(c, d));
} else if (d <= 1.8e+89) {
tmp = t_0 - (d * (a / Math.pow(Math.hypot(c, d), 2.0)));
} else {
tmp = t_1;
}
return tmp;
}
def code(a, b, c, d): t_0 = (1.0 / math.hypot(c, d)) * (c / (math.hypot(c, d) / b)) t_1 = t_0 - (a / d) tmp = 0 if d <= -1.42e-26: tmp = t_1 elif d <= 1.1e-155: tmp = (b / c) - ((d * (a / math.hypot(c, d))) / math.hypot(c, d)) elif d <= 1.8e+89: tmp = t_0 - (d * (a / math.pow(math.hypot(c, d), 2.0))) else: tmp = t_1 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(1.0 / hypot(c, d)) * Float64(c / Float64(hypot(c, d) / b))) t_1 = Float64(t_0 - Float64(a / d)) tmp = 0.0 if (d <= -1.42e-26) tmp = t_1; elseif (d <= 1.1e-155) tmp = Float64(Float64(b / c) - Float64(Float64(d * Float64(a / hypot(c, d))) / hypot(c, d))); elseif (d <= 1.8e+89) tmp = Float64(t_0 - Float64(d * Float64(a / (hypot(c, d) ^ 2.0)))); else tmp = t_1; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (1.0 / hypot(c, d)) * (c / (hypot(c, d) / b)); t_1 = t_0 - (a / d); tmp = 0.0; if (d <= -1.42e-26) tmp = t_1; elseif (d <= 1.1e-155) tmp = (b / c) - ((d * (a / hypot(c, d))) / hypot(c, d)); elseif (d <= 1.8e+89) tmp = t_0 - (d * (a / (hypot(c, d) ^ 2.0))); else tmp = t_1; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(c / N[(N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(a / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.42e-26], t$95$1, If[LessEqual[d, 1.1e-155], N[(N[(b / c), $MachinePrecision] - N[(N[(d * N[(a / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.8e+89], N[(t$95$0 - N[(d * N[(a / N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c}{\frac{\mathsf{hypot}\left(c, d\right)}{b}}\\
t_1 := t\_0 - \frac{a}{d}\\
\mathbf{if}\;d \leq -1.42 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d \leq 1.1 \cdot 10^{-155}:\\
\;\;\;\;\frac{b}{c} - \frac{d \cdot \frac{a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;d \leq 1.8 \cdot 10^{+89}:\\
\;\;\;\;t\_0 - d \cdot \frac{a}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d < -1.42e-26 or 1.8e89 < d Initial program 46.9%
div-sub46.9%
sub-neg46.9%
*-un-lft-identity46.9%
add-sqr-sqrt46.9%
times-frac46.9%
fma-def46.9%
hypot-def46.9%
hypot-def51.3%
associate-/l*56.6%
add-sqr-sqrt56.6%
pow256.6%
hypot-def56.6%
Applied egg-rr56.6%
fma-neg56.6%
*-commutative56.6%
associate-/l*69.1%
associate-/r/65.7%
*-commutative65.7%
Simplified65.7%
Taylor expanded in d around inf 89.3%
if -1.42e-26 < d < 1.1e-155Initial program 73.6%
div-sub69.7%
sub-neg69.7%
*-un-lft-identity69.7%
add-sqr-sqrt69.7%
times-frac69.8%
fma-def69.8%
hypot-def69.8%
hypot-def78.5%
associate-/l*78.5%
add-sqr-sqrt78.5%
pow278.5%
hypot-def78.5%
Applied egg-rr78.5%
fma-neg78.5%
*-commutative78.5%
associate-/l*88.6%
associate-/r/83.3%
*-commutative83.3%
Simplified83.3%
*-un-lft-identity83.3%
unpow283.3%
times-frac86.6%
Applied egg-rr86.6%
associate-*l/86.5%
*-lft-identity86.5%
Simplified86.5%
associate-*r/98.0%
Applied egg-rr98.0%
Taylor expanded in c around inf 95.7%
if 1.1e-155 < d < 1.8e89Initial program 65.4%
div-sub65.4%
sub-neg65.4%
*-un-lft-identity65.4%
add-sqr-sqrt65.4%
times-frac65.4%
fma-def65.3%
hypot-def65.4%
hypot-def67.8%
associate-/l*71.3%
add-sqr-sqrt71.3%
pow271.3%
hypot-def71.3%
Applied egg-rr71.3%
fma-neg71.3%
*-commutative71.3%
associate-/l*92.5%
associate-/r/92.5%
*-commutative92.5%
Simplified92.5%
Final simplification92.3%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* c b) (* d a))) (t_1 (/ t_0 (+ (* c c) (* d d)))))
(if (or (<= t_1 -5e+245) (not (<= t_1 2e+236)))
(- (/ b c) (/ (* d (/ a (hypot c d))) (hypot c d)))
(* (/ 1.0 (hypot c d)) (/ t_0 (hypot c d))))))
double code(double a, double b, double c, double d) {
double t_0 = (c * b) - (d * a);
double t_1 = t_0 / ((c * c) + (d * d));
double tmp;
if ((t_1 <= -5e+245) || !(t_1 <= 2e+236)) {
tmp = (b / c) - ((d * (a / hypot(c, d))) / hypot(c, d));
} else {
tmp = (1.0 / hypot(c, d)) * (t_0 / hypot(c, d));
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = (c * b) - (d * a);
double t_1 = t_0 / ((c * c) + (d * d));
double tmp;
if ((t_1 <= -5e+245) || !(t_1 <= 2e+236)) {
tmp = (b / c) - ((d * (a / Math.hypot(c, d))) / Math.hypot(c, d));
} else {
tmp = (1.0 / Math.hypot(c, d)) * (t_0 / Math.hypot(c, d));
}
return tmp;
}
def code(a, b, c, d): t_0 = (c * b) - (d * a) t_1 = t_0 / ((c * c) + (d * d)) tmp = 0 if (t_1 <= -5e+245) or not (t_1 <= 2e+236): tmp = (b / c) - ((d * (a / math.hypot(c, d))) / math.hypot(c, d)) else: tmp = (1.0 / math.hypot(c, d)) * (t_0 / math.hypot(c, d)) return tmp
function code(a, b, c, d) t_0 = Float64(Float64(c * b) - Float64(d * a)) t_1 = Float64(t_0 / Float64(Float64(c * c) + Float64(d * d))) tmp = 0.0 if ((t_1 <= -5e+245) || !(t_1 <= 2e+236)) tmp = Float64(Float64(b / c) - Float64(Float64(d * Float64(a / hypot(c, d))) / hypot(c, d))); else tmp = Float64(Float64(1.0 / hypot(c, d)) * Float64(t_0 / hypot(c, d))); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (c * b) - (d * a); t_1 = t_0 / ((c * c) + (d * d)); tmp = 0.0; if ((t_1 <= -5e+245) || ~((t_1 <= 2e+236))) tmp = (b / c) - ((d * (a / hypot(c, d))) / hypot(c, d)); else tmp = (1.0 / hypot(c, d)) * (t_0 / hypot(c, d)); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+245], N[Not[LessEqual[t$95$1, 2e+236]], $MachinePrecision]], N[(N[(b / c), $MachinePrecision] - N[(N[(d * N[(a / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot b - d \cdot a\\
t_1 := \frac{t\_0}{c \cdot c + d \cdot d}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+245} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+236}\right):\\
\;\;\;\;\frac{b}{c} - \frac{d \cdot \frac{a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t\_0}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < -5.00000000000000034e245 or 2.00000000000000011e236 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) Initial program 18.4%
div-sub14.7%
sub-neg14.7%
*-un-lft-identity14.7%
add-sqr-sqrt14.7%
times-frac14.7%
fma-def14.7%
hypot-def14.7%
hypot-def18.2%
associate-/l*25.3%
add-sqr-sqrt25.3%
pow225.3%
hypot-def25.3%
Applied egg-rr25.3%
fma-neg25.3%
*-commutative25.3%
associate-/l*65.3%
associate-/r/64.2%
*-commutative64.2%
Simplified64.2%
*-un-lft-identity64.2%
unpow264.2%
times-frac81.5%
Applied egg-rr81.5%
associate-*l/81.5%
*-lft-identity81.5%
Simplified81.5%
associate-*r/98.8%
Applied egg-rr98.8%
Taylor expanded in c around inf 77.4%
if -5.00000000000000034e245 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < 2.00000000000000011e236Initial program 84.8%
*-un-lft-identity84.8%
add-sqr-sqrt84.8%
times-frac84.8%
hypot-def84.8%
hypot-def98.4%
Applied egg-rr98.4%
Final simplification90.7%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (* (pow (hypot c d) -2.0) (- (* c b) (* d a)))))
(if (<= c -7.2)
(- (/ b c) (* d (/ a (pow c 2.0))))
(if (<= c -1.55e-154)
t_0
(if (<= c 1.7e-125)
(- (/ (* b (/ c d)) d) (/ a d))
(if (<= c 5.6e+80) t_0 (/ b c)))))))
double code(double a, double b, double c, double d) {
double t_0 = pow(hypot(c, d), -2.0) * ((c * b) - (d * a));
double tmp;
if (c <= -7.2) {
tmp = (b / c) - (d * (a / pow(c, 2.0)));
} else if (c <= -1.55e-154) {
tmp = t_0;
} else if (c <= 1.7e-125) {
tmp = ((b * (c / d)) / d) - (a / d);
} else if (c <= 5.6e+80) {
tmp = t_0;
} else {
tmp = b / c;
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = Math.pow(Math.hypot(c, d), -2.0) * ((c * b) - (d * a));
double tmp;
if (c <= -7.2) {
tmp = (b / c) - (d * (a / Math.pow(c, 2.0)));
} else if (c <= -1.55e-154) {
tmp = t_0;
} else if (c <= 1.7e-125) {
tmp = ((b * (c / d)) / d) - (a / d);
} else if (c <= 5.6e+80) {
tmp = t_0;
} else {
tmp = b / c;
}
return tmp;
}
def code(a, b, c, d): t_0 = math.pow(math.hypot(c, d), -2.0) * ((c * b) - (d * a)) tmp = 0 if c <= -7.2: tmp = (b / c) - (d * (a / math.pow(c, 2.0))) elif c <= -1.55e-154: tmp = t_0 elif c <= 1.7e-125: tmp = ((b * (c / d)) / d) - (a / d) elif c <= 5.6e+80: tmp = t_0 else: tmp = b / c return tmp
function code(a, b, c, d) t_0 = Float64((hypot(c, d) ^ -2.0) * Float64(Float64(c * b) - Float64(d * a))) tmp = 0.0 if (c <= -7.2) tmp = Float64(Float64(b / c) - Float64(d * Float64(a / (c ^ 2.0)))); elseif (c <= -1.55e-154) tmp = t_0; elseif (c <= 1.7e-125) tmp = Float64(Float64(Float64(b * Float64(c / d)) / d) - Float64(a / d)); elseif (c <= 5.6e+80) tmp = t_0; else tmp = Float64(b / c); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (hypot(c, d) ^ -2.0) * ((c * b) - (d * a)); tmp = 0.0; if (c <= -7.2) tmp = (b / c) - (d * (a / (c ^ 2.0))); elseif (c <= -1.55e-154) tmp = t_0; elseif (c <= 1.7e-125) tmp = ((b * (c / d)) / d) - (a / d); elseif (c <= 5.6e+80) tmp = t_0; else tmp = b / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], -2.0], $MachinePrecision] * N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -7.2], N[(N[(b / c), $MachinePrecision] - N[(d * N[(a / N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -1.55e-154], t$95$0, If[LessEqual[c, 1.7e-125], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 5.6e+80], t$95$0, N[(b / c), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(c, d\right)\right)}^{-2} \cdot \left(c \cdot b - d \cdot a\right)\\
\mathbf{if}\;c \leq -7.2:\\
\;\;\;\;\frac{b}{c} - d \cdot \frac{a}{{c}^{2}}\\
\mathbf{elif}\;c \leq -1.55 \cdot 10^{-154}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;c \leq 1.7 \cdot 10^{-125}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d}}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 5.6 \cdot 10^{+80}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\end{array}
if c < -7.20000000000000018Initial program 48.8%
Taylor expanded in c around inf 73.9%
+-commutative73.9%
mul-1-neg73.9%
unsub-neg73.9%
associate-/l*72.9%
associate-/r/75.6%
Simplified75.6%
if -7.20000000000000018 < c < -1.54999999999999991e-154 or 1.69999999999999988e-125 < c < 5.59999999999999969e80Initial program 84.6%
add-sqr-sqrt52.1%
pow252.1%
sqrt-div45.0%
hypot-def45.1%
Applied egg-rr45.1%
expm1-log1p-u42.9%
expm1-udef34.5%
Applied egg-rr42.6%
expm1-def59.8%
expm1-log1p85.6%
*-commutative85.6%
*-commutative85.6%
Simplified85.6%
if -1.54999999999999991e-154 < c < 1.69999999999999988e-125Initial program 64.6%
Taylor expanded in c around 0 62.7%
*-un-lft-identity62.7%
unpow262.7%
times-frac73.5%
*-commutative73.5%
*-commutative73.5%
Applied egg-rr73.5%
associate-*l/73.6%
*-un-lft-identity73.6%
div-sub73.6%
div-sub73.6%
associate-/l*70.7%
*-un-lft-identity70.7%
times-frac87.6%
/-rgt-identity87.6%
Applied egg-rr87.6%
associate-/r/90.5%
associate-*r/73.6%
*-lft-identity73.6%
associate-*l/73.5%
associate-*r*90.4%
lft-mult-inverse90.5%
*-lft-identity90.5%
Simplified90.5%
if 5.59999999999999969e80 < c Initial program 32.8%
Taylor expanded in c around inf 82.7%
Final simplification83.7%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (/ b c) (* d (/ (/ a (hypot c d)) (hypot c d))))))
(if (<= c -1.3e-31)
t_0
(if (<= c 8.5e-121)
(- (/ (* b (/ c d)) d) (/ a d))
(if (<= c 2.2e+78)
(* (pow (hypot c d) -2.0) (- (* c b) (* d a)))
t_0)))))
double code(double a, double b, double c, double d) {
double t_0 = (b / c) - (d * ((a / hypot(c, d)) / hypot(c, d)));
double tmp;
if (c <= -1.3e-31) {
tmp = t_0;
} else if (c <= 8.5e-121) {
tmp = ((b * (c / d)) / d) - (a / d);
} else if (c <= 2.2e+78) {
tmp = pow(hypot(c, d), -2.0) * ((c * b) - (d * a));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = (b / c) - (d * ((a / Math.hypot(c, d)) / Math.hypot(c, d)));
double tmp;
if (c <= -1.3e-31) {
tmp = t_0;
} else if (c <= 8.5e-121) {
tmp = ((b * (c / d)) / d) - (a / d);
} else if (c <= 2.2e+78) {
tmp = Math.pow(Math.hypot(c, d), -2.0) * ((c * b) - (d * a));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, c, d): t_0 = (b / c) - (d * ((a / math.hypot(c, d)) / math.hypot(c, d))) tmp = 0 if c <= -1.3e-31: tmp = t_0 elif c <= 8.5e-121: tmp = ((b * (c / d)) / d) - (a / d) elif c <= 2.2e+78: tmp = math.pow(math.hypot(c, d), -2.0) * ((c * b) - (d * a)) else: tmp = t_0 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(b / c) - Float64(d * Float64(Float64(a / hypot(c, d)) / hypot(c, d)))) tmp = 0.0 if (c <= -1.3e-31) tmp = t_0; elseif (c <= 8.5e-121) tmp = Float64(Float64(Float64(b * Float64(c / d)) / d) - Float64(a / d)); elseif (c <= 2.2e+78) tmp = Float64((hypot(c, d) ^ -2.0) * Float64(Float64(c * b) - Float64(d * a))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (b / c) - (d * ((a / hypot(c, d)) / hypot(c, d))); tmp = 0.0; if (c <= -1.3e-31) tmp = t_0; elseif (c <= 8.5e-121) tmp = ((b * (c / d)) / d) - (a / d); elseif (c <= 2.2e+78) tmp = (hypot(c, d) ^ -2.0) * ((c * b) - (d * a)); else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b / c), $MachinePrecision] - N[(d * N[(N[(a / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1.3e-31], t$95$0, If[LessEqual[c, 8.5e-121], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.2e+78], N[(N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], -2.0], $MachinePrecision] * N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{c} - d \cdot \frac{\frac{a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;c \leq -1.3 \cdot 10^{-31}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;c \leq 8.5 \cdot 10^{-121}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d}}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 2.2 \cdot 10^{+78}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(c, d\right)\right)}^{-2} \cdot \left(c \cdot b - d \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if c < -1.29999999999999998e-31 or 2.20000000000000014e78 < c Initial program 44.9%
div-sub44.9%
sub-neg44.9%
*-un-lft-identity44.9%
add-sqr-sqrt44.9%
times-frac44.9%
fma-def44.9%
hypot-def44.9%
hypot-def52.8%
associate-/l*53.9%
add-sqr-sqrt53.9%
pow253.9%
hypot-def53.9%
Applied egg-rr53.9%
fma-neg54.0%
*-commutative54.0%
associate-/l*83.5%
associate-/r/84.3%
*-commutative84.3%
Simplified84.3%
*-un-lft-identity84.3%
unpow284.3%
times-frac91.6%
Applied egg-rr91.6%
associate-*l/91.6%
*-lft-identity91.6%
Simplified91.6%
Taylor expanded in c around inf 87.4%
if -1.29999999999999998e-31 < c < 8.50000000000000025e-121Initial program 72.1%
Taylor expanded in c around 0 62.2%
*-un-lft-identity62.2%
unpow262.2%
times-frac70.2%
*-commutative70.2%
*-commutative70.2%
Applied egg-rr70.2%
associate-*l/70.4%
*-un-lft-identity70.4%
div-sub70.4%
div-sub70.3%
associate-/l*68.2%
*-un-lft-identity68.2%
times-frac83.0%
/-rgt-identity83.0%
Applied egg-rr83.0%
associate-/r/85.1%
associate-*r/70.3%
*-lft-identity70.3%
associate-*l/70.3%
associate-*r*85.0%
lft-mult-inverse85.1%
*-lft-identity85.1%
Simplified85.1%
if 8.50000000000000025e-121 < c < 2.20000000000000014e78Initial program 81.3%
add-sqr-sqrt45.2%
pow245.2%
sqrt-div35.8%
hypot-def35.9%
Applied egg-rr35.9%
expm1-log1p-u34.3%
expm1-udef29.1%
Applied egg-rr38.4%
expm1-def50.9%
expm1-log1p83.4%
*-commutative83.4%
*-commutative83.4%
Simplified83.4%
Final simplification86.0%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (/ b c) (/ (* d (/ a (hypot c d))) (hypot c d)))))
(if (<= c -3.9e-29)
t_0
(if (<= c 4.8e-126)
(- (/ (* b (/ c d)) d) (/ a d))
(if (<= c 2.05e+77)
(* (pow (hypot c d) -2.0) (- (* c b) (* d a)))
t_0)))))
double code(double a, double b, double c, double d) {
double t_0 = (b / c) - ((d * (a / hypot(c, d))) / hypot(c, d));
double tmp;
if (c <= -3.9e-29) {
tmp = t_0;
} else if (c <= 4.8e-126) {
tmp = ((b * (c / d)) / d) - (a / d);
} else if (c <= 2.05e+77) {
tmp = pow(hypot(c, d), -2.0) * ((c * b) - (d * a));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = (b / c) - ((d * (a / Math.hypot(c, d))) / Math.hypot(c, d));
double tmp;
if (c <= -3.9e-29) {
tmp = t_0;
} else if (c <= 4.8e-126) {
tmp = ((b * (c / d)) / d) - (a / d);
} else if (c <= 2.05e+77) {
tmp = Math.pow(Math.hypot(c, d), -2.0) * ((c * b) - (d * a));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, c, d): t_0 = (b / c) - ((d * (a / math.hypot(c, d))) / math.hypot(c, d)) tmp = 0 if c <= -3.9e-29: tmp = t_0 elif c <= 4.8e-126: tmp = ((b * (c / d)) / d) - (a / d) elif c <= 2.05e+77: tmp = math.pow(math.hypot(c, d), -2.0) * ((c * b) - (d * a)) else: tmp = t_0 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(b / c) - Float64(Float64(d * Float64(a / hypot(c, d))) / hypot(c, d))) tmp = 0.0 if (c <= -3.9e-29) tmp = t_0; elseif (c <= 4.8e-126) tmp = Float64(Float64(Float64(b * Float64(c / d)) / d) - Float64(a / d)); elseif (c <= 2.05e+77) tmp = Float64((hypot(c, d) ^ -2.0) * Float64(Float64(c * b) - Float64(d * a))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (b / c) - ((d * (a / hypot(c, d))) / hypot(c, d)); tmp = 0.0; if (c <= -3.9e-29) tmp = t_0; elseif (c <= 4.8e-126) tmp = ((b * (c / d)) / d) - (a / d); elseif (c <= 2.05e+77) tmp = (hypot(c, d) ^ -2.0) * ((c * b) - (d * a)); else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b / c), $MachinePrecision] - N[(N[(d * N[(a / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -3.9e-29], t$95$0, If[LessEqual[c, 4.8e-126], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.05e+77], N[(N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], -2.0], $MachinePrecision] * N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{c} - \frac{d \cdot \frac{a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;c \leq -3.9 \cdot 10^{-29}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;c \leq 4.8 \cdot 10^{-126}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d}}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 2.05 \cdot 10^{+77}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(c, d\right)\right)}^{-2} \cdot \left(c \cdot b - d \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if c < -3.8999999999999998e-29 or 2.05e77 < c Initial program 44.9%
div-sub44.9%
sub-neg44.9%
*-un-lft-identity44.9%
add-sqr-sqrt44.9%
times-frac44.9%
fma-def44.9%
hypot-def44.9%
hypot-def52.8%
associate-/l*53.9%
add-sqr-sqrt53.9%
pow253.9%
hypot-def53.9%
Applied egg-rr53.9%
fma-neg54.0%
*-commutative54.0%
associate-/l*83.5%
associate-/r/84.3%
*-commutative84.3%
Simplified84.3%
*-un-lft-identity84.3%
unpow284.3%
times-frac91.6%
Applied egg-rr91.6%
associate-*l/91.6%
*-lft-identity91.6%
Simplified91.6%
associate-*r/99.1%
Applied egg-rr99.1%
Taylor expanded in c around inf 90.7%
if -3.8999999999999998e-29 < c < 4.80000000000000014e-126Initial program 72.1%
Taylor expanded in c around 0 62.2%
*-un-lft-identity62.2%
unpow262.2%
times-frac70.2%
*-commutative70.2%
*-commutative70.2%
Applied egg-rr70.2%
associate-*l/70.4%
*-un-lft-identity70.4%
div-sub70.4%
div-sub70.3%
associate-/l*68.2%
*-un-lft-identity68.2%
times-frac83.0%
/-rgt-identity83.0%
Applied egg-rr83.0%
associate-/r/85.1%
associate-*r/70.3%
*-lft-identity70.3%
associate-*l/70.3%
associate-*r*85.0%
lft-mult-inverse85.1%
*-lft-identity85.1%
Simplified85.1%
if 4.80000000000000014e-126 < c < 2.05e77Initial program 81.3%
add-sqr-sqrt45.2%
pow245.2%
sqrt-div35.8%
hypot-def35.9%
Applied egg-rr35.9%
expm1-log1p-u34.3%
expm1-udef29.1%
Applied egg-rr38.4%
expm1-def50.9%
expm1-log1p83.4%
*-commutative83.4%
*-commutative83.4%
Simplified83.4%
Final simplification87.5%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (+ (* c c) (* d d)))))
(if (<= c -8.4e-10)
(- (/ b c) (* d (/ a (pow c 2.0))))
(if (<= c -1.38e-154)
t_0
(if (<= c 9.2e-126)
(- (/ (* b (/ c d)) d) (/ a d))
(if (<= c 6e+80) t_0 (/ b c)))))))
double code(double a, double b, double c, double d) {
double t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d));
double tmp;
if (c <= -8.4e-10) {
tmp = (b / c) - (d * (a / pow(c, 2.0)));
} else if (c <= -1.38e-154) {
tmp = t_0;
} else if (c <= 9.2e-126) {
tmp = ((b * (c / d)) / d) - (a / d);
} else if (c <= 6e+80) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d))
if (c <= (-8.4d-10)) then
tmp = (b / c) - (d * (a / (c ** 2.0d0)))
else if (c <= (-1.38d-154)) then
tmp = t_0
else if (c <= 9.2d-126) then
tmp = ((b * (c / d)) / d) - (a / d)
else if (c <= 6d+80) then
tmp = t_0
else
tmp = b / c
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 tmp;
if (c <= -8.4e-10) {
tmp = (b / c) - (d * (a / Math.pow(c, 2.0)));
} else if (c <= -1.38e-154) {
tmp = t_0;
} else if (c <= 9.2e-126) {
tmp = ((b * (c / d)) / d) - (a / d);
} else if (c <= 6e+80) {
tmp = t_0;
} else {
tmp = b / c;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d)) tmp = 0 if c <= -8.4e-10: tmp = (b / c) - (d * (a / math.pow(c, 2.0))) elif c <= -1.38e-154: tmp = t_0 elif c <= 9.2e-126: tmp = ((b * (c / d)) / d) - (a / d) elif c <= 6e+80: tmp = t_0 else: tmp = b / c 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))) tmp = 0.0 if (c <= -8.4e-10) tmp = Float64(Float64(b / c) - Float64(d * Float64(a / (c ^ 2.0)))); elseif (c <= -1.38e-154) tmp = t_0; elseif (c <= 9.2e-126) tmp = Float64(Float64(Float64(b * Float64(c / d)) / d) - Float64(a / d)); elseif (c <= 6e+80) tmp = t_0; else tmp = Float64(b / c); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d)); tmp = 0.0; if (c <= -8.4e-10) tmp = (b / c) - (d * (a / (c ^ 2.0))); elseif (c <= -1.38e-154) tmp = t_0; elseif (c <= 9.2e-126) tmp = ((b * (c / d)) / d) - (a / d); elseif (c <= 6e+80) tmp = t_0; else tmp = b / c; 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]}, If[LessEqual[c, -8.4e-10], N[(N[(b / c), $MachinePrecision] - N[(d * N[(a / N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -1.38e-154], t$95$0, If[LessEqual[c, 9.2e-126], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 6e+80], t$95$0, N[(b / c), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -8.4 \cdot 10^{-10}:\\
\;\;\;\;\frac{b}{c} - d \cdot \frac{a}{{c}^{2}}\\
\mathbf{elif}\;c \leq -1.38 \cdot 10^{-154}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;c \leq 9.2 \cdot 10^{-126}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d}}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 6 \cdot 10^{+80}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\end{array}
if c < -8.3999999999999999e-10Initial program 49.6%
Taylor expanded in c around inf 74.3%
+-commutative74.3%
mul-1-neg74.3%
unsub-neg74.3%
associate-/l*73.3%
associate-/r/76.0%
Simplified76.0%
if -8.3999999999999999e-10 < c < -1.37999999999999995e-154 or 9.20000000000000043e-126 < c < 5.99999999999999974e80Initial program 84.4%
if -1.37999999999999995e-154 < c < 9.20000000000000043e-126Initial program 64.6%
Taylor expanded in c around 0 62.7%
*-un-lft-identity62.7%
unpow262.7%
times-frac73.5%
*-commutative73.5%
*-commutative73.5%
Applied egg-rr73.5%
associate-*l/73.6%
*-un-lft-identity73.6%
div-sub73.6%
div-sub73.6%
associate-/l*70.7%
*-un-lft-identity70.7%
times-frac87.6%
/-rgt-identity87.6%
Applied egg-rr87.6%
associate-/r/90.5%
associate-*r/73.6%
*-lft-identity73.6%
associate-*l/73.5%
associate-*r*90.4%
lft-mult-inverse90.5%
*-lft-identity90.5%
Simplified90.5%
if 5.99999999999999974e80 < c Initial program 32.8%
Taylor expanded in c around inf 82.7%
Final simplification83.4%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (+ (* c c) (* d d)))))
(if (<= c -1.15e+103)
(/ b c)
(if (<= c -1.15e-156)
t_0
(if (<= c 6.5e-124)
(- (/ (* b (/ c d)) d) (/ a d))
(if (<= c 2.9e+79) t_0 (/ b c)))))))
double code(double a, double b, double c, double d) {
double t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d));
double tmp;
if (c <= -1.15e+103) {
tmp = b / c;
} else if (c <= -1.15e-156) {
tmp = t_0;
} else if (c <= 6.5e-124) {
tmp = ((b * (c / d)) / d) - (a / d);
} else if (c <= 2.9e+79) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d))
if (c <= (-1.15d+103)) then
tmp = b / c
else if (c <= (-1.15d-156)) then
tmp = t_0
else if (c <= 6.5d-124) then
tmp = ((b * (c / d)) / d) - (a / d)
else if (c <= 2.9d+79) then
tmp = t_0
else
tmp = b / c
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 tmp;
if (c <= -1.15e+103) {
tmp = b / c;
} else if (c <= -1.15e-156) {
tmp = t_0;
} else if (c <= 6.5e-124) {
tmp = ((b * (c / d)) / d) - (a / d);
} else if (c <= 2.9e+79) {
tmp = t_0;
} else {
tmp = b / c;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d)) tmp = 0 if c <= -1.15e+103: tmp = b / c elif c <= -1.15e-156: tmp = t_0 elif c <= 6.5e-124: tmp = ((b * (c / d)) / d) - (a / d) elif c <= 2.9e+79: tmp = t_0 else: tmp = b / c 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))) tmp = 0.0 if (c <= -1.15e+103) tmp = Float64(b / c); elseif (c <= -1.15e-156) tmp = t_0; elseif (c <= 6.5e-124) tmp = Float64(Float64(Float64(b * Float64(c / d)) / d) - Float64(a / d)); elseif (c <= 2.9e+79) tmp = t_0; else tmp = Float64(b / c); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d)); tmp = 0.0; if (c <= -1.15e+103) tmp = b / c; elseif (c <= -1.15e-156) tmp = t_0; elseif (c <= 6.5e-124) tmp = ((b * (c / d)) / d) - (a / d); elseif (c <= 2.9e+79) tmp = t_0; else tmp = b / c; 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]}, If[LessEqual[c, -1.15e+103], N[(b / c), $MachinePrecision], If[LessEqual[c, -1.15e-156], t$95$0, If[LessEqual[c, 6.5e-124], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.9e+79], t$95$0, N[(b / c), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -1.15 \cdot 10^{+103}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq -1.15 \cdot 10^{-156}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;c \leq 6.5 \cdot 10^{-124}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d}}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 2.9 \cdot 10^{+79}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\end{array}
if c < -1.15000000000000004e103 or 2.89999999999999992e79 < c Initial program 32.6%
Taylor expanded in c around inf 77.2%
if -1.15000000000000004e103 < c < -1.15e-156 or 6.49999999999999988e-124 < c < 2.89999999999999992e79Initial program 82.7%
if -1.15e-156 < c < 6.49999999999999988e-124Initial program 64.6%
Taylor expanded in c around 0 62.7%
*-un-lft-identity62.7%
unpow262.7%
times-frac73.5%
*-commutative73.5%
*-commutative73.5%
Applied egg-rr73.5%
associate-*l/73.6%
*-un-lft-identity73.6%
div-sub73.6%
div-sub73.6%
associate-/l*70.7%
*-un-lft-identity70.7%
times-frac87.6%
/-rgt-identity87.6%
Applied egg-rr87.6%
associate-/r/90.5%
associate-*r/73.6%
*-lft-identity73.6%
associate-*l/73.5%
associate-*r*90.4%
lft-mult-inverse90.5%
*-lft-identity90.5%
Simplified90.5%
Final simplification82.6%
(FPCore (a b c d) :precision binary64 (if (or (<= c -5e-26) (not (<= c 4.2e+80))) (/ b c) (- (/ (* b (/ c d)) d) (/ a d))))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -5e-26) || !(c <= 4.2e+80)) {
tmp = b / c;
} else {
tmp = ((b * (c / d)) / 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 ((c <= (-5d-26)) .or. (.not. (c <= 4.2d+80))) then
tmp = b / c
else
tmp = ((b * (c / d)) / d) - (a / d)
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -5e-26) || !(c <= 4.2e+80)) {
tmp = b / c;
} else {
tmp = ((b * (c / d)) / d) - (a / d);
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -5e-26) or not (c <= 4.2e+80): tmp = b / c else: tmp = ((b * (c / d)) / d) - (a / d) return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -5e-26) || !(c <= 4.2e+80)) tmp = Float64(b / c); else tmp = Float64(Float64(Float64(b * Float64(c / d)) / d) - Float64(a / d)); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((c <= -5e-26) || ~((c <= 4.2e+80))) tmp = b / c; else tmp = ((b * (c / d)) / d) - (a / d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -5e-26], N[Not[LessEqual[c, 4.2e+80]], $MachinePrecision]], N[(b / c), $MachinePrecision], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -5 \cdot 10^{-26} \lor \neg \left(c \leq 4.2 \cdot 10^{+80}\right):\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d}}{d} - \frac{a}{d}\\
\end{array}
\end{array}
if c < -5.00000000000000019e-26 or 4.20000000000000003e80 < c Initial program 44.0%
Taylor expanded in c around inf 72.3%
if -5.00000000000000019e-26 < c < 4.20000000000000003e80Initial program 74.9%
Taylor expanded in c around 0 58.0%
*-un-lft-identity58.0%
unpow258.0%
times-frac65.8%
*-commutative65.8%
*-commutative65.8%
Applied egg-rr65.8%
associate-*l/65.9%
*-un-lft-identity65.9%
div-sub65.9%
div-sub65.8%
associate-/l*64.3%
*-un-lft-identity64.3%
times-frac77.1%
/-rgt-identity77.1%
Applied egg-rr77.1%
associate-/r/78.6%
associate-*r/65.8%
*-lft-identity65.8%
associate-*l/65.8%
associate-*r*78.5%
lft-mult-inverse78.6%
*-lft-identity78.6%
Simplified78.6%
Final simplification75.7%
(FPCore (a b c d) :precision binary64 (if (or (<= c -1.4e-11) (not (<= c 2.4e+79))) (/ b c) (/ (- (* c (/ b d)) a) d)))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -1.4e-11) || !(c <= 2.4e+79)) {
tmp = b / 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 ((c <= (-1.4d-11)) .or. (.not. (c <= 2.4d+79))) then
tmp = b / 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 ((c <= -1.4e-11) || !(c <= 2.4e+79)) {
tmp = b / c;
} else {
tmp = ((c * (b / d)) - a) / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -1.4e-11) or not (c <= 2.4e+79): tmp = b / c else: tmp = ((c * (b / d)) - a) / d return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -1.4e-11) || !(c <= 2.4e+79)) tmp = Float64(b / 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 ((c <= -1.4e-11) || ~((c <= 2.4e+79))) tmp = b / c; else tmp = ((c * (b / d)) - a) / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -1.4e-11], N[Not[LessEqual[c, 2.4e+79]], $MachinePrecision]], N[(b / c), $MachinePrecision], N[(N[(N[(c * N[(b / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.4 \cdot 10^{-11} \lor \neg \left(c \leq 2.4 \cdot 10^{+79}\right):\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\
\end{array}
\end{array}
if c < -1.4e-11 or 2.39999999999999986e79 < c Initial program 42.5%
Taylor expanded in c around inf 73.2%
if -1.4e-11 < c < 2.39999999999999986e79Initial program 75.4%
Taylor expanded in c around 0 72.5%
+-commutative72.5%
mul-1-neg72.5%
unsub-neg72.5%
associate-/l*72.7%
associate-/r/71.3%
Simplified71.3%
*-un-lft-identity71.3%
unpow271.3%
times-frac72.8%
Applied egg-rr72.8%
associate-*l/72.8%
*-lft-identity72.8%
Simplified72.8%
associate-*l/75.7%
sub-div76.5%
Applied egg-rr76.5%
Final simplification75.0%
(FPCore (a b c d) :precision binary64 (if (or (<= d -2.05e-35) (not (<= d 1.4e+70))) (/ (- a) d) (/ b c)))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -2.05e-35) || !(d <= 1.4e+70)) {
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 <= (-2.05d-35)) .or. (.not. (d <= 1.4d+70))) 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 <= -2.05e-35) || !(d <= 1.4e+70)) {
tmp = -a / d;
} else {
tmp = b / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -2.05e-35) or not (d <= 1.4e+70): tmp = -a / d else: tmp = b / c return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -2.05e-35) || !(d <= 1.4e+70)) tmp = Float64(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 <= -2.05e-35) || ~((d <= 1.4e+70))) tmp = -a / d; else tmp = b / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -2.05e-35], N[Not[LessEqual[d, 1.4e+70]], $MachinePrecision]], N[((-a) / d), $MachinePrecision], N[(b / c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.05 \cdot 10^{-35} \lor \neg \left(d \leq 1.4 \cdot 10^{+70}\right):\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\end{array}
if d < -2.05000000000000013e-35 or 1.39999999999999995e70 < d Initial program 49.7%
Taylor expanded in c around 0 73.1%
associate-*r/73.1%
neg-mul-173.1%
Simplified73.1%
if -2.05000000000000013e-35 < d < 1.39999999999999995e70Initial program 69.4%
Taylor expanded in c around inf 65.4%
Final simplification68.9%
(FPCore (a b c d) :precision binary64 (/ b c))
double code(double a, double b, double c, double d) {
return b / 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 = b / c
end function
public static double code(double a, double b, double c, double d) {
return b / c;
}
def code(a, b, c, d): return b / c
function code(a, b, c, d) return Float64(b / c) end
function tmp = code(a, b, c, d) tmp = b / c; end
code[a_, b_, c_, d_] := N[(b / c), $MachinePrecision]
\begin{array}{l}
\\
\frac{b}{c}
\end{array}
Initial program 60.4%
Taylor expanded in c around inf 45.1%
Final simplification45.1%
(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 2024031
(FPCore (a b c d)
:name "Complex division, imag part"
:precision binary64
:herbie-target
(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))))