
(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 14 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 (- (* (/ c (hypot d c)) (/ b (hypot d c))) (/ a (* (hypot d c) (/ (hypot d c) d)))))
double code(double a, double b, double c, double d) {
return ((c / hypot(d, c)) * (b / hypot(d, c))) - (a / (hypot(d, c) * (hypot(d, c) / d)));
}
public static double code(double a, double b, double c, double d) {
return ((c / Math.hypot(d, c)) * (b / Math.hypot(d, c))) - (a / (Math.hypot(d, c) * (Math.hypot(d, c) / d)));
}
def code(a, b, c, d): return ((c / math.hypot(d, c)) * (b / math.hypot(d, c))) - (a / (math.hypot(d, c) * (math.hypot(d, c) / d)))
function code(a, b, c, d) return Float64(Float64(Float64(c / hypot(d, c)) * Float64(b / hypot(d, c))) - Float64(a / Float64(hypot(d, c) * Float64(hypot(d, c) / d)))) end
function tmp = code(a, b, c, d) tmp = ((c / hypot(d, c)) * (b / hypot(d, c))) - (a / (hypot(d, c) * (hypot(d, c) / d))); end
code[a_, b_, c_, d_] := N[(N[(N[(c / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision] * N[(b / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] * N[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{c}{\mathsf{hypot}\left(d, c\right)} \cdot \frac{b}{\mathsf{hypot}\left(d, c\right)} - \frac{a}{\mathsf{hypot}\left(d, c\right) \cdot \frac{\mathsf{hypot}\left(d, c\right)}{d}}
\end{array}
Initial program 62.9%
Taylor expanded in b around 0 62.9%
mul-1-neg62.9%
+-commutative62.9%
*-commutative62.9%
fma-def62.9%
distribute-rgt-neg-in62.9%
Simplified62.9%
Taylor expanded in b around 0 60.5%
+-commutative60.5%
mul-1-neg60.5%
unsub-neg60.5%
+-commutative60.5%
unpow260.5%
fma-udef60.5%
associate-/l*62.9%
+-commutative62.9%
unpow262.9%
fma-udef62.9%
Simplified62.9%
add-sqr-sqrt62.9%
*-un-lft-identity62.9%
times-frac62.9%
fma-udef62.9%
unpow262.9%
hypot-def62.9%
fma-udef62.9%
unpow262.9%
hypot-def73.1%
Applied egg-rr73.1%
*-commutative73.1%
add-sqr-sqrt73.1%
times-frac76.3%
fma-udef76.3%
unpow276.3%
hypot-def76.3%
fma-udef76.3%
unpow276.3%
hypot-def95.3%
Applied egg-rr95.3%
Final simplification95.3%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (hypot d c) d)))
(if (or (<= c -2e+138) (not (<= c 7e+60)))
(- (/ b c) (/ a (* (hypot d c) t_0)))
(+
(/ (* c b) (fma d d (pow c 2.0)))
(* (/ a t_0) (/ -1.0 (hypot d c)))))))
double code(double a, double b, double c, double d) {
double t_0 = hypot(d, c) / d;
double tmp;
if ((c <= -2e+138) || !(c <= 7e+60)) {
tmp = (b / c) - (a / (hypot(d, c) * t_0));
} else {
tmp = ((c * b) / fma(d, d, pow(c, 2.0))) + ((a / t_0) * (-1.0 / hypot(d, c)));
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(hypot(d, c) / d) tmp = 0.0 if ((c <= -2e+138) || !(c <= 7e+60)) tmp = Float64(Float64(b / c) - Float64(a / Float64(hypot(d, c) * t_0))); else tmp = Float64(Float64(Float64(c * b) / fma(d, d, (c ^ 2.0))) + Float64(Float64(a / t_0) * Float64(-1.0 / hypot(d, c)))); end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] / d), $MachinePrecision]}, If[Or[LessEqual[c, -2e+138], N[Not[LessEqual[c, 7e+60]], $MachinePrecision]], N[(N[(b / c), $MachinePrecision] - N[(a / N[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(c * b), $MachinePrecision] / N[(d * d + N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a / t$95$0), $MachinePrecision] * N[(-1.0 / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{hypot}\left(d, c\right)}{d}\\
\mathbf{if}\;c \leq -2 \cdot 10^{+138} \lor \neg \left(c \leq 7 \cdot 10^{+60}\right):\\
\;\;\;\;\frac{b}{c} - \frac{a}{\mathsf{hypot}\left(d, c\right) \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot b}{\mathsf{fma}\left(d, d, {c}^{2}\right)} + \frac{a}{t_0} \cdot \frac{-1}{\mathsf{hypot}\left(d, c\right)}\\
\end{array}
\end{array}
if c < -2.0000000000000001e138 or 7.0000000000000004e60 < c Initial program 30.4%
Taylor expanded in b around 0 30.4%
mul-1-neg30.4%
+-commutative30.4%
*-commutative30.4%
fma-def30.4%
distribute-rgt-neg-in30.4%
Simplified30.4%
Taylor expanded in b around 0 30.4%
+-commutative30.4%
mul-1-neg30.4%
unsub-neg30.4%
+-commutative30.4%
unpow230.4%
fma-udef30.4%
associate-/l*29.6%
+-commutative29.6%
unpow229.6%
fma-udef29.6%
Simplified29.6%
add-sqr-sqrt29.6%
*-un-lft-identity29.6%
times-frac29.6%
fma-udef29.6%
unpow229.6%
hypot-def29.6%
fma-udef29.6%
unpow229.6%
hypot-def38.7%
Applied egg-rr38.7%
Taylor expanded in c around inf 86.9%
if -2.0000000000000001e138 < c < 7.0000000000000004e60Initial program 78.6%
Taylor expanded in b around 0 78.6%
mul-1-neg78.6%
+-commutative78.6%
*-commutative78.6%
fma-def78.6%
distribute-rgt-neg-in78.6%
Simplified78.6%
Taylor expanded in b around 0 75.0%
+-commutative75.0%
mul-1-neg75.0%
unsub-neg75.0%
+-commutative75.0%
unpow275.0%
fma-udef75.0%
associate-/l*78.8%
+-commutative78.8%
unpow278.8%
fma-udef78.8%
Simplified78.8%
add-sqr-sqrt78.8%
*-un-lft-identity78.8%
times-frac78.9%
fma-udef78.9%
unpow278.9%
hypot-def78.9%
fma-udef78.9%
unpow278.9%
hypot-def89.7%
Applied egg-rr89.7%
/-rgt-identity89.7%
*-un-lft-identity89.7%
times-frac90.1%
Applied egg-rr90.1%
Final simplification89.1%
(FPCore (a b c d)
:precision binary64
(if (or (<= c -1.25e+137) (not (<= c 5.8e+60)))
(- (/ b c) (/ a (* (hypot d c) (/ (hypot d c) d))))
(-
(/ (* c b) (fma d d (pow c 2.0)))
(/ (* d (/ a (hypot d c))) (hypot d c)))))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -1.25e+137) || !(c <= 5.8e+60)) {
tmp = (b / c) - (a / (hypot(d, c) * (hypot(d, c) / d)));
} else {
tmp = ((c * b) / fma(d, d, pow(c, 2.0))) - ((d * (a / hypot(d, c))) / hypot(d, c));
}
return tmp;
}
function code(a, b, c, d) tmp = 0.0 if ((c <= -1.25e+137) || !(c <= 5.8e+60)) tmp = Float64(Float64(b / c) - Float64(a / Float64(hypot(d, c) * Float64(hypot(d, c) / d)))); else tmp = Float64(Float64(Float64(c * b) / fma(d, d, (c ^ 2.0))) - Float64(Float64(d * Float64(a / hypot(d, c))) / hypot(d, c))); end return tmp end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -1.25e+137], N[Not[LessEqual[c, 5.8e+60]], $MachinePrecision]], N[(N[(b / c), $MachinePrecision] - N[(a / N[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] * N[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(c * b), $MachinePrecision] / N[(d * d + N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(d * N[(a / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.25 \cdot 10^{+137} \lor \neg \left(c \leq 5.8 \cdot 10^{+60}\right):\\
\;\;\;\;\frac{b}{c} - \frac{a}{\mathsf{hypot}\left(d, c\right) \cdot \frac{\mathsf{hypot}\left(d, c\right)}{d}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot b}{\mathsf{fma}\left(d, d, {c}^{2}\right)} - \frac{d \cdot \frac{a}{\mathsf{hypot}\left(d, c\right)}}{\mathsf{hypot}\left(d, c\right)}\\
\end{array}
\end{array}
if c < -1.25e137 or 5.79999999999999999e60 < c Initial program 30.4%
Taylor expanded in b around 0 30.4%
mul-1-neg30.4%
+-commutative30.4%
*-commutative30.4%
fma-def30.4%
distribute-rgt-neg-in30.4%
Simplified30.4%
Taylor expanded in b around 0 30.4%
+-commutative30.4%
mul-1-neg30.4%
unsub-neg30.4%
+-commutative30.4%
unpow230.4%
fma-udef30.4%
associate-/l*29.6%
+-commutative29.6%
unpow229.6%
fma-udef29.6%
Simplified29.6%
add-sqr-sqrt29.6%
*-un-lft-identity29.6%
times-frac29.6%
fma-udef29.6%
unpow229.6%
hypot-def29.6%
fma-udef29.6%
unpow229.6%
hypot-def38.7%
Applied egg-rr38.7%
Taylor expanded in c around inf 86.9%
if -1.25e137 < c < 5.79999999999999999e60Initial program 78.6%
Taylor expanded in b around 0 78.6%
mul-1-neg78.6%
+-commutative78.6%
*-commutative78.6%
fma-def78.6%
distribute-rgt-neg-in78.6%
Simplified78.6%
Taylor expanded in b around 0 75.0%
+-commutative75.0%
mul-1-neg75.0%
unsub-neg75.0%
+-commutative75.0%
unpow275.0%
fma-udef75.0%
associate-/l*78.8%
+-commutative78.8%
unpow278.8%
fma-udef78.8%
Simplified78.8%
add-sqr-sqrt78.8%
*-un-lft-identity78.8%
times-frac78.9%
fma-udef78.9%
unpow278.9%
hypot-def78.9%
fma-udef78.9%
unpow278.9%
hypot-def89.7%
Applied egg-rr89.7%
/-rgt-identity89.7%
*-un-lft-identity89.7%
times-frac90.1%
Applied egg-rr90.1%
associate-*l/90.2%
*-lft-identity90.2%
associate-/r/89.6%
Simplified89.6%
Final simplification88.8%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ a (* (hypot d c) (/ (hypot d c) d)))))
(if (or (<= c -9e+88) (not (<= c 1.9e+60)))
(- (/ b c) t_0)
(- (/ (* c b) (fma d d (pow c 2.0))) t_0))))
double code(double a, double b, double c, double d) {
double t_0 = a / (hypot(d, c) * (hypot(d, c) / d));
double tmp;
if ((c <= -9e+88) || !(c <= 1.9e+60)) {
tmp = (b / c) - t_0;
} else {
tmp = ((c * b) / fma(d, d, pow(c, 2.0))) - t_0;
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(a / Float64(hypot(d, c) * Float64(hypot(d, c) / d))) tmp = 0.0 if ((c <= -9e+88) || !(c <= 1.9e+60)) tmp = Float64(Float64(b / c) - t_0); else tmp = Float64(Float64(Float64(c * b) / fma(d, d, (c ^ 2.0))) - t_0); end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(a / N[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] * N[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[c, -9e+88], N[Not[LessEqual[c, 1.9e+60]], $MachinePrecision]], N[(N[(b / c), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(c * b), $MachinePrecision] / N[(d * d + N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{\mathsf{hypot}\left(d, c\right) \cdot \frac{\mathsf{hypot}\left(d, c\right)}{d}}\\
\mathbf{if}\;c \leq -9 \cdot 10^{+88} \lor \neg \left(c \leq 1.9 \cdot 10^{+60}\right):\\
\;\;\;\;\frac{b}{c} - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot b}{\mathsf{fma}\left(d, d, {c}^{2}\right)} - t_0\\
\end{array}
\end{array}
if c < -9e88 or 1.90000000000000005e60 < c Initial program 35.5%
Taylor expanded in b around 0 35.5%
mul-1-neg35.5%
+-commutative35.5%
*-commutative35.5%
fma-def35.5%
distribute-rgt-neg-in35.5%
Simplified35.5%
Taylor expanded in b around 0 35.5%
+-commutative35.5%
mul-1-neg35.5%
unsub-neg35.5%
+-commutative35.5%
unpow235.5%
fma-udef35.5%
associate-/l*34.0%
+-commutative34.0%
unpow234.0%
fma-udef34.0%
Simplified34.0%
add-sqr-sqrt34.0%
*-un-lft-identity34.0%
times-frac34.0%
fma-udef34.0%
unpow234.0%
hypot-def34.0%
fma-udef34.0%
unpow234.0%
hypot-def43.8%
Applied egg-rr43.8%
Taylor expanded in c around inf 85.9%
if -9e88 < c < 1.90000000000000005e60Initial program 79.7%
Taylor expanded in b around 0 79.7%
mul-1-neg79.7%
+-commutative79.7%
*-commutative79.7%
fma-def79.7%
distribute-rgt-neg-in79.7%
Simplified79.7%
Taylor expanded in b around 0 75.8%
+-commutative75.8%
mul-1-neg75.8%
unsub-neg75.8%
+-commutative75.8%
unpow275.8%
fma-udef75.8%
associate-/l*80.5%
+-commutative80.5%
unpow280.5%
fma-udef80.5%
Simplified80.5%
add-sqr-sqrt80.5%
*-un-lft-identity80.5%
times-frac80.5%
fma-udef80.5%
unpow280.5%
hypot-def80.5%
fma-udef80.5%
unpow280.5%
hypot-def91.0%
Applied egg-rr91.0%
Final simplification89.1%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (fma d d (pow c 2.0)))
(t_1 (- (/ b c) (/ a (* (hypot d c) (/ (hypot d c) d))))))
(if (<= c -7.2e+92)
t_1
(if (<= c -2.6e-79)
(- (/ (* c b) t_0) (/ a (/ t_0 d)))
(if (<= c 1.2e-239)
(- (/ b (/ (pow d 2.0) c)) (/ a d))
(if (<= c 2700000000000.0)
(/ (- (* c b) (* d a)) (+ (* c c) (* d d)))
t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = fma(d, d, pow(c, 2.0));
double t_1 = (b / c) - (a / (hypot(d, c) * (hypot(d, c) / d)));
double tmp;
if (c <= -7.2e+92) {
tmp = t_1;
} else if (c <= -2.6e-79) {
tmp = ((c * b) / t_0) - (a / (t_0 / d));
} else if (c <= 1.2e-239) {
tmp = (b / (pow(d, 2.0) / c)) - (a / d);
} else if (c <= 2700000000000.0) {
tmp = ((c * b) - (d * a)) / ((c * c) + (d * d));
} else {
tmp = t_1;
}
return tmp;
}
function code(a, b, c, d) t_0 = fma(d, d, (c ^ 2.0)) t_1 = Float64(Float64(b / c) - Float64(a / Float64(hypot(d, c) * Float64(hypot(d, c) / d)))) tmp = 0.0 if (c <= -7.2e+92) tmp = t_1; elseif (c <= -2.6e-79) tmp = Float64(Float64(Float64(c * b) / t_0) - Float64(a / Float64(t_0 / d))); elseif (c <= 1.2e-239) tmp = Float64(Float64(b / Float64((d ^ 2.0) / c)) - Float64(a / d)); elseif (c <= 2700000000000.0) tmp = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(Float64(c * c) + Float64(d * d))); else tmp = t_1; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(d * d + N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b / c), $MachinePrecision] - N[(a / N[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] * N[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -7.2e+92], t$95$1, If[LessEqual[c, -2.6e-79], N[(N[(N[(c * b), $MachinePrecision] / t$95$0), $MachinePrecision] - N[(a / N[(t$95$0 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.2e-239], N[(N[(b / N[(N[Power[d, 2.0], $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2700000000000.0], N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(d, d, {c}^{2}\right)\\
t_1 := \frac{b}{c} - \frac{a}{\mathsf{hypot}\left(d, c\right) \cdot \frac{\mathsf{hypot}\left(d, c\right)}{d}}\\
\mathbf{if}\;c \leq -7.2 \cdot 10^{+92}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -2.6 \cdot 10^{-79}:\\
\;\;\;\;\frac{c \cdot b}{t_0} - \frac{a}{\frac{t_0}{d}}\\
\mathbf{elif}\;c \leq 1.2 \cdot 10^{-239}:\\
\;\;\;\;\frac{b}{\frac{{d}^{2}}{c}} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 2700000000000:\\
\;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if c < -7.2e92 or 2.7e12 < c Initial program 37.3%
Taylor expanded in b around 0 37.3%
mul-1-neg37.3%
+-commutative37.3%
*-commutative37.3%
fma-def37.3%
distribute-rgt-neg-in37.3%
Simplified37.3%
Taylor expanded in b around 0 37.3%
+-commutative37.3%
mul-1-neg37.3%
unsub-neg37.3%
+-commutative37.3%
unpow237.3%
fma-udef37.3%
associate-/l*36.0%
+-commutative36.0%
unpow236.0%
fma-udef36.0%
Simplified36.0%
add-sqr-sqrt36.0%
*-un-lft-identity36.0%
times-frac36.0%
fma-udef36.0%
unpow236.0%
hypot-def36.0%
fma-udef36.0%
unpow236.0%
hypot-def47.7%
Applied egg-rr47.7%
Taylor expanded in c around inf 83.4%
if -7.2e92 < c < -2.59999999999999994e-79Initial program 83.6%
Taylor expanded in b around 0 83.6%
mul-1-neg83.6%
+-commutative83.6%
*-commutative83.6%
fma-def83.6%
distribute-rgt-neg-in83.6%
Simplified83.6%
Taylor expanded in b around 0 83.6%
+-commutative83.6%
mul-1-neg83.6%
unsub-neg83.6%
+-commutative83.6%
unpow283.6%
fma-udef83.6%
associate-/l*83.9%
+-commutative83.9%
unpow283.9%
fma-udef83.9%
Simplified83.9%
if -2.59999999999999994e-79 < c < 1.19999999999999996e-239Initial program 78.0%
Taylor expanded in b around 0 78.0%
mul-1-neg78.0%
+-commutative78.0%
*-commutative78.0%
fma-def78.0%
distribute-rgt-neg-in78.0%
Simplified78.0%
Taylor expanded in b around 0 74.7%
+-commutative74.7%
mul-1-neg74.7%
unsub-neg74.7%
+-commutative74.7%
unpow274.7%
fma-udef74.7%
associate-/l*81.3%
+-commutative81.3%
unpow281.3%
fma-udef81.3%
Simplified81.3%
add-sqr-sqrt81.3%
*-un-lft-identity81.3%
times-frac81.3%
fma-udef81.3%
unpow281.3%
hypot-def81.3%
fma-udef81.3%
unpow281.3%
hypot-def93.9%
Applied egg-rr93.9%
Taylor expanded in c around 0 92.2%
+-commutative92.2%
*-commutative92.2%
associate-*r/87.9%
mul-1-neg87.9%
unsub-neg87.9%
associate-*r/92.2%
*-commutative92.2%
associate-/l*90.8%
Simplified90.8%
if 1.19999999999999996e-239 < c < 2.7e12Initial program 83.2%
Final simplification85.3%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (+ (* c c) (* d d))))
(t_1 (- (/ b c) (/ a (* (hypot d c) (/ (hypot d c) d)))))
(t_2 (- (/ b (/ (pow d 2.0) c)) (/ a d))))
(if (<= c -2.6e+86)
t_1
(if (<= c -3.4e-79)
t_0
(if (<= c 1.4e-236)
t_2
(if (<= c 1.35e-49) t_0 (if (<= c 6000000000.0) t_2 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 / c) - (a / (hypot(d, c) * (hypot(d, c) / d)));
double t_2 = (b / (pow(d, 2.0) / c)) - (a / d);
double tmp;
if (c <= -2.6e+86) {
tmp = t_1;
} else if (c <= -3.4e-79) {
tmp = t_0;
} else if (c <= 1.4e-236) {
tmp = t_2;
} else if (c <= 1.35e-49) {
tmp = t_0;
} else if (c <= 6000000000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
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 / c) - (a / (Math.hypot(d, c) * (Math.hypot(d, c) / d)));
double t_2 = (b / (Math.pow(d, 2.0) / c)) - (a / d);
double tmp;
if (c <= -2.6e+86) {
tmp = t_1;
} else if (c <= -3.4e-79) {
tmp = t_0;
} else if (c <= 1.4e-236) {
tmp = t_2;
} else if (c <= 1.35e-49) {
tmp = t_0;
} else if (c <= 6000000000.0) {
tmp = t_2;
} 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 / c) - (a / (math.hypot(d, c) * (math.hypot(d, c) / d))) t_2 = (b / (math.pow(d, 2.0) / c)) - (a / d) tmp = 0 if c <= -2.6e+86: tmp = t_1 elif c <= -3.4e-79: tmp = t_0 elif c <= 1.4e-236: tmp = t_2 elif c <= 1.35e-49: tmp = t_0 elif c <= 6000000000.0: tmp = t_2 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 / c) - Float64(a / Float64(hypot(d, c) * Float64(hypot(d, c) / d)))) t_2 = Float64(Float64(b / Float64((d ^ 2.0) / c)) - Float64(a / d)) tmp = 0.0 if (c <= -2.6e+86) tmp = t_1; elseif (c <= -3.4e-79) tmp = t_0; elseif (c <= 1.4e-236) tmp = t_2; elseif (c <= 1.35e-49) tmp = t_0; elseif (c <= 6000000000.0) tmp = t_2; 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 / c) - (a / (hypot(d, c) * (hypot(d, c) / d))); t_2 = (b / ((d ^ 2.0) / c)) - (a / d); tmp = 0.0; if (c <= -2.6e+86) tmp = t_1; elseif (c <= -3.4e-79) tmp = t_0; elseif (c <= 1.4e-236) tmp = t_2; elseif (c <= 1.35e-49) tmp = t_0; elseif (c <= 6000000000.0) tmp = t_2; 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 / c), $MachinePrecision] - N[(a / N[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] * N[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b / N[(N[Power[d, 2.0], $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.6e+86], t$95$1, If[LessEqual[c, -3.4e-79], t$95$0, If[LessEqual[c, 1.4e-236], t$95$2, If[LessEqual[c, 1.35e-49], t$95$0, If[LessEqual[c, 6000000000.0], t$95$2, 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}{c} - \frac{a}{\mathsf{hypot}\left(d, c\right) \cdot \frac{\mathsf{hypot}\left(d, c\right)}{d}}\\
t_2 := \frac{b}{\frac{{d}^{2}}{c}} - \frac{a}{d}\\
\mathbf{if}\;c \leq -2.6 \cdot 10^{+86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -3.4 \cdot 10^{-79}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 1.4 \cdot 10^{-236}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq 1.35 \cdot 10^{-49}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 6000000000:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if c < -2.5999999999999998e86 or 6e9 < c Initial program 37.3%
Taylor expanded in b around 0 37.3%
mul-1-neg37.3%
+-commutative37.3%
*-commutative37.3%
fma-def37.3%
distribute-rgt-neg-in37.3%
Simplified37.3%
Taylor expanded in b around 0 37.3%
+-commutative37.3%
mul-1-neg37.3%
unsub-neg37.3%
+-commutative37.3%
unpow237.3%
fma-udef37.3%
associate-/l*36.0%
+-commutative36.0%
unpow236.0%
fma-udef36.0%
Simplified36.0%
add-sqr-sqrt36.0%
*-un-lft-identity36.0%
times-frac36.0%
fma-udef36.0%
unpow236.0%
hypot-def36.0%
fma-udef36.0%
unpow236.0%
hypot-def47.7%
Applied egg-rr47.7%
Taylor expanded in c around inf 83.4%
if -2.5999999999999998e86 < c < -3.39999999999999976e-79 or 1.39999999999999993e-236 < c < 1.35e-49Initial program 84.7%
if -3.39999999999999976e-79 < c < 1.39999999999999993e-236 or 1.35e-49 < c < 6e9Initial program 77.0%
Taylor expanded in b around 0 77.0%
mul-1-neg77.0%
+-commutative77.0%
*-commutative77.0%
fma-def77.0%
distribute-rgt-neg-in77.0%
Simplified77.0%
Taylor expanded in b around 0 74.0%
+-commutative74.0%
mul-1-neg74.0%
unsub-neg74.0%
+-commutative74.0%
unpow274.0%
fma-udef74.0%
associate-/l*81.4%
+-commutative81.4%
unpow281.4%
fma-udef81.4%
Simplified81.4%
add-sqr-sqrt81.4%
*-un-lft-identity81.4%
times-frac81.5%
fma-udef81.5%
unpow281.5%
hypot-def81.5%
fma-udef81.5%
unpow281.5%
hypot-def94.3%
Applied egg-rr94.3%
Taylor expanded in c around 0 91.4%
+-commutative91.4%
*-commutative91.4%
associate-*r/87.5%
mul-1-neg87.5%
unsub-neg87.5%
associate-*r/91.4%
*-commutative91.4%
associate-/l*90.2%
Simplified90.2%
Final simplification85.6%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (+ (* c c) (* d d)))))
(if (<= c -7e+142)
(/ b c)
(if (<= c -6e-79)
t_0
(if (<= c 1.9e-307)
(- (* c (/ b (pow d 2.0))) (/ a d))
(if (<= c 2.1e+73) t_0 (- (/ b c) (/ a (/ (pow c 2.0) d)))))))))
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 <= -7e+142) {
tmp = b / c;
} else if (c <= -6e-79) {
tmp = t_0;
} else if (c <= 1.9e-307) {
tmp = (c * (b / pow(d, 2.0))) - (a / d);
} else if (c <= 2.1e+73) {
tmp = t_0;
} else {
tmp = (b / c) - (a / (pow(c, 2.0) / 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) :: t_0
real(8) :: tmp
t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d))
if (c <= (-7d+142)) then
tmp = b / c
else if (c <= (-6d-79)) then
tmp = t_0
else if (c <= 1.9d-307) then
tmp = (c * (b / (d ** 2.0d0))) - (a / d)
else if (c <= 2.1d+73) then
tmp = t_0
else
tmp = (b / c) - (a / ((c ** 2.0d0) / d))
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 <= -7e+142) {
tmp = b / c;
} else if (c <= -6e-79) {
tmp = t_0;
} else if (c <= 1.9e-307) {
tmp = (c * (b / Math.pow(d, 2.0))) - (a / d);
} else if (c <= 2.1e+73) {
tmp = t_0;
} else {
tmp = (b / c) - (a / (Math.pow(c, 2.0) / d));
}
return tmp;
}
def code(a, b, c, d): t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d)) tmp = 0 if c <= -7e+142: tmp = b / c elif c <= -6e-79: tmp = t_0 elif c <= 1.9e-307: tmp = (c * (b / math.pow(d, 2.0))) - (a / d) elif c <= 2.1e+73: tmp = t_0 else: tmp = (b / c) - (a / (math.pow(c, 2.0) / d)) 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 <= -7e+142) tmp = Float64(b / c); elseif (c <= -6e-79) tmp = t_0; elseif (c <= 1.9e-307) tmp = Float64(Float64(c * Float64(b / (d ^ 2.0))) - Float64(a / d)); elseif (c <= 2.1e+73) tmp = t_0; else tmp = Float64(Float64(b / c) - Float64(a / Float64((c ^ 2.0) / d))); 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 <= -7e+142) tmp = b / c; elseif (c <= -6e-79) tmp = t_0; elseif (c <= 1.9e-307) tmp = (c * (b / (d ^ 2.0))) - (a / d); elseif (c <= 2.1e+73) tmp = t_0; else tmp = (b / c) - (a / ((c ^ 2.0) / d)); 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, -7e+142], N[(b / c), $MachinePrecision], If[LessEqual[c, -6e-79], t$95$0, If[LessEqual[c, 1.9e-307], N[(N[(c * N[(b / N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.1e+73], t$95$0, N[(N[(b / c), $MachinePrecision] - N[(a / N[(N[Power[c, 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $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 -7 \cdot 10^{+142}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq -6 \cdot 10^{-79}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 1.9 \cdot 10^{-307}:\\
\;\;\;\;c \cdot \frac{b}{{d}^{2}} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 2.1 \cdot 10^{+73}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{\frac{{c}^{2}}{d}}\\
\end{array}
\end{array}
if c < -6.99999999999999995e142Initial program 27.1%
Taylor expanded in c around inf 73.5%
if -6.99999999999999995e142 < c < -5.99999999999999999e-79 or 1.89999999999999993e-307 < c < 2.1000000000000001e73Initial program 80.0%
if -5.99999999999999999e-79 < c < 1.89999999999999993e-307Initial program 76.2%
Taylor expanded in c around 0 92.8%
+-commutative92.8%
mul-1-neg92.8%
unsub-neg92.8%
associate-/l*91.1%
associate-/r/89.5%
Simplified89.5%
if 2.1000000000000001e73 < c Initial program 30.1%
Taylor expanded in c around inf 81.5%
+-commutative81.5%
mul-1-neg81.5%
unsub-neg81.5%
associate-/l*82.0%
Simplified82.0%
Final simplification81.4%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (+ (* c c) (* d d))))
(t_1 (- (/ b c) (/ d (/ (pow c 2.0) a)))))
(if (<= c -5.5e+94)
t_1
(if (<= c -3e-79)
t_0
(if (<= c 9.5e-308)
(- (* c (/ b (pow d 2.0))) (/ a d))
(if (<= c 3.1e+68) 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 / c) - (d / (pow(c, 2.0) / a));
double tmp;
if (c <= -5.5e+94) {
tmp = t_1;
} else if (c <= -3e-79) {
tmp = t_0;
} else if (c <= 9.5e-308) {
tmp = (c * (b / pow(d, 2.0))) - (a / d);
} else if (c <= 3.1e+68) {
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 / c) - (d / ((c ** 2.0d0) / a))
if (c <= (-5.5d+94)) then
tmp = t_1
else if (c <= (-3d-79)) then
tmp = t_0
else if (c <= 9.5d-308) then
tmp = (c * (b / (d ** 2.0d0))) - (a / d)
else if (c <= 3.1d+68) 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 / c) - (d / (Math.pow(c, 2.0) / a));
double tmp;
if (c <= -5.5e+94) {
tmp = t_1;
} else if (c <= -3e-79) {
tmp = t_0;
} else if (c <= 9.5e-308) {
tmp = (c * (b / Math.pow(d, 2.0))) - (a / d);
} else if (c <= 3.1e+68) {
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 / c) - (d / (math.pow(c, 2.0) / a)) tmp = 0 if c <= -5.5e+94: tmp = t_1 elif c <= -3e-79: tmp = t_0 elif c <= 9.5e-308: tmp = (c * (b / math.pow(d, 2.0))) - (a / d) elif c <= 3.1e+68: 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 / c) - Float64(d / Float64((c ^ 2.0) / a))) tmp = 0.0 if (c <= -5.5e+94) tmp = t_1; elseif (c <= -3e-79) tmp = t_0; elseif (c <= 9.5e-308) tmp = Float64(Float64(c * Float64(b / (d ^ 2.0))) - Float64(a / d)); elseif (c <= 3.1e+68) 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 / c) - (d / ((c ^ 2.0) / a)); tmp = 0.0; if (c <= -5.5e+94) tmp = t_1; elseif (c <= -3e-79) tmp = t_0; elseif (c <= 9.5e-308) tmp = (c * (b / (d ^ 2.0))) - (a / d); elseif (c <= 3.1e+68) 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 / c), $MachinePrecision] - N[(d / N[(N[Power[c, 2.0], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -5.5e+94], t$95$1, If[LessEqual[c, -3e-79], t$95$0, If[LessEqual[c, 9.5e-308], N[(N[(c * N[(b / N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 3.1e+68], 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}{c} - \frac{d}{\frac{{c}^{2}}{a}}\\
\mathbf{if}\;c \leq -5.5 \cdot 10^{+94}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -3 \cdot 10^{-79}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 9.5 \cdot 10^{-308}:\\
\;\;\;\;c \cdot \frac{b}{{d}^{2}} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 3.1 \cdot 10^{+68}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if c < -5.4999999999999997e94 or 3.0999999999999998e68 < c Initial program 34.2%
add-cbrt-cube21.1%
pow321.1%
fma-def21.1%
add-sqr-sqrt21.1%
pow221.1%
fma-def21.1%
hypot-def21.1%
Applied egg-rr21.1%
Taylor expanded in c around inf 21.1%
pow1/321.1%
pow-pow34.1%
metadata-eval34.1%
sub-div34.1%
associate-/l*37.0%
*-commutative37.0%
associate-/l*38.4%
Applied egg-rr38.4%
Taylor expanded in c around 0 78.0%
if -5.4999999999999997e94 < c < -3e-79 or 9.49999999999999963e-308 < c < 3.0999999999999998e68Initial program 81.8%
if -3e-79 < c < 9.49999999999999963e-308Initial program 76.2%
Taylor expanded in c around 0 92.8%
+-commutative92.8%
mul-1-neg92.8%
unsub-neg92.8%
associate-/l*91.1%
associate-/r/89.5%
Simplified89.5%
Final simplification82.1%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (+ (* c c) (* d d))))
(t_1 (- (/ b c) (/ d (/ (pow c 2.0) a)))))
(if (<= c -1.9e+89)
t_1
(if (<= c -9.5e-79)
t_0
(if (<= c 3.2e-241)
(- (/ b (/ (pow d 2.0) c)) (/ a d))
(if (<= c 9e+70) 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 / c) - (d / (pow(c, 2.0) / a));
double tmp;
if (c <= -1.9e+89) {
tmp = t_1;
} else if (c <= -9.5e-79) {
tmp = t_0;
} else if (c <= 3.2e-241) {
tmp = (b / (pow(d, 2.0) / c)) - (a / d);
} else if (c <= 9e+70) {
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 / c) - (d / ((c ** 2.0d0) / a))
if (c <= (-1.9d+89)) then
tmp = t_1
else if (c <= (-9.5d-79)) then
tmp = t_0
else if (c <= 3.2d-241) then
tmp = (b / ((d ** 2.0d0) / c)) - (a / d)
else if (c <= 9d+70) 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 / c) - (d / (Math.pow(c, 2.0) / a));
double tmp;
if (c <= -1.9e+89) {
tmp = t_1;
} else if (c <= -9.5e-79) {
tmp = t_0;
} else if (c <= 3.2e-241) {
tmp = (b / (Math.pow(d, 2.0) / c)) - (a / d);
} else if (c <= 9e+70) {
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 / c) - (d / (math.pow(c, 2.0) / a)) tmp = 0 if c <= -1.9e+89: tmp = t_1 elif c <= -9.5e-79: tmp = t_0 elif c <= 3.2e-241: tmp = (b / (math.pow(d, 2.0) / c)) - (a / d) elif c <= 9e+70: 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 / c) - Float64(d / Float64((c ^ 2.0) / a))) tmp = 0.0 if (c <= -1.9e+89) tmp = t_1; elseif (c <= -9.5e-79) tmp = t_0; elseif (c <= 3.2e-241) tmp = Float64(Float64(b / Float64((d ^ 2.0) / c)) - Float64(a / d)); elseif (c <= 9e+70) 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 / c) - (d / ((c ^ 2.0) / a)); tmp = 0.0; if (c <= -1.9e+89) tmp = t_1; elseif (c <= -9.5e-79) tmp = t_0; elseif (c <= 3.2e-241) tmp = (b / ((d ^ 2.0) / c)) - (a / d); elseif (c <= 9e+70) 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 / c), $MachinePrecision] - N[(d / N[(N[Power[c, 2.0], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1.9e+89], t$95$1, If[LessEqual[c, -9.5e-79], t$95$0, If[LessEqual[c, 3.2e-241], N[(N[(b / N[(N[Power[d, 2.0], $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 9e+70], 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}{c} - \frac{d}{\frac{{c}^{2}}{a}}\\
\mathbf{if}\;c \leq -1.9 \cdot 10^{+89}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -9.5 \cdot 10^{-79}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 3.2 \cdot 10^{-241}:\\
\;\;\;\;\frac{b}{\frac{{d}^{2}}{c}} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 9 \cdot 10^{+70}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if c < -1.90000000000000012e89 or 8.9999999999999999e70 < c Initial program 34.2%
add-cbrt-cube21.1%
pow321.1%
fma-def21.1%
add-sqr-sqrt21.1%
pow221.1%
fma-def21.1%
hypot-def21.1%
Applied egg-rr21.1%
Taylor expanded in c around inf 21.1%
pow1/321.1%
pow-pow34.1%
metadata-eval34.1%
sub-div34.1%
associate-/l*37.0%
*-commutative37.0%
associate-/l*38.4%
Applied egg-rr38.4%
Taylor expanded in c around 0 78.0%
if -1.90000000000000012e89 < c < -9.4999999999999997e-79 or 3.2e-241 < c < 8.9999999999999999e70Initial program 81.2%
if -9.4999999999999997e-79 < c < 3.2e-241Initial program 78.0%
Taylor expanded in b around 0 78.0%
mul-1-neg78.0%
+-commutative78.0%
*-commutative78.0%
fma-def78.0%
distribute-rgt-neg-in78.0%
Simplified78.0%
Taylor expanded in b around 0 74.7%
+-commutative74.7%
mul-1-neg74.7%
unsub-neg74.7%
+-commutative74.7%
unpow274.7%
fma-udef74.7%
associate-/l*81.3%
+-commutative81.3%
unpow281.3%
fma-udef81.3%
Simplified81.3%
add-sqr-sqrt81.3%
*-un-lft-identity81.3%
times-frac81.3%
fma-udef81.3%
unpow281.3%
hypot-def81.3%
fma-udef81.3%
unpow281.3%
hypot-def93.9%
Applied egg-rr93.9%
Taylor expanded in c around 0 92.2%
+-commutative92.2%
*-commutative92.2%
associate-*r/87.9%
mul-1-neg87.9%
unsub-neg87.9%
associate-*r/92.2%
*-commutative92.2%
associate-/l*90.8%
Simplified90.8%
Final simplification82.4%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (+ (* c c) (* d d)))))
(if (<= c -5.2e+138)
(/ b c)
(if (<= c -2.6e-79)
t_0
(if (<= c 1.75e-307)
(- (* c (/ b (pow d 2.0))) (/ a d))
(if (<= c 6.8e+132) 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 <= -5.2e+138) {
tmp = b / c;
} else if (c <= -2.6e-79) {
tmp = t_0;
} else if (c <= 1.75e-307) {
tmp = (c * (b / pow(d, 2.0))) - (a / d);
} else if (c <= 6.8e+132) {
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 <= (-5.2d+138)) then
tmp = b / c
else if (c <= (-2.6d-79)) then
tmp = t_0
else if (c <= 1.75d-307) then
tmp = (c * (b / (d ** 2.0d0))) - (a / d)
else if (c <= 6.8d+132) 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 <= -5.2e+138) {
tmp = b / c;
} else if (c <= -2.6e-79) {
tmp = t_0;
} else if (c <= 1.75e-307) {
tmp = (c * (b / Math.pow(d, 2.0))) - (a / d);
} else if (c <= 6.8e+132) {
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 <= -5.2e+138: tmp = b / c elif c <= -2.6e-79: tmp = t_0 elif c <= 1.75e-307: tmp = (c * (b / math.pow(d, 2.0))) - (a / d) elif c <= 6.8e+132: 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 <= -5.2e+138) tmp = Float64(b / c); elseif (c <= -2.6e-79) tmp = t_0; elseif (c <= 1.75e-307) tmp = Float64(Float64(c * Float64(b / (d ^ 2.0))) - Float64(a / d)); elseif (c <= 6.8e+132) 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 <= -5.2e+138) tmp = b / c; elseif (c <= -2.6e-79) tmp = t_0; elseif (c <= 1.75e-307) tmp = (c * (b / (d ^ 2.0))) - (a / d); elseif (c <= 6.8e+132) 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, -5.2e+138], N[(b / c), $MachinePrecision], If[LessEqual[c, -2.6e-79], t$95$0, If[LessEqual[c, 1.75e-307], N[(N[(c * N[(b / N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 6.8e+132], 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 -5.2 \cdot 10^{+138}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq -2.6 \cdot 10^{-79}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 1.75 \cdot 10^{-307}:\\
\;\;\;\;c \cdot \frac{b}{{d}^{2}} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 6.8 \cdot 10^{+132}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\end{array}
if c < -5.2000000000000002e138 or 6.80000000000000051e132 < c Initial program 25.3%
Taylor expanded in c around inf 77.6%
if -5.2000000000000002e138 < c < -2.59999999999999994e-79 or 1.7500000000000001e-307 < c < 6.80000000000000051e132Initial program 80.0%
if -2.59999999999999994e-79 < c < 1.7500000000000001e-307Initial program 76.2%
Taylor expanded in c around 0 92.8%
+-commutative92.8%
mul-1-neg92.8%
unsub-neg92.8%
associate-/l*91.1%
associate-/r/89.5%
Simplified89.5%
Final simplification81.3%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (+ (* c c) (* d d)))))
(if (<= c -4.8e+139)
(/ b c)
(if (<= c -2.6e-79)
t_0
(if (<= c -1.75e-218) (/ (- a) d) (if (<= c 1.1e+132) 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 <= -4.8e+139) {
tmp = b / c;
} else if (c <= -2.6e-79) {
tmp = t_0;
} else if (c <= -1.75e-218) {
tmp = -a / d;
} else if (c <= 1.1e+132) {
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 <= (-4.8d+139)) then
tmp = b / c
else if (c <= (-2.6d-79)) then
tmp = t_0
else if (c <= (-1.75d-218)) then
tmp = -a / d
else if (c <= 1.1d+132) 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 <= -4.8e+139) {
tmp = b / c;
} else if (c <= -2.6e-79) {
tmp = t_0;
} else if (c <= -1.75e-218) {
tmp = -a / d;
} else if (c <= 1.1e+132) {
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 <= -4.8e+139: tmp = b / c elif c <= -2.6e-79: tmp = t_0 elif c <= -1.75e-218: tmp = -a / d elif c <= 1.1e+132: 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 <= -4.8e+139) tmp = Float64(b / c); elseif (c <= -2.6e-79) tmp = t_0; elseif (c <= -1.75e-218) tmp = Float64(Float64(-a) / d); elseif (c <= 1.1e+132) 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 <= -4.8e+139) tmp = b / c; elseif (c <= -2.6e-79) tmp = t_0; elseif (c <= -1.75e-218) tmp = -a / d; elseif (c <= 1.1e+132) 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, -4.8e+139], N[(b / c), $MachinePrecision], If[LessEqual[c, -2.6e-79], t$95$0, If[LessEqual[c, -1.75e-218], N[((-a) / d), $MachinePrecision], If[LessEqual[c, 1.1e+132], 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 -4.8 \cdot 10^{+139}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq -2.6 \cdot 10^{-79}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -1.75 \cdot 10^{-218}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{elif}\;c \leq 1.1 \cdot 10^{+132}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\end{array}
if c < -4.80000000000000016e139 or 1.09999999999999994e132 < c Initial program 25.3%
Taylor expanded in c around inf 77.6%
if -4.80000000000000016e139 < c < -2.59999999999999994e-79 or -1.75e-218 < c < 1.09999999999999994e132Initial program 80.2%
if -2.59999999999999994e-79 < c < -1.75e-218Initial program 72.4%
Taylor expanded in c around 0 90.9%
associate-*r/90.9%
neg-mul-190.9%
Simplified90.9%
Final simplification80.8%
(FPCore (a b c d)
:precision binary64
(if (<= c -1.7e+50)
(/ b c)
(if (<= c -9.2e-79)
(/ (- (* c b) (* d a)) (* c c))
(if (<= c 180000.0) (/ (- a) d) (/ b c)))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -1.7e+50) {
tmp = b / c;
} else if (c <= -9.2e-79) {
tmp = ((c * b) - (d * a)) / (c * c);
} else if (c <= 180000.0) {
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 (c <= (-1.7d+50)) then
tmp = b / c
else if (c <= (-9.2d-79)) then
tmp = ((c * b) - (d * a)) / (c * c)
else if (c <= 180000.0d0) 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 (c <= -1.7e+50) {
tmp = b / c;
} else if (c <= -9.2e-79) {
tmp = ((c * b) - (d * a)) / (c * c);
} else if (c <= 180000.0) {
tmp = -a / d;
} else {
tmp = b / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -1.7e+50: tmp = b / c elif c <= -9.2e-79: tmp = ((c * b) - (d * a)) / (c * c) elif c <= 180000.0: tmp = -a / d else: tmp = b / c return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -1.7e+50) tmp = Float64(b / c); elseif (c <= -9.2e-79) tmp = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(c * c)); elseif (c <= 180000.0) 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 (c <= -1.7e+50) tmp = b / c; elseif (c <= -9.2e-79) tmp = ((c * b) - (d * a)) / (c * c); elseif (c <= 180000.0) tmp = -a / d; else tmp = b / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -1.7e+50], N[(b / c), $MachinePrecision], If[LessEqual[c, -9.2e-79], N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 180000.0], N[((-a) / d), $MachinePrecision], N[(b / c), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.7 \cdot 10^{+50}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq -9.2 \cdot 10^{-79}:\\
\;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c}\\
\mathbf{elif}\;c \leq 180000:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\end{array}
if c < -1.6999999999999999e50 or 1.8e5 < c Initial program 39.8%
Taylor expanded in c around inf 68.4%
if -1.6999999999999999e50 < c < -9.20000000000000047e-79Initial program 89.8%
add-cbrt-cube64.6%
pow364.7%
fma-def64.7%
add-sqr-sqrt64.7%
pow264.7%
fma-def64.7%
hypot-def64.7%
Applied egg-rr64.7%
Taylor expanded in c around inf 49.3%
pow1/346.0%
pow-pow62.3%
metadata-eval62.3%
unpow262.3%
Applied egg-rr62.3%
if -9.20000000000000047e-79 < c < 1.8e5Initial program 80.0%
Taylor expanded in c around 0 71.1%
associate-*r/71.1%
neg-mul-171.1%
Simplified71.1%
Final simplification68.8%
(FPCore (a b c d) :precision binary64 (if (or (<= c -3.7e-6) (not (<= c 13000.0))) (/ b c) (/ (- a) d)))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -3.7e-6) || !(c <= 13000.0)) {
tmp = b / c;
} else {
tmp = -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 <= (-3.7d-6)) .or. (.not. (c <= 13000.0d0))) then
tmp = b / c
else
tmp = -a / d
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -3.7e-6) || !(c <= 13000.0)) {
tmp = b / c;
} else {
tmp = -a / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -3.7e-6) or not (c <= 13000.0): tmp = b / c else: tmp = -a / d return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -3.7e-6) || !(c <= 13000.0)) tmp = Float64(b / c); else tmp = Float64(Float64(-a) / d); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((c <= -3.7e-6) || ~((c <= 13000.0))) tmp = b / c; else tmp = -a / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -3.7e-6], N[Not[LessEqual[c, 13000.0]], $MachinePrecision]], N[(b / c), $MachinePrecision], N[((-a) / d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -3.7 \cdot 10^{-6} \lor \neg \left(c \leq 13000\right):\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\
\end{array}
\end{array}
if c < -3.7000000000000002e-6 or 13000 < c Initial program 45.5%
Taylor expanded in c around inf 66.6%
if -3.7000000000000002e-6 < c < 13000Initial program 80.9%
Taylor expanded in c around 0 67.3%
associate-*r/67.3%
neg-mul-167.3%
Simplified67.3%
Final simplification66.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 62.9%
Taylor expanded in c around inf 44.6%
Final simplification44.6%
(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 2024021
(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))))