
(FPCore (a b c d) :precision binary64 (/ (+ (* a c) (* b d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
return ((a * c) + (b * 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 = ((a * c) + (b * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
return ((a * c) + (b * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d): return ((a * c) + (b * d)) / ((c * c) + (d * d))
function code(a, b, c, d) return Float64(Float64(Float64(a * c) + Float64(b * d)) / Float64(Float64(c * c) + Float64(d * d))) end
function tmp = code(a, b, c, d) tmp = ((a * c) + (b * d)) / ((c * c) + (d * d)); end
code[a_, b_, c_, d_] := N[(N[(N[(a * c), $MachinePrecision] + N[(b * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c d) :precision binary64 (/ (+ (* a c) (* b d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
return ((a * c) + (b * 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 = ((a * c) + (b * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
return ((a * c) + (b * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d): return ((a * c) + (b * d)) / ((c * c) + (d * d))
function code(a, b, c, d) return Float64(Float64(Float64(a * c) + Float64(b * d)) / Float64(Float64(c * c) + Float64(d * d))) end
function tmp = code(a, b, c, d) tmp = ((a * c) + (b * d)) / ((c * c) + (d * d)); end
code[a_, b_, c_, d_] := N[(N[(N[(a * c), $MachinePrecision] + N[(b * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}
\end{array}
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ a (/ d c))))
(if (<= d -7.2e+86)
(/ (- (- b) t_0) (hypot c d))
(if (<= d -2.5e-199)
(/ (/ (fma a c (* d b)) (hypot c d)) (hypot c d))
(if (<= d 1.8e-178)
(+ (/ a c) (/ b (/ c (/ d c))))
(if (<= d 8.4e+15)
(/ (/ (+ (* d b) (* a c)) (hypot c d)) (hypot c d))
(/ (+ b t_0) (hypot c d))))))))
double code(double a, double b, double c, double d) {
double t_0 = a / (d / c);
double tmp;
if (d <= -7.2e+86) {
tmp = (-b - t_0) / hypot(c, d);
} else if (d <= -2.5e-199) {
tmp = (fma(a, c, (d * b)) / hypot(c, d)) / hypot(c, d);
} else if (d <= 1.8e-178) {
tmp = (a / c) + (b / (c / (d / c)));
} else if (d <= 8.4e+15) {
tmp = (((d * b) + (a * c)) / hypot(c, d)) / hypot(c, d);
} else {
tmp = (b + t_0) / hypot(c, d);
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(a / Float64(d / c)) tmp = 0.0 if (d <= -7.2e+86) tmp = Float64(Float64(Float64(-b) - t_0) / hypot(c, d)); elseif (d <= -2.5e-199) tmp = Float64(Float64(fma(a, c, Float64(d * b)) / hypot(c, d)) / hypot(c, d)); elseif (d <= 1.8e-178) tmp = Float64(Float64(a / c) + Float64(b / Float64(c / Float64(d / c)))); elseif (d <= 8.4e+15) tmp = Float64(Float64(Float64(Float64(d * b) + Float64(a * c)) / hypot(c, d)) / hypot(c, d)); else tmp = Float64(Float64(b + t_0) / hypot(c, d)); end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(a / N[(d / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7.2e+86], N[(N[((-b) - t$95$0), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.5e-199], N[(N[(N[(a * c + N[(d * b), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.8e-178], N[(N[(a / c), $MachinePrecision] + N[(b / N[(c / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8.4e+15], N[(N[(N[(N[(d * b), $MachinePrecision] + N[(a * c), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[(b + t$95$0), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{\frac{d}{c}}\\
\mathbf{if}\;d \leq -7.2 \cdot 10^{+86}:\\
\;\;\;\;\frac{\left(-b\right) - t_0}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;d \leq -2.5 \cdot 10^{-199}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(a, c, d \cdot b\right)}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;d \leq 1.8 \cdot 10^{-178}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{\frac{c}{\frac{d}{c}}}\\
\mathbf{elif}\;d \leq 8.4 \cdot 10^{+15}:\\
\;\;\;\;\frac{\frac{d \cdot b + a \cdot c}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + t_0}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if d < -7.20000000000000011e86Initial program 23.9%
+-commutative23.9%
fma-udef23.9%
*-un-lft-identity23.9%
associate-*r/23.9%
add-sqr-sqrt23.9%
times-frac23.9%
fma-udef23.9%
+-commutative23.9%
hypot-def23.9%
fma-def23.9%
fma-udef23.9%
+-commutative23.9%
hypot-def43.0%
Applied egg-rr43.0%
associate-*l/43.1%
*-un-lft-identity43.1%
Applied egg-rr43.1%
Taylor expanded in d around -inf 85.1%
distribute-lft-out85.1%
associate-/l*89.5%
Simplified89.5%
if -7.20000000000000011e86 < d < -2.4999999999999998e-199Initial program 81.9%
+-commutative81.9%
fma-udef81.9%
*-un-lft-identity81.9%
associate-*r/81.9%
add-sqr-sqrt81.8%
times-frac82.0%
fma-udef82.0%
+-commutative82.0%
hypot-def82.0%
fma-def82.0%
fma-udef82.0%
+-commutative82.0%
hypot-def96.0%
Applied egg-rr96.0%
associate-*l/96.1%
*-un-lft-identity96.1%
Applied egg-rr96.1%
if -2.4999999999999998e-199 < d < 1.79999999999999997e-178Initial program 72.3%
Taylor expanded in c around inf 82.2%
associate-/l*86.4%
Simplified86.4%
pow286.4%
*-un-lft-identity86.4%
times-frac98.1%
Applied egg-rr98.1%
/-rgt-identity98.1%
*-commutative98.1%
associate-/r/98.1%
Applied egg-rr98.1%
if 1.79999999999999997e-178 < d < 8.4e15Initial program 76.7%
+-commutative76.7%
fma-udef76.7%
*-un-lft-identity76.7%
associate-*r/76.7%
add-sqr-sqrt76.7%
times-frac76.7%
fma-udef76.7%
+-commutative76.7%
hypot-def76.7%
fma-def76.7%
fma-udef76.7%
+-commutative76.7%
hypot-def88.4%
Applied egg-rr88.4%
associate-*l/88.6%
*-un-lft-identity88.6%
Applied egg-rr88.6%
fma-def88.6%
+-commutative88.6%
Applied egg-rr88.6%
if 8.4e15 < d Initial program 39.8%
+-commutative39.8%
fma-udef39.8%
*-un-lft-identity39.8%
associate-*r/39.8%
add-sqr-sqrt39.8%
times-frac39.8%
fma-udef39.8%
+-commutative39.8%
hypot-def39.8%
fma-def39.8%
fma-udef39.8%
+-commutative39.8%
hypot-def60.0%
Applied egg-rr60.0%
associate-*l/60.2%
*-un-lft-identity60.2%
Applied egg-rr60.2%
Taylor expanded in c around 0 81.5%
associate-/l*90.1%
Simplified90.1%
Final simplification92.7%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (+ (* d b) (* a c)) (+ (* c c) (* d d)))) (t_1 (/ a (/ d c))))
(if (<= d -5.8e+77)
(/ (- (- b) t_1) (hypot c d))
(if (<= d -1.85e-134)
t_0
(if (<= d 2.1e-138)
(+ (/ a c) (/ b (/ c (/ d c))))
(if (<= d 9.6e+14)
t_0
(if (<= d 1.32e+138)
(* (/ d (hypot c d)) (/ b (hypot c d)))
(/ (+ b t_1) (hypot c d)))))))))
double code(double a, double b, double c, double d) {
double t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d));
double t_1 = a / (d / c);
double tmp;
if (d <= -5.8e+77) {
tmp = (-b - t_1) / hypot(c, d);
} else if (d <= -1.85e-134) {
tmp = t_0;
} else if (d <= 2.1e-138) {
tmp = (a / c) + (b / (c / (d / c)));
} else if (d <= 9.6e+14) {
tmp = t_0;
} else if (d <= 1.32e+138) {
tmp = (d / hypot(c, d)) * (b / hypot(c, d));
} else {
tmp = (b + t_1) / hypot(c, d);
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d));
double t_1 = a / (d / c);
double tmp;
if (d <= -5.8e+77) {
tmp = (-b - t_1) / Math.hypot(c, d);
} else if (d <= -1.85e-134) {
tmp = t_0;
} else if (d <= 2.1e-138) {
tmp = (a / c) + (b / (c / (d / c)));
} else if (d <= 9.6e+14) {
tmp = t_0;
} else if (d <= 1.32e+138) {
tmp = (d / Math.hypot(c, d)) * (b / Math.hypot(c, d));
} else {
tmp = (b + t_1) / Math.hypot(c, d);
}
return tmp;
}
def code(a, b, c, d): t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d)) t_1 = a / (d / c) tmp = 0 if d <= -5.8e+77: tmp = (-b - t_1) / math.hypot(c, d) elif d <= -1.85e-134: tmp = t_0 elif d <= 2.1e-138: tmp = (a / c) + (b / (c / (d / c))) elif d <= 9.6e+14: tmp = t_0 elif d <= 1.32e+138: tmp = (d / math.hypot(c, d)) * (b / math.hypot(c, d)) else: tmp = (b + t_1) / math.hypot(c, d) return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(d * b) + Float64(a * c)) / Float64(Float64(c * c) + Float64(d * d))) t_1 = Float64(a / Float64(d / c)) tmp = 0.0 if (d <= -5.8e+77) tmp = Float64(Float64(Float64(-b) - t_1) / hypot(c, d)); elseif (d <= -1.85e-134) tmp = t_0; elseif (d <= 2.1e-138) tmp = Float64(Float64(a / c) + Float64(b / Float64(c / Float64(d / c)))); elseif (d <= 9.6e+14) tmp = t_0; elseif (d <= 1.32e+138) tmp = Float64(Float64(d / hypot(c, d)) * Float64(b / hypot(c, d))); else tmp = Float64(Float64(b + t_1) / hypot(c, d)); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d)); t_1 = a / (d / c); tmp = 0.0; if (d <= -5.8e+77) tmp = (-b - t_1) / hypot(c, d); elseif (d <= -1.85e-134) tmp = t_0; elseif (d <= 2.1e-138) tmp = (a / c) + (b / (c / (d / c))); elseif (d <= 9.6e+14) tmp = t_0; elseif (d <= 1.32e+138) tmp = (d / hypot(c, d)) * (b / hypot(c, d)); else tmp = (b + t_1) / hypot(c, d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(d * b), $MachinePrecision] + N[(a * c), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(a / N[(d / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5.8e+77], N[(N[((-b) - t$95$1), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.85e-134], t$95$0, If[LessEqual[d, 2.1e-138], N[(N[(a / c), $MachinePrecision] + N[(b / N[(c / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.6e+14], t$95$0, If[LessEqual[d, 1.32e+138], N[(N[(d / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b + t$95$1), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{d \cdot b + a \cdot c}{c \cdot c + d \cdot d}\\
t_1 := \frac{a}{\frac{d}{c}}\\
\mathbf{if}\;d \leq -5.8 \cdot 10^{+77}:\\
\;\;\;\;\frac{\left(-b\right) - t_1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;d \leq -1.85 \cdot 10^{-134}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 2.1 \cdot 10^{-138}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{\frac{c}{\frac{d}{c}}}\\
\mathbf{elif}\;d \leq 9.6 \cdot 10^{+14}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.32 \cdot 10^{+138}:\\
\;\;\;\;\frac{d}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + t_1}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if d < -5.8000000000000003e77Initial program 28.6%
+-commutative28.6%
fma-udef28.6%
*-un-lft-identity28.6%
associate-*r/28.6%
add-sqr-sqrt28.6%
times-frac28.5%
fma-udef28.5%
+-commutative28.5%
hypot-def28.5%
fma-def28.5%
fma-udef28.5%
+-commutative28.5%
hypot-def46.5%
Applied egg-rr46.5%
associate-*l/46.6%
*-un-lft-identity46.6%
Applied egg-rr46.6%
Taylor expanded in d around -inf 86.0%
distribute-lft-out86.0%
associate-/l*90.1%
Simplified90.1%
if -5.8000000000000003e77 < d < -1.85e-134 or 2.09999999999999986e-138 < d < 9.6e14Initial program 80.1%
if -1.85e-134 < d < 2.09999999999999986e-138Initial program 73.1%
Taylor expanded in c around inf 80.8%
associate-/l*83.9%
Simplified83.9%
pow283.9%
*-un-lft-identity83.9%
times-frac92.5%
Applied egg-rr92.5%
/-rgt-identity92.5%
*-commutative92.5%
associate-/r/92.5%
Applied egg-rr92.5%
if 9.6e14 < d < 1.32000000000000001e138Initial program 53.9%
Taylor expanded in a around 0 54.3%
*-commutative54.3%
add-sqr-sqrt54.3%
hypot-udef54.3%
hypot-udef54.3%
times-frac83.2%
Applied egg-rr83.2%
if 1.32000000000000001e138 < d Initial program 34.1%
+-commutative34.1%
fma-udef34.1%
*-un-lft-identity34.1%
associate-*r/34.1%
add-sqr-sqrt34.1%
times-frac34.0%
fma-udef34.0%
+-commutative34.0%
hypot-def34.0%
fma-def34.0%
fma-udef34.0%
+-commutative34.0%
hypot-def61.8%
Applied egg-rr61.8%
associate-*l/61.9%
*-un-lft-identity61.9%
Applied egg-rr61.9%
Taylor expanded in c around 0 85.2%
associate-/l*97.8%
Simplified97.8%
Final simplification89.2%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ a (/ d c))))
(if (<= d -1.05e+78)
(/ (- (- b) t_0) (hypot c d))
(if (<= d -2.1e-135)
(/ (fma a c (* d b)) (fma d d (* c c)))
(if (<= d 5.6e-138)
(+ (/ a c) (/ b (/ c (/ d c))))
(if (<= d 1.02e+15)
(/ (+ (* d b) (* a c)) (+ (* c c) (* d d)))
(if (<= d 1.9e+136)
(* (/ d (hypot c d)) (/ b (hypot c d)))
(/ (+ b t_0) (hypot c d)))))))))
double code(double a, double b, double c, double d) {
double t_0 = a / (d / c);
double tmp;
if (d <= -1.05e+78) {
tmp = (-b - t_0) / hypot(c, d);
} else if (d <= -2.1e-135) {
tmp = fma(a, c, (d * b)) / fma(d, d, (c * c));
} else if (d <= 5.6e-138) {
tmp = (a / c) + (b / (c / (d / c)));
} else if (d <= 1.02e+15) {
tmp = ((d * b) + (a * c)) / ((c * c) + (d * d));
} else if (d <= 1.9e+136) {
tmp = (d / hypot(c, d)) * (b / hypot(c, d));
} else {
tmp = (b + t_0) / hypot(c, d);
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(a / Float64(d / c)) tmp = 0.0 if (d <= -1.05e+78) tmp = Float64(Float64(Float64(-b) - t_0) / hypot(c, d)); elseif (d <= -2.1e-135) tmp = Float64(fma(a, c, Float64(d * b)) / fma(d, d, Float64(c * c))); elseif (d <= 5.6e-138) tmp = Float64(Float64(a / c) + Float64(b / Float64(c / Float64(d / c)))); elseif (d <= 1.02e+15) tmp = Float64(Float64(Float64(d * b) + Float64(a * c)) / Float64(Float64(c * c) + Float64(d * d))); elseif (d <= 1.9e+136) tmp = Float64(Float64(d / hypot(c, d)) * Float64(b / hypot(c, d))); else tmp = Float64(Float64(b + t_0) / hypot(c, d)); end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(a / N[(d / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.05e+78], N[(N[((-b) - t$95$0), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.1e-135], N[(N[(a * c + N[(d * b), $MachinePrecision]), $MachinePrecision] / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.6e-138], N[(N[(a / c), $MachinePrecision] + N[(b / N[(c / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.02e+15], N[(N[(N[(d * b), $MachinePrecision] + N[(a * c), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.9e+136], N[(N[(d / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b + t$95$0), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{\frac{d}{c}}\\
\mathbf{if}\;d \leq -1.05 \cdot 10^{+78}:\\
\;\;\;\;\frac{\left(-b\right) - t_0}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;d \leq -2.1 \cdot 10^{-135}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, c, d \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\
\mathbf{elif}\;d \leq 5.6 \cdot 10^{-138}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{\frac{c}{\frac{d}{c}}}\\
\mathbf{elif}\;d \leq 1.02 \cdot 10^{+15}:\\
\;\;\;\;\frac{d \cdot b + a \cdot c}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;d \leq 1.9 \cdot 10^{+136}:\\
\;\;\;\;\frac{d}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + t_0}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if d < -1.05e78Initial program 28.6%
+-commutative28.6%
fma-udef28.6%
*-un-lft-identity28.6%
associate-*r/28.6%
add-sqr-sqrt28.6%
times-frac28.5%
fma-udef28.5%
+-commutative28.5%
hypot-def28.5%
fma-def28.5%
fma-udef28.5%
+-commutative28.5%
hypot-def46.5%
Applied egg-rr46.5%
associate-*l/46.6%
*-un-lft-identity46.6%
Applied egg-rr46.6%
Taylor expanded in d around -inf 86.0%
distribute-lft-out86.0%
associate-/l*90.1%
Simplified90.1%
if -1.05e78 < d < -2.1e-135Initial program 77.7%
fma-def77.8%
+-commutative77.8%
fma-def77.8%
Simplified77.8%
if -2.1e-135 < d < 5.60000000000000002e-138Initial program 73.1%
Taylor expanded in c around inf 80.8%
associate-/l*83.9%
Simplified83.9%
pow283.9%
*-un-lft-identity83.9%
times-frac92.5%
Applied egg-rr92.5%
/-rgt-identity92.5%
*-commutative92.5%
associate-/r/92.5%
Applied egg-rr92.5%
if 5.60000000000000002e-138 < d < 1.02e15Initial program 83.8%
if 1.02e15 < d < 1.90000000000000007e136Initial program 53.9%
Taylor expanded in a around 0 54.3%
*-commutative54.3%
add-sqr-sqrt54.3%
hypot-udef54.3%
hypot-udef54.3%
times-frac83.2%
Applied egg-rr83.2%
if 1.90000000000000007e136 < d Initial program 34.1%
+-commutative34.1%
fma-udef34.1%
*-un-lft-identity34.1%
associate-*r/34.1%
add-sqr-sqrt34.1%
times-frac34.0%
fma-udef34.0%
+-commutative34.0%
hypot-def34.0%
fma-def34.0%
fma-udef34.0%
+-commutative34.0%
hypot-def61.8%
Applied egg-rr61.8%
associate-*l/61.9%
*-un-lft-identity61.9%
Applied egg-rr61.9%
Taylor expanded in c around 0 85.2%
associate-/l*97.8%
Simplified97.8%
Final simplification89.2%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (+ (* d b) (* a c)) (+ (* c c) (* d d)))) (t_1 (/ a (/ d c))))
(if (<= d -2.2e+77)
(/ (- (- b) t_1) (hypot c d))
(if (<= d -3.4e-140)
t_0
(if (<= d 1.78e-137)
(+ (/ a c) (/ b (/ c (/ d c))))
(if (<= d 1.02e+15)
t_0
(if (<= d 1.02e+136)
(/ b (/ (fma d d (pow c 2.0)) d))
(/ (+ b t_1) (hypot c d)))))))))
double code(double a, double b, double c, double d) {
double t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d));
double t_1 = a / (d / c);
double tmp;
if (d <= -2.2e+77) {
tmp = (-b - t_1) / hypot(c, d);
} else if (d <= -3.4e-140) {
tmp = t_0;
} else if (d <= 1.78e-137) {
tmp = (a / c) + (b / (c / (d / c)));
} else if (d <= 1.02e+15) {
tmp = t_0;
} else if (d <= 1.02e+136) {
tmp = b / (fma(d, d, pow(c, 2.0)) / d);
} else {
tmp = (b + t_1) / hypot(c, d);
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(Float64(Float64(d * b) + Float64(a * c)) / Float64(Float64(c * c) + Float64(d * d))) t_1 = Float64(a / Float64(d / c)) tmp = 0.0 if (d <= -2.2e+77) tmp = Float64(Float64(Float64(-b) - t_1) / hypot(c, d)); elseif (d <= -3.4e-140) tmp = t_0; elseif (d <= 1.78e-137) tmp = Float64(Float64(a / c) + Float64(b / Float64(c / Float64(d / c)))); elseif (d <= 1.02e+15) tmp = t_0; elseif (d <= 1.02e+136) tmp = Float64(b / Float64(fma(d, d, (c ^ 2.0)) / d)); else tmp = Float64(Float64(b + t_1) / hypot(c, d)); end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(d * b), $MachinePrecision] + N[(a * c), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(a / N[(d / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.2e+77], N[(N[((-b) - t$95$1), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3.4e-140], t$95$0, If[LessEqual[d, 1.78e-137], N[(N[(a / c), $MachinePrecision] + N[(b / N[(c / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.02e+15], t$95$0, If[LessEqual[d, 1.02e+136], N[(b / N[(N[(d * d + N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(N[(b + t$95$1), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{d \cdot b + a \cdot c}{c \cdot c + d \cdot d}\\
t_1 := \frac{a}{\frac{d}{c}}\\
\mathbf{if}\;d \leq -2.2 \cdot 10^{+77}:\\
\;\;\;\;\frac{\left(-b\right) - t_1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;d \leq -3.4 \cdot 10^{-140}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.78 \cdot 10^{-137}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{\frac{c}{\frac{d}{c}}}\\
\mathbf{elif}\;d \leq 1.02 \cdot 10^{+15}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.02 \cdot 10^{+136}:\\
\;\;\;\;\frac{b}{\frac{\mathsf{fma}\left(d, d, {c}^{2}\right)}{d}}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + t_1}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if d < -2.2e77Initial program 28.6%
+-commutative28.6%
fma-udef28.6%
*-un-lft-identity28.6%
associate-*r/28.6%
add-sqr-sqrt28.6%
times-frac28.5%
fma-udef28.5%
+-commutative28.5%
hypot-def28.5%
fma-def28.5%
fma-udef28.5%
+-commutative28.5%
hypot-def46.5%
Applied egg-rr46.5%
associate-*l/46.6%
*-un-lft-identity46.6%
Applied egg-rr46.6%
Taylor expanded in d around -inf 86.0%
distribute-lft-out86.0%
associate-/l*90.1%
Simplified90.1%
if -2.2e77 < d < -3.40000000000000008e-140 or 1.7800000000000001e-137 < d < 1.02e15Initial program 80.1%
if -3.40000000000000008e-140 < d < 1.7800000000000001e-137Initial program 73.1%
Taylor expanded in c around inf 80.8%
associate-/l*83.9%
Simplified83.9%
pow283.9%
*-un-lft-identity83.9%
times-frac92.5%
Applied egg-rr92.5%
/-rgt-identity92.5%
*-commutative92.5%
associate-/r/92.5%
Applied egg-rr92.5%
if 1.02e15 < d < 1.01999999999999996e136Initial program 53.9%
Taylor expanded in a around 0 54.3%
associate-/l*79.3%
+-commutative79.3%
unpow279.3%
fma-def79.3%
Simplified79.3%
if 1.01999999999999996e136 < d Initial program 34.1%
+-commutative34.1%
fma-udef34.1%
*-un-lft-identity34.1%
associate-*r/34.1%
add-sqr-sqrt34.1%
times-frac34.0%
fma-udef34.0%
+-commutative34.0%
hypot-def34.0%
fma-def34.0%
fma-udef34.0%
+-commutative34.0%
hypot-def61.8%
Applied egg-rr61.8%
associate-*l/61.9%
*-un-lft-identity61.9%
Applied egg-rr61.9%
Taylor expanded in c around 0 85.2%
associate-/l*97.8%
Simplified97.8%
Final simplification88.8%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (/ (+ (* d b) (* a c)) (hypot c d)) (hypot c d)))
(t_1 (/ a (/ d c))))
(if (<= d -6.2e+86)
(/ (- (- b) t_1) (hypot c d))
(if (<= d -6.5e-198)
t_0
(if (<= d 1.12e-178)
(+ (/ a c) (/ b (/ c (/ d c))))
(if (<= d 8.4e+15) t_0 (/ (+ b t_1) (hypot c d))))))))
double code(double a, double b, double c, double d) {
double t_0 = (((d * b) + (a * c)) / hypot(c, d)) / hypot(c, d);
double t_1 = a / (d / c);
double tmp;
if (d <= -6.2e+86) {
tmp = (-b - t_1) / hypot(c, d);
} else if (d <= -6.5e-198) {
tmp = t_0;
} else if (d <= 1.12e-178) {
tmp = (a / c) + (b / (c / (d / c)));
} else if (d <= 8.4e+15) {
tmp = t_0;
} else {
tmp = (b + t_1) / hypot(c, d);
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = (((d * b) + (a * c)) / Math.hypot(c, d)) / Math.hypot(c, d);
double t_1 = a / (d / c);
double tmp;
if (d <= -6.2e+86) {
tmp = (-b - t_1) / Math.hypot(c, d);
} else if (d <= -6.5e-198) {
tmp = t_0;
} else if (d <= 1.12e-178) {
tmp = (a / c) + (b / (c / (d / c)));
} else if (d <= 8.4e+15) {
tmp = t_0;
} else {
tmp = (b + t_1) / Math.hypot(c, d);
}
return tmp;
}
def code(a, b, c, d): t_0 = (((d * b) + (a * c)) / math.hypot(c, d)) / math.hypot(c, d) t_1 = a / (d / c) tmp = 0 if d <= -6.2e+86: tmp = (-b - t_1) / math.hypot(c, d) elif d <= -6.5e-198: tmp = t_0 elif d <= 1.12e-178: tmp = (a / c) + (b / (c / (d / c))) elif d <= 8.4e+15: tmp = t_0 else: tmp = (b + t_1) / math.hypot(c, d) return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(Float64(d * b) + Float64(a * c)) / hypot(c, d)) / hypot(c, d)) t_1 = Float64(a / Float64(d / c)) tmp = 0.0 if (d <= -6.2e+86) tmp = Float64(Float64(Float64(-b) - t_1) / hypot(c, d)); elseif (d <= -6.5e-198) tmp = t_0; elseif (d <= 1.12e-178) tmp = Float64(Float64(a / c) + Float64(b / Float64(c / Float64(d / c)))); elseif (d <= 8.4e+15) tmp = t_0; else tmp = Float64(Float64(b + t_1) / hypot(c, d)); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (((d * b) + (a * c)) / hypot(c, d)) / hypot(c, d); t_1 = a / (d / c); tmp = 0.0; if (d <= -6.2e+86) tmp = (-b - t_1) / hypot(c, d); elseif (d <= -6.5e-198) tmp = t_0; elseif (d <= 1.12e-178) tmp = (a / c) + (b / (c / (d / c))); elseif (d <= 8.4e+15) tmp = t_0; else tmp = (b + t_1) / hypot(c, d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(N[(d * b), $MachinePrecision] + N[(a * c), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(a / N[(d / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -6.2e+86], N[(N[((-b) - t$95$1), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -6.5e-198], t$95$0, If[LessEqual[d, 1.12e-178], N[(N[(a / c), $MachinePrecision] + N[(b / N[(c / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8.4e+15], t$95$0, N[(N[(b + t$95$1), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{d \cdot b + a \cdot c}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \frac{a}{\frac{d}{c}}\\
\mathbf{if}\;d \leq -6.2 \cdot 10^{+86}:\\
\;\;\;\;\frac{\left(-b\right) - t_1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;d \leq -6.5 \cdot 10^{-198}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.12 \cdot 10^{-178}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{\frac{c}{\frac{d}{c}}}\\
\mathbf{elif}\;d \leq 8.4 \cdot 10^{+15}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b + t_1}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if d < -6.2000000000000004e86Initial program 23.9%
+-commutative23.9%
fma-udef23.9%
*-un-lft-identity23.9%
associate-*r/23.9%
add-sqr-sqrt23.9%
times-frac23.9%
fma-udef23.9%
+-commutative23.9%
hypot-def23.9%
fma-def23.9%
fma-udef23.9%
+-commutative23.9%
hypot-def43.0%
Applied egg-rr43.0%
associate-*l/43.1%
*-un-lft-identity43.1%
Applied egg-rr43.1%
Taylor expanded in d around -inf 85.1%
distribute-lft-out85.1%
associate-/l*89.5%
Simplified89.5%
if -6.2000000000000004e86 < d < -6.5000000000000004e-198 or 1.12e-178 < d < 8.4e15Initial program 79.8%
+-commutative79.8%
fma-udef79.8%
*-un-lft-identity79.8%
associate-*r/79.8%
add-sqr-sqrt79.8%
times-frac79.8%
fma-udef79.8%
+-commutative79.8%
hypot-def79.9%
fma-def79.9%
fma-udef79.9%
+-commutative79.9%
hypot-def93.0%
Applied egg-rr93.0%
associate-*l/93.1%
*-un-lft-identity93.1%
Applied egg-rr93.1%
fma-def93.1%
+-commutative93.1%
Applied egg-rr93.1%
if -6.5000000000000004e-198 < d < 1.12e-178Initial program 72.3%
Taylor expanded in c around inf 82.2%
associate-/l*86.4%
Simplified86.4%
pow286.4%
*-un-lft-identity86.4%
times-frac98.1%
Applied egg-rr98.1%
/-rgt-identity98.1%
*-commutative98.1%
associate-/r/98.1%
Applied egg-rr98.1%
if 8.4e15 < d Initial program 39.8%
+-commutative39.8%
fma-udef39.8%
*-un-lft-identity39.8%
associate-*r/39.8%
add-sqr-sqrt39.8%
times-frac39.8%
fma-udef39.8%
+-commutative39.8%
hypot-def39.8%
fma-def39.8%
fma-udef39.8%
+-commutative39.8%
hypot-def60.0%
Applied egg-rr60.0%
associate-*l/60.2%
*-un-lft-identity60.2%
Applied egg-rr60.2%
Taylor expanded in c around 0 81.5%
associate-/l*90.1%
Simplified90.1%
Final simplification92.7%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (+ (* d b) (* a c)) (+ (* c c) (* d d)))) (t_1 (/ a (/ d c))))
(if (<= d -4.7e+75)
(/ (- (- b) t_1) (hypot c d))
(if (<= d -2.46e-135)
t_0
(if (<= d 1.12e-138)
(+ (/ a c) (/ b (/ c (/ d c))))
(if (<= d 1.02e+15)
t_0
(if (<= d 4.3e+139)
(* b (/ d (pow (hypot c d) 2.0)))
(/ (+ b t_1) (hypot c d)))))))))
double code(double a, double b, double c, double d) {
double t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d));
double t_1 = a / (d / c);
double tmp;
if (d <= -4.7e+75) {
tmp = (-b - t_1) / hypot(c, d);
} else if (d <= -2.46e-135) {
tmp = t_0;
} else if (d <= 1.12e-138) {
tmp = (a / c) + (b / (c / (d / c)));
} else if (d <= 1.02e+15) {
tmp = t_0;
} else if (d <= 4.3e+139) {
tmp = b * (d / pow(hypot(c, d), 2.0));
} else {
tmp = (b + t_1) / hypot(c, d);
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d));
double t_1 = a / (d / c);
double tmp;
if (d <= -4.7e+75) {
tmp = (-b - t_1) / Math.hypot(c, d);
} else if (d <= -2.46e-135) {
tmp = t_0;
} else if (d <= 1.12e-138) {
tmp = (a / c) + (b / (c / (d / c)));
} else if (d <= 1.02e+15) {
tmp = t_0;
} else if (d <= 4.3e+139) {
tmp = b * (d / Math.pow(Math.hypot(c, d), 2.0));
} else {
tmp = (b + t_1) / Math.hypot(c, d);
}
return tmp;
}
def code(a, b, c, d): t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d)) t_1 = a / (d / c) tmp = 0 if d <= -4.7e+75: tmp = (-b - t_1) / math.hypot(c, d) elif d <= -2.46e-135: tmp = t_0 elif d <= 1.12e-138: tmp = (a / c) + (b / (c / (d / c))) elif d <= 1.02e+15: tmp = t_0 elif d <= 4.3e+139: tmp = b * (d / math.pow(math.hypot(c, d), 2.0)) else: tmp = (b + t_1) / math.hypot(c, d) return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(d * b) + Float64(a * c)) / Float64(Float64(c * c) + Float64(d * d))) t_1 = Float64(a / Float64(d / c)) tmp = 0.0 if (d <= -4.7e+75) tmp = Float64(Float64(Float64(-b) - t_1) / hypot(c, d)); elseif (d <= -2.46e-135) tmp = t_0; elseif (d <= 1.12e-138) tmp = Float64(Float64(a / c) + Float64(b / Float64(c / Float64(d / c)))); elseif (d <= 1.02e+15) tmp = t_0; elseif (d <= 4.3e+139) tmp = Float64(b * Float64(d / (hypot(c, d) ^ 2.0))); else tmp = Float64(Float64(b + t_1) / hypot(c, d)); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d)); t_1 = a / (d / c); tmp = 0.0; if (d <= -4.7e+75) tmp = (-b - t_1) / hypot(c, d); elseif (d <= -2.46e-135) tmp = t_0; elseif (d <= 1.12e-138) tmp = (a / c) + (b / (c / (d / c))); elseif (d <= 1.02e+15) tmp = t_0; elseif (d <= 4.3e+139) tmp = b * (d / (hypot(c, d) ^ 2.0)); else tmp = (b + t_1) / hypot(c, d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(d * b), $MachinePrecision] + N[(a * c), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(a / N[(d / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.7e+75], N[(N[((-b) - t$95$1), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.46e-135], t$95$0, If[LessEqual[d, 1.12e-138], N[(N[(a / c), $MachinePrecision] + N[(b / N[(c / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.02e+15], t$95$0, If[LessEqual[d, 4.3e+139], N[(b * N[(d / N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b + t$95$1), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{d \cdot b + a \cdot c}{c \cdot c + d \cdot d}\\
t_1 := \frac{a}{\frac{d}{c}}\\
\mathbf{if}\;d \leq -4.7 \cdot 10^{+75}:\\
\;\;\;\;\frac{\left(-b\right) - t_1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;d \leq -2.46 \cdot 10^{-135}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.12 \cdot 10^{-138}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{\frac{c}{\frac{d}{c}}}\\
\mathbf{elif}\;d \leq 1.02 \cdot 10^{+15}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 4.3 \cdot 10^{+139}:\\
\;\;\;\;b \cdot \frac{d}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + t_1}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if d < -4.69999999999999984e75Initial program 28.6%
+-commutative28.6%
fma-udef28.6%
*-un-lft-identity28.6%
associate-*r/28.6%
add-sqr-sqrt28.6%
times-frac28.5%
fma-udef28.5%
+-commutative28.5%
hypot-def28.5%
fma-def28.5%
fma-udef28.5%
+-commutative28.5%
hypot-def46.5%
Applied egg-rr46.5%
associate-*l/46.6%
*-un-lft-identity46.6%
Applied egg-rr46.6%
Taylor expanded in d around -inf 86.0%
distribute-lft-out86.0%
associate-/l*90.1%
Simplified90.1%
if -4.69999999999999984e75 < d < -2.46e-135 or 1.1199999999999999e-138 < d < 1.02e15Initial program 80.1%
if -2.46e-135 < d < 1.1199999999999999e-138Initial program 73.1%
Taylor expanded in c around inf 80.8%
associate-/l*83.9%
Simplified83.9%
pow283.9%
*-un-lft-identity83.9%
times-frac92.5%
Applied egg-rr92.5%
/-rgt-identity92.5%
*-commutative92.5%
associate-/r/92.5%
Applied egg-rr92.5%
if 1.02e15 < d < 4.2999999999999998e139Initial program 53.9%
Taylor expanded in a around 0 54.3%
expm1-log1p-u44.6%
expm1-udef15.5%
add-sqr-sqrt15.5%
hypot-udef15.5%
hypot-udef15.5%
pow215.5%
Applied egg-rr15.5%
expm1-def44.6%
expm1-log1p54.3%
associate-*r/78.9%
Simplified78.9%
if 4.2999999999999998e139 < d Initial program 34.1%
+-commutative34.1%
fma-udef34.1%
*-un-lft-identity34.1%
associate-*r/34.1%
add-sqr-sqrt34.1%
times-frac34.0%
fma-udef34.0%
+-commutative34.0%
hypot-def34.0%
fma-def34.0%
fma-udef34.0%
+-commutative34.0%
hypot-def61.8%
Applied egg-rr61.8%
associate-*l/61.9%
*-un-lft-identity61.9%
Applied egg-rr61.9%
Taylor expanded in c around 0 85.2%
associate-/l*97.8%
Simplified97.8%
Final simplification88.8%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (+ (* d b) (* a c)) (+ (* c c) (* d d)))) (t_1 (/ a (/ d c))))
(if (<= d -4.6e+73)
(/ (- (- b) t_1) (hypot c d))
(if (<= d -2.35e-135)
t_0
(if (<= d 1.08e-138)
(+ (/ a c) (/ b (/ c (/ d c))))
(if (<= d 1.02e+15)
t_0
(if (<= d 1.02e+136)
(/ d (/ (pow (hypot c d) 2.0) b))
(/ (+ b t_1) (hypot c d)))))))))
double code(double a, double b, double c, double d) {
double t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d));
double t_1 = a / (d / c);
double tmp;
if (d <= -4.6e+73) {
tmp = (-b - t_1) / hypot(c, d);
} else if (d <= -2.35e-135) {
tmp = t_0;
} else if (d <= 1.08e-138) {
tmp = (a / c) + (b / (c / (d / c)));
} else if (d <= 1.02e+15) {
tmp = t_0;
} else if (d <= 1.02e+136) {
tmp = d / (pow(hypot(c, d), 2.0) / b);
} else {
tmp = (b + t_1) / hypot(c, d);
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d));
double t_1 = a / (d / c);
double tmp;
if (d <= -4.6e+73) {
tmp = (-b - t_1) / Math.hypot(c, d);
} else if (d <= -2.35e-135) {
tmp = t_0;
} else if (d <= 1.08e-138) {
tmp = (a / c) + (b / (c / (d / c)));
} else if (d <= 1.02e+15) {
tmp = t_0;
} else if (d <= 1.02e+136) {
tmp = d / (Math.pow(Math.hypot(c, d), 2.0) / b);
} else {
tmp = (b + t_1) / Math.hypot(c, d);
}
return tmp;
}
def code(a, b, c, d): t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d)) t_1 = a / (d / c) tmp = 0 if d <= -4.6e+73: tmp = (-b - t_1) / math.hypot(c, d) elif d <= -2.35e-135: tmp = t_0 elif d <= 1.08e-138: tmp = (a / c) + (b / (c / (d / c))) elif d <= 1.02e+15: tmp = t_0 elif d <= 1.02e+136: tmp = d / (math.pow(math.hypot(c, d), 2.0) / b) else: tmp = (b + t_1) / math.hypot(c, d) return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(d * b) + Float64(a * c)) / Float64(Float64(c * c) + Float64(d * d))) t_1 = Float64(a / Float64(d / c)) tmp = 0.0 if (d <= -4.6e+73) tmp = Float64(Float64(Float64(-b) - t_1) / hypot(c, d)); elseif (d <= -2.35e-135) tmp = t_0; elseif (d <= 1.08e-138) tmp = Float64(Float64(a / c) + Float64(b / Float64(c / Float64(d / c)))); elseif (d <= 1.02e+15) tmp = t_0; elseif (d <= 1.02e+136) tmp = Float64(d / Float64((hypot(c, d) ^ 2.0) / b)); else tmp = Float64(Float64(b + t_1) / hypot(c, d)); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d)); t_1 = a / (d / c); tmp = 0.0; if (d <= -4.6e+73) tmp = (-b - t_1) / hypot(c, d); elseif (d <= -2.35e-135) tmp = t_0; elseif (d <= 1.08e-138) tmp = (a / c) + (b / (c / (d / c))); elseif (d <= 1.02e+15) tmp = t_0; elseif (d <= 1.02e+136) tmp = d / ((hypot(c, d) ^ 2.0) / b); else tmp = (b + t_1) / hypot(c, d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(d * b), $MachinePrecision] + N[(a * c), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(a / N[(d / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.6e+73], N[(N[((-b) - t$95$1), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.35e-135], t$95$0, If[LessEqual[d, 1.08e-138], N[(N[(a / c), $MachinePrecision] + N[(b / N[(c / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.02e+15], t$95$0, If[LessEqual[d, 1.02e+136], N[(d / N[(N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], 2.0], $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], N[(N[(b + t$95$1), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{d \cdot b + a \cdot c}{c \cdot c + d \cdot d}\\
t_1 := \frac{a}{\frac{d}{c}}\\
\mathbf{if}\;d \leq -4.6 \cdot 10^{+73}:\\
\;\;\;\;\frac{\left(-b\right) - t_1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;d \leq -2.35 \cdot 10^{-135}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.08 \cdot 10^{-138}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{\frac{c}{\frac{d}{c}}}\\
\mathbf{elif}\;d \leq 1.02 \cdot 10^{+15}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.02 \cdot 10^{+136}:\\
\;\;\;\;\frac{d}{\frac{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}{b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + t_1}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if d < -4.6e73Initial program 28.6%
+-commutative28.6%
fma-udef28.6%
*-un-lft-identity28.6%
associate-*r/28.6%
add-sqr-sqrt28.6%
times-frac28.5%
fma-udef28.5%
+-commutative28.5%
hypot-def28.5%
fma-def28.5%
fma-udef28.5%
+-commutative28.5%
hypot-def46.5%
Applied egg-rr46.5%
associate-*l/46.6%
*-un-lft-identity46.6%
Applied egg-rr46.6%
Taylor expanded in d around -inf 86.0%
distribute-lft-out86.0%
associate-/l*90.1%
Simplified90.1%
if -4.6e73 < d < -2.34999999999999988e-135 or 1.0799999999999999e-138 < d < 1.02e15Initial program 80.1%
if -2.34999999999999988e-135 < d < 1.0799999999999999e-138Initial program 73.1%
Taylor expanded in c around inf 80.8%
associate-/l*83.9%
Simplified83.9%
pow283.9%
*-un-lft-identity83.9%
times-frac92.5%
Applied egg-rr92.5%
/-rgt-identity92.5%
*-commutative92.5%
associate-/r/92.5%
Applied egg-rr92.5%
if 1.02e15 < d < 1.01999999999999996e136Initial program 53.9%
Taylor expanded in a around 0 54.3%
expm1-log1p-u44.6%
expm1-udef15.5%
add-sqr-sqrt15.5%
hypot-udef15.5%
hypot-udef15.5%
pow215.5%
Applied egg-rr15.5%
expm1-def44.6%
expm1-log1p54.3%
associate-*r/78.9%
Simplified78.9%
associate-*r/54.3%
*-commutative54.3%
associate-/l*79.1%
Applied egg-rr79.1%
if 1.01999999999999996e136 < d Initial program 34.1%
+-commutative34.1%
fma-udef34.1%
*-un-lft-identity34.1%
associate-*r/34.1%
add-sqr-sqrt34.1%
times-frac34.0%
fma-udef34.0%
+-commutative34.0%
hypot-def34.0%
fma-def34.0%
fma-udef34.0%
+-commutative34.0%
hypot-def61.8%
Applied egg-rr61.8%
associate-*l/61.9%
*-un-lft-identity61.9%
Applied egg-rr61.9%
Taylor expanded in c around 0 85.2%
associate-/l*97.8%
Simplified97.8%
Final simplification88.8%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (+ (* d b) (* a c)) (+ (* c c) (* d d))))
(t_1 (+ (/ b d) (* (/ c d) (/ a d)))))
(if (<= d -1.35e+79)
t_1
(if (<= d -1.04e-134)
t_0
(if (<= d 1.06e-137)
(+ (/ a c) (/ b (/ c (/ d c))))
(if (<= d 8.4e+15)
t_0
(if (<= d 1.08e+136) (* b (/ 1.0 (hypot c d))) t_1)))))))
double code(double a, double b, double c, double d) {
double t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d));
double t_1 = (b / d) + ((c / d) * (a / d));
double tmp;
if (d <= -1.35e+79) {
tmp = t_1;
} else if (d <= -1.04e-134) {
tmp = t_0;
} else if (d <= 1.06e-137) {
tmp = (a / c) + (b / (c / (d / c)));
} else if (d <= 8.4e+15) {
tmp = t_0;
} else if (d <= 1.08e+136) {
tmp = b * (1.0 / hypot(c, d));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d));
double t_1 = (b / d) + ((c / d) * (a / d));
double tmp;
if (d <= -1.35e+79) {
tmp = t_1;
} else if (d <= -1.04e-134) {
tmp = t_0;
} else if (d <= 1.06e-137) {
tmp = (a / c) + (b / (c / (d / c)));
} else if (d <= 8.4e+15) {
tmp = t_0;
} else if (d <= 1.08e+136) {
tmp = b * (1.0 / Math.hypot(c, d));
} else {
tmp = t_1;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d)) t_1 = (b / d) + ((c / d) * (a / d)) tmp = 0 if d <= -1.35e+79: tmp = t_1 elif d <= -1.04e-134: tmp = t_0 elif d <= 1.06e-137: tmp = (a / c) + (b / (c / (d / c))) elif d <= 8.4e+15: tmp = t_0 elif d <= 1.08e+136: tmp = b * (1.0 / math.hypot(c, d)) else: tmp = t_1 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(d * b) + Float64(a * c)) / Float64(Float64(c * c) + Float64(d * d))) t_1 = Float64(Float64(b / d) + Float64(Float64(c / d) * Float64(a / d))) tmp = 0.0 if (d <= -1.35e+79) tmp = t_1; elseif (d <= -1.04e-134) tmp = t_0; elseif (d <= 1.06e-137) tmp = Float64(Float64(a / c) + Float64(b / Float64(c / Float64(d / c)))); elseif (d <= 8.4e+15) tmp = t_0; elseif (d <= 1.08e+136) tmp = Float64(b * Float64(1.0 / hypot(c, d))); else tmp = t_1; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((d * b) + (a * c)) / ((c * c) + (d * d)); t_1 = (b / d) + ((c / d) * (a / d)); tmp = 0.0; if (d <= -1.35e+79) tmp = t_1; elseif (d <= -1.04e-134) tmp = t_0; elseif (d <= 1.06e-137) tmp = (a / c) + (b / (c / (d / c))); elseif (d <= 8.4e+15) tmp = t_0; elseif (d <= 1.08e+136) tmp = b * (1.0 / hypot(c, d)); else tmp = t_1; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(d * b), $MachinePrecision] + N[(a * c), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b / d), $MachinePrecision] + N[(N[(c / d), $MachinePrecision] * N[(a / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.35e+79], t$95$1, If[LessEqual[d, -1.04e-134], t$95$0, If[LessEqual[d, 1.06e-137], N[(N[(a / c), $MachinePrecision] + N[(b / N[(c / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8.4e+15], t$95$0, If[LessEqual[d, 1.08e+136], N[(b * N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{d \cdot b + a \cdot c}{c \cdot c + d \cdot d}\\
t_1 := \frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\
\mathbf{if}\;d \leq -1.35 \cdot 10^{+79}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -1.04 \cdot 10^{-134}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.06 \cdot 10^{-137}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{\frac{c}{\frac{d}{c}}}\\
\mathbf{elif}\;d \leq 8.4 \cdot 10^{+15}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.08 \cdot 10^{+136}:\\
\;\;\;\;b \cdot \frac{1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if d < -1.35e79 or 1.07999999999999994e136 < d Initial program 31.2%
Taylor expanded in c around 0 75.6%
*-commutative75.6%
pow275.6%
times-frac93.7%
Applied egg-rr93.7%
if -1.35e79 < d < -1.04000000000000002e-134 or 1.06000000000000005e-137 < d < 8.4e15Initial program 80.4%
if -1.04000000000000002e-134 < d < 1.06000000000000005e-137Initial program 73.1%
Taylor expanded in c around inf 80.8%
associate-/l*83.9%
Simplified83.9%
pow283.9%
*-un-lft-identity83.9%
times-frac92.5%
Applied egg-rr92.5%
/-rgt-identity92.5%
*-commutative92.5%
associate-/r/92.5%
Applied egg-rr92.5%
if 8.4e15 < d < 1.07999999999999994e136Initial program 51.9%
+-commutative51.9%
fma-udef51.9%
*-un-lft-identity51.9%
associate-*r/51.9%
add-sqr-sqrt51.9%
times-frac51.8%
fma-udef51.8%
+-commutative51.8%
hypot-def51.8%
fma-def51.8%
fma-udef51.8%
+-commutative51.8%
hypot-def56.4%
Applied egg-rr56.4%
Taylor expanded in c around 0 73.6%
Final simplification88.4%
(FPCore (a b c d)
:precision binary64
(if (<= d -6.5e+73)
(+ (/ b d) (* (/ c d) (/ a d)))
(if (<= d -2.85e-136)
(/ (+ (* d b) (* a c)) (+ (* c c) (* d d)))
(if (<= d 9.2e-20)
(+ (/ a c) (/ b (/ c (/ d c))))
(/ (+ b (/ a (/ d c))) (hypot c d))))))
double code(double a, double b, double c, double d) {
double tmp;
if (d <= -6.5e+73) {
tmp = (b / d) + ((c / d) * (a / d));
} else if (d <= -2.85e-136) {
tmp = ((d * b) + (a * c)) / ((c * c) + (d * d));
} else if (d <= 9.2e-20) {
tmp = (a / c) + (b / (c / (d / c)));
} else {
tmp = (b + (a / (d / c))) / hypot(c, d);
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double tmp;
if (d <= -6.5e+73) {
tmp = (b / d) + ((c / d) * (a / d));
} else if (d <= -2.85e-136) {
tmp = ((d * b) + (a * c)) / ((c * c) + (d * d));
} else if (d <= 9.2e-20) {
tmp = (a / c) + (b / (c / (d / c)));
} else {
tmp = (b + (a / (d / c))) / Math.hypot(c, d);
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if d <= -6.5e+73: tmp = (b / d) + ((c / d) * (a / d)) elif d <= -2.85e-136: tmp = ((d * b) + (a * c)) / ((c * c) + (d * d)) elif d <= 9.2e-20: tmp = (a / c) + (b / (c / (d / c))) else: tmp = (b + (a / (d / c))) / math.hypot(c, d) return tmp
function code(a, b, c, d) tmp = 0.0 if (d <= -6.5e+73) tmp = Float64(Float64(b / d) + Float64(Float64(c / d) * Float64(a / d))); elseif (d <= -2.85e-136) tmp = Float64(Float64(Float64(d * b) + Float64(a * c)) / Float64(Float64(c * c) + Float64(d * d))); elseif (d <= 9.2e-20) tmp = Float64(Float64(a / c) + Float64(b / Float64(c / Float64(d / c)))); else tmp = Float64(Float64(b + Float64(a / Float64(d / c))) / hypot(c, d)); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (d <= -6.5e+73) tmp = (b / d) + ((c / d) * (a / d)); elseif (d <= -2.85e-136) tmp = ((d * b) + (a * c)) / ((c * c) + (d * d)); elseif (d <= 9.2e-20) tmp = (a / c) + (b / (c / (d / c))); else tmp = (b + (a / (d / c))) / hypot(c, d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[d, -6.5e+73], N[(N[(b / d), $MachinePrecision] + N[(N[(c / d), $MachinePrecision] * N[(a / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.85e-136], N[(N[(N[(d * b), $MachinePrecision] + N[(a * c), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.2e-20], N[(N[(a / c), $MachinePrecision] + N[(b / N[(c / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b + N[(a / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -6.5 \cdot 10^{+73}:\\
\;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\
\mathbf{elif}\;d \leq -2.85 \cdot 10^{-136}:\\
\;\;\;\;\frac{d \cdot b + a \cdot c}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;d \leq 9.2 \cdot 10^{-20}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{\frac{c}{\frac{d}{c}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + \frac{a}{\frac{d}{c}}}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if d < -6.5000000000000001e73Initial program 28.6%
Taylor expanded in c around 0 80.4%
*-commutative80.4%
pow280.4%
times-frac89.9%
Applied egg-rr89.9%
if -6.5000000000000001e73 < d < -2.84999999999999982e-136Initial program 77.7%
if -2.84999999999999982e-136 < d < 9.1999999999999997e-20Initial program 75.0%
Taylor expanded in c around inf 78.2%
associate-/l*80.7%
Simplified80.7%
pow280.7%
*-un-lft-identity80.7%
times-frac87.4%
Applied egg-rr87.4%
/-rgt-identity87.4%
*-commutative87.4%
associate-/r/87.4%
Applied egg-rr87.4%
if 9.1999999999999997e-20 < d Initial program 43.1%
+-commutative43.1%
fma-udef43.1%
*-un-lft-identity43.1%
associate-*r/43.1%
add-sqr-sqrt43.1%
times-frac43.1%
fma-udef43.1%
+-commutative43.1%
hypot-def43.1%
fma-def43.1%
fma-udef43.1%
+-commutative43.1%
hypot-def62.2%
Applied egg-rr62.2%
associate-*l/62.4%
*-un-lft-identity62.4%
Applied egg-rr62.4%
Taylor expanded in c around 0 81.2%
associate-/l*89.3%
Simplified89.3%
Final simplification87.0%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ a (/ d c))))
(if (<= d -5.7e+76)
(/ (- (- b) t_0) (hypot c d))
(if (<= d -1.4e-137)
(/ (+ (* d b) (* a c)) (+ (* c c) (* d d)))
(if (<= d 1.25e-17)
(+ (/ a c) (/ b (/ c (/ d c))))
(/ (+ b t_0) (hypot c d)))))))
double code(double a, double b, double c, double d) {
double t_0 = a / (d / c);
double tmp;
if (d <= -5.7e+76) {
tmp = (-b - t_0) / hypot(c, d);
} else if (d <= -1.4e-137) {
tmp = ((d * b) + (a * c)) / ((c * c) + (d * d));
} else if (d <= 1.25e-17) {
tmp = (a / c) + (b / (c / (d / c)));
} else {
tmp = (b + t_0) / hypot(c, d);
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = a / (d / c);
double tmp;
if (d <= -5.7e+76) {
tmp = (-b - t_0) / Math.hypot(c, d);
} else if (d <= -1.4e-137) {
tmp = ((d * b) + (a * c)) / ((c * c) + (d * d));
} else if (d <= 1.25e-17) {
tmp = (a / c) + (b / (c / (d / c)));
} else {
tmp = (b + t_0) / Math.hypot(c, d);
}
return tmp;
}
def code(a, b, c, d): t_0 = a / (d / c) tmp = 0 if d <= -5.7e+76: tmp = (-b - t_0) / math.hypot(c, d) elif d <= -1.4e-137: tmp = ((d * b) + (a * c)) / ((c * c) + (d * d)) elif d <= 1.25e-17: tmp = (a / c) + (b / (c / (d / c))) else: tmp = (b + t_0) / math.hypot(c, d) return tmp
function code(a, b, c, d) t_0 = Float64(a / Float64(d / c)) tmp = 0.0 if (d <= -5.7e+76) tmp = Float64(Float64(Float64(-b) - t_0) / hypot(c, d)); elseif (d <= -1.4e-137) tmp = Float64(Float64(Float64(d * b) + Float64(a * c)) / Float64(Float64(c * c) + Float64(d * d))); elseif (d <= 1.25e-17) tmp = Float64(Float64(a / c) + Float64(b / Float64(c / Float64(d / c)))); else tmp = Float64(Float64(b + t_0) / hypot(c, d)); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = a / (d / c); tmp = 0.0; if (d <= -5.7e+76) tmp = (-b - t_0) / hypot(c, d); elseif (d <= -1.4e-137) tmp = ((d * b) + (a * c)) / ((c * c) + (d * d)); elseif (d <= 1.25e-17) tmp = (a / c) + (b / (c / (d / c))); else tmp = (b + t_0) / hypot(c, d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(a / N[(d / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5.7e+76], N[(N[((-b) - t$95$0), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.4e-137], N[(N[(N[(d * b), $MachinePrecision] + N[(a * c), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.25e-17], N[(N[(a / c), $MachinePrecision] + N[(b / N[(c / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b + t$95$0), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{\frac{d}{c}}\\
\mathbf{if}\;d \leq -5.7 \cdot 10^{+76}:\\
\;\;\;\;\frac{\left(-b\right) - t_0}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;d \leq -1.4 \cdot 10^{-137}:\\
\;\;\;\;\frac{d \cdot b + a \cdot c}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;d \leq 1.25 \cdot 10^{-17}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{\frac{c}{\frac{d}{c}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + t_0}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if d < -5.70000000000000004e76Initial program 28.6%
+-commutative28.6%
fma-udef28.6%
*-un-lft-identity28.6%
associate-*r/28.6%
add-sqr-sqrt28.6%
times-frac28.5%
fma-udef28.5%
+-commutative28.5%
hypot-def28.5%
fma-def28.5%
fma-udef28.5%
+-commutative28.5%
hypot-def46.5%
Applied egg-rr46.5%
associate-*l/46.6%
*-un-lft-identity46.6%
Applied egg-rr46.6%
Taylor expanded in d around -inf 86.0%
distribute-lft-out86.0%
associate-/l*90.1%
Simplified90.1%
if -5.70000000000000004e76 < d < -1.3999999999999999e-137Initial program 77.7%
if -1.3999999999999999e-137 < d < 1.25e-17Initial program 75.0%
Taylor expanded in c around inf 78.2%
associate-/l*80.7%
Simplified80.7%
pow280.7%
*-un-lft-identity80.7%
times-frac87.4%
Applied egg-rr87.4%
/-rgt-identity87.4%
*-commutative87.4%
associate-/r/87.4%
Applied egg-rr87.4%
if 1.25e-17 < d Initial program 43.1%
+-commutative43.1%
fma-udef43.1%
*-un-lft-identity43.1%
associate-*r/43.1%
add-sqr-sqrt43.1%
times-frac43.1%
fma-udef43.1%
+-commutative43.1%
hypot-def43.1%
fma-def43.1%
fma-udef43.1%
+-commutative43.1%
hypot-def62.2%
Applied egg-rr62.2%
associate-*l/62.4%
*-un-lft-identity62.4%
Applied egg-rr62.4%
Taylor expanded in c around 0 81.2%
associate-/l*89.3%
Simplified89.3%
Final simplification87.0%
(FPCore (a b c d)
:precision binary64
(if (<= d -34000000000.0)
(/ b d)
(if (<= d -1.62e-68)
(/ a c)
(if (<= d -2.3e-70)
(/ b d)
(if (<= d -2.35e-232)
(/ (* b (/ d c)) c)
(if (<= d 0.00037) (/ a c) (/ b d)))))))
double code(double a, double b, double c, double d) {
double tmp;
if (d <= -34000000000.0) {
tmp = b / d;
} else if (d <= -1.62e-68) {
tmp = a / c;
} else if (d <= -2.3e-70) {
tmp = b / d;
} else if (d <= -2.35e-232) {
tmp = (b * (d / c)) / c;
} else if (d <= 0.00037) {
tmp = a / c;
} else {
tmp = b / d;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if (d <= (-34000000000.0d0)) then
tmp = b / d
else if (d <= (-1.62d-68)) then
tmp = a / c
else if (d <= (-2.3d-70)) then
tmp = b / d
else if (d <= (-2.35d-232)) then
tmp = (b * (d / c)) / c
else if (d <= 0.00037d0) then
tmp = a / c
else
tmp = b / d
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if (d <= -34000000000.0) {
tmp = b / d;
} else if (d <= -1.62e-68) {
tmp = a / c;
} else if (d <= -2.3e-70) {
tmp = b / d;
} else if (d <= -2.35e-232) {
tmp = (b * (d / c)) / c;
} else if (d <= 0.00037) {
tmp = a / c;
} else {
tmp = b / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if d <= -34000000000.0: tmp = b / d elif d <= -1.62e-68: tmp = a / c elif d <= -2.3e-70: tmp = b / d elif d <= -2.35e-232: tmp = (b * (d / c)) / c elif d <= 0.00037: tmp = a / c else: tmp = b / d return tmp
function code(a, b, c, d) tmp = 0.0 if (d <= -34000000000.0) tmp = Float64(b / d); elseif (d <= -1.62e-68) tmp = Float64(a / c); elseif (d <= -2.3e-70) tmp = Float64(b / d); elseif (d <= -2.35e-232) tmp = Float64(Float64(b * Float64(d / c)) / c); elseif (d <= 0.00037) tmp = Float64(a / c); else tmp = Float64(b / d); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (d <= -34000000000.0) tmp = b / d; elseif (d <= -1.62e-68) tmp = a / c; elseif (d <= -2.3e-70) tmp = b / d; elseif (d <= -2.35e-232) tmp = (b * (d / c)) / c; elseif (d <= 0.00037) tmp = a / c; else tmp = b / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[d, -34000000000.0], N[(b / d), $MachinePrecision], If[LessEqual[d, -1.62e-68], N[(a / c), $MachinePrecision], If[LessEqual[d, -2.3e-70], N[(b / d), $MachinePrecision], If[LessEqual[d, -2.35e-232], N[(N[(b * N[(d / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 0.00037], N[(a / c), $MachinePrecision], N[(b / d), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -34000000000:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;d \leq -1.62 \cdot 10^{-68}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{elif}\;d \leq -2.3 \cdot 10^{-70}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;d \leq -2.35 \cdot 10^{-232}:\\
\;\;\;\;\frac{b \cdot \frac{d}{c}}{c}\\
\mathbf{elif}\;d \leq 0.00037:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{d}\\
\end{array}
\end{array}
if d < -3.4e10 or -1.62000000000000005e-68 < d < -2.30000000000000001e-70 or 3.6999999999999999e-4 < d Initial program 41.5%
Taylor expanded in c around 0 73.9%
if -3.4e10 < d < -1.62000000000000005e-68 or -2.35000000000000017e-232 < d < 3.6999999999999999e-4Initial program 71.3%
Taylor expanded in c around inf 60.5%
if -2.30000000000000001e-70 < d < -2.35000000000000017e-232Initial program 85.2%
Taylor expanded in a around 0 62.3%
Taylor expanded in d around 0 54.7%
associate-*r/50.8%
Simplified50.8%
associate-*r/54.7%
unpow254.7%
associate-/r*58.2%
associate-*l/54.5%
associate-/r/58.1%
div-inv58.2%
clear-num58.3%
Applied egg-rr58.3%
Final simplification67.1%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (+ (/ b d) (* (/ c d) (/ a d)))))
(if (<= d -1.75e+78)
t_0
(if (<= d -2.46e-135)
(/ (+ (* d b) (* a c)) (+ (* c c) (* d d)))
(if (<= d 1.02e-19) (+ (/ a c) (/ b (/ c (/ d c)))) t_0)))))
double code(double a, double b, double c, double d) {
double t_0 = (b / d) + ((c / d) * (a / d));
double tmp;
if (d <= -1.75e+78) {
tmp = t_0;
} else if (d <= -2.46e-135) {
tmp = ((d * b) + (a * c)) / ((c * c) + (d * d));
} else if (d <= 1.02e-19) {
tmp = (a / c) + (b / (c / (d / c)));
} else {
tmp = t_0;
}
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 = (b / d) + ((c / d) * (a / d))
if (d <= (-1.75d+78)) then
tmp = t_0
else if (d <= (-2.46d-135)) then
tmp = ((d * b) + (a * c)) / ((c * c) + (d * d))
else if (d <= 1.02d-19) then
tmp = (a / c) + (b / (c / (d / c)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double t_0 = (b / d) + ((c / d) * (a / d));
double tmp;
if (d <= -1.75e+78) {
tmp = t_0;
} else if (d <= -2.46e-135) {
tmp = ((d * b) + (a * c)) / ((c * c) + (d * d));
} else if (d <= 1.02e-19) {
tmp = (a / c) + (b / (c / (d / c)));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, c, d): t_0 = (b / d) + ((c / d) * (a / d)) tmp = 0 if d <= -1.75e+78: tmp = t_0 elif d <= -2.46e-135: tmp = ((d * b) + (a * c)) / ((c * c) + (d * d)) elif d <= 1.02e-19: tmp = (a / c) + (b / (c / (d / c))) else: tmp = t_0 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(b / d) + Float64(Float64(c / d) * Float64(a / d))) tmp = 0.0 if (d <= -1.75e+78) tmp = t_0; elseif (d <= -2.46e-135) tmp = Float64(Float64(Float64(d * b) + Float64(a * c)) / Float64(Float64(c * c) + Float64(d * d))); elseif (d <= 1.02e-19) tmp = Float64(Float64(a / c) + Float64(b / Float64(c / Float64(d / c)))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (b / d) + ((c / d) * (a / d)); tmp = 0.0; if (d <= -1.75e+78) tmp = t_0; elseif (d <= -2.46e-135) tmp = ((d * b) + (a * c)) / ((c * c) + (d * d)); elseif (d <= 1.02e-19) tmp = (a / c) + (b / (c / (d / c))); else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b / d), $MachinePrecision] + N[(N[(c / d), $MachinePrecision] * N[(a / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.75e+78], t$95$0, If[LessEqual[d, -2.46e-135], N[(N[(N[(d * b), $MachinePrecision] + N[(a * c), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.02e-19], N[(N[(a / c), $MachinePrecision] + N[(b / N[(c / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\
\mathbf{if}\;d \leq -1.75 \cdot 10^{+78}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -2.46 \cdot 10^{-135}:\\
\;\;\;\;\frac{d \cdot b + a \cdot c}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;d \leq 1.02 \cdot 10^{-19}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{\frac{c}{\frac{d}{c}}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d < -1.7500000000000001e78 or 1.02000000000000004e-19 < d Initial program 37.2%
Taylor expanded in c around 0 74.5%
*-commutative74.5%
pow274.5%
times-frac88.8%
Applied egg-rr88.8%
if -1.7500000000000001e78 < d < -2.46e-135Initial program 77.7%
if -2.46e-135 < d < 1.02000000000000004e-19Initial program 75.0%
Taylor expanded in c around inf 78.2%
associate-/l*80.7%
Simplified80.7%
pow280.7%
*-un-lft-identity80.7%
times-frac87.4%
Applied egg-rr87.4%
/-rgt-identity87.4%
*-commutative87.4%
associate-/r/87.4%
Applied egg-rr87.4%
Final simplification86.6%
(FPCore (a b c d) :precision binary64 (if (or (<= d -240000000000.0) (not (<= d 1.75e+16))) (/ b d) (+ (/ a c) (/ b (/ c (/ d c))))))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -240000000000.0) || !(d <= 1.75e+16)) {
tmp = b / d;
} else {
tmp = (a / c) + (b / (c / (d / 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 <= (-240000000000.0d0)) .or. (.not. (d <= 1.75d+16))) then
tmp = b / d
else
tmp = (a / c) + (b / (c / (d / c)))
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -240000000000.0) || !(d <= 1.75e+16)) {
tmp = b / d;
} else {
tmp = (a / c) + (b / (c / (d / c)));
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -240000000000.0) or not (d <= 1.75e+16): tmp = b / d else: tmp = (a / c) + (b / (c / (d / c))) return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -240000000000.0) || !(d <= 1.75e+16)) tmp = Float64(b / d); else tmp = Float64(Float64(a / c) + Float64(b / Float64(c / Float64(d / c)))); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((d <= -240000000000.0) || ~((d <= 1.75e+16))) tmp = b / d; else tmp = (a / c) + (b / (c / (d / c))); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -240000000000.0], N[Not[LessEqual[d, 1.75e+16]], $MachinePrecision]], N[(b / d), $MachinePrecision], N[(N[(a / c), $MachinePrecision] + N[(b / N[(c / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -240000000000 \lor \neg \left(d \leq 1.75 \cdot 10^{+16}\right):\\
\;\;\;\;\frac{b}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{\frac{c}{\frac{d}{c}}}\\
\end{array}
\end{array}
if d < -2.4e11 or 1.75e16 < d Initial program 39.6%
Taylor expanded in c around 0 74.9%
if -2.4e11 < d < 1.75e16Initial program 74.4%
Taylor expanded in c around inf 70.8%
associate-/l*72.0%
Simplified72.0%
pow272.0%
*-un-lft-identity72.0%
times-frac76.9%
Applied egg-rr76.9%
/-rgt-identity76.9%
*-commutative76.9%
associate-/r/76.9%
Applied egg-rr76.9%
Final simplification76.0%
(FPCore (a b c d) :precision binary64 (if (or (<= d -35000000000.0) (not (<= d 7e-17))) (+ (/ b d) (* (/ c d) (/ a d))) (+ (/ a c) (/ b (/ c (/ d c))))))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -35000000000.0) || !(d <= 7e-17)) {
tmp = (b / d) + ((c / d) * (a / d));
} else {
tmp = (a / c) + (b / (c / (d / 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 <= (-35000000000.0d0)) .or. (.not. (d <= 7d-17))) then
tmp = (b / d) + ((c / d) * (a / d))
else
tmp = (a / c) + (b / (c / (d / c)))
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -35000000000.0) || !(d <= 7e-17)) {
tmp = (b / d) + ((c / d) * (a / d));
} else {
tmp = (a / c) + (b / (c / (d / c)));
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -35000000000.0) or not (d <= 7e-17): tmp = (b / d) + ((c / d) * (a / d)) else: tmp = (a / c) + (b / (c / (d / c))) return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -35000000000.0) || !(d <= 7e-17)) tmp = Float64(Float64(b / d) + Float64(Float64(c / d) * Float64(a / d))); else tmp = Float64(Float64(a / c) + Float64(b / Float64(c / Float64(d / c)))); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((d <= -35000000000.0) || ~((d <= 7e-17))) tmp = (b / d) + ((c / d) * (a / d)); else tmp = (a / c) + (b / (c / (d / c))); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -35000000000.0], N[Not[LessEqual[d, 7e-17]], $MachinePrecision]], N[(N[(b / d), $MachinePrecision] + N[(N[(c / d), $MachinePrecision] * N[(a / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / c), $MachinePrecision] + N[(b / N[(c / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -35000000000 \lor \neg \left(d \leq 7 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{\frac{c}{\frac{d}{c}}}\\
\end{array}
\end{array}
if d < -3.5e10 or 7.0000000000000003e-17 < d Initial program 41.1%
Taylor expanded in c around 0 74.9%
*-commutative74.9%
pow274.9%
times-frac88.3%
Applied egg-rr88.3%
if -3.5e10 < d < 7.0000000000000003e-17Initial program 74.2%
Taylor expanded in c around inf 72.0%
associate-/l*73.1%
Simplified73.1%
pow273.1%
*-un-lft-identity73.1%
times-frac78.2%
Applied egg-rr78.2%
/-rgt-identity78.2%
*-commutative78.2%
associate-/r/78.3%
Applied egg-rr78.3%
Final simplification83.3%
(FPCore (a b c d) :precision binary64 (if (or (<= d -8200000000.0) (not (<= d 6.5e-9))) (/ b d) (/ a c)))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -8200000000.0) || !(d <= 6.5e-9)) {
tmp = b / d;
} else {
tmp = a / c;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((d <= (-8200000000.0d0)) .or. (.not. (d <= 6.5d-9))) then
tmp = b / d
else
tmp = a / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -8200000000.0) || !(d <= 6.5e-9)) {
tmp = b / d;
} else {
tmp = a / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -8200000000.0) or not (d <= 6.5e-9): tmp = b / d else: tmp = a / c return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -8200000000.0) || !(d <= 6.5e-9)) tmp = Float64(b / d); else tmp = Float64(a / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((d <= -8200000000.0) || ~((d <= 6.5e-9))) tmp = b / d; else tmp = a / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -8200000000.0], N[Not[LessEqual[d, 6.5e-9]], $MachinePrecision]], N[(b / d), $MachinePrecision], N[(a / c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -8200000000 \lor \neg \left(d \leq 6.5 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{b}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\end{array}
if d < -8.2e9 or 6.5000000000000003e-9 < d Initial program 40.6%
Taylor expanded in c around 0 73.5%
if -8.2e9 < d < 6.5000000000000003e-9Initial program 74.4%
Taylor expanded in c around inf 56.9%
Final simplification65.2%
(FPCore (a b c d) :precision binary64 (if (<= d 2.05e+134) (/ a c) (/ a d)))
double code(double a, double b, double c, double d) {
double tmp;
if (d <= 2.05e+134) {
tmp = a / 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 (d <= 2.05d+134) then
tmp = a / 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 (d <= 2.05e+134) {
tmp = a / c;
} else {
tmp = a / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if d <= 2.05e+134: tmp = a / c else: tmp = a / d return tmp
function code(a, b, c, d) tmp = 0.0 if (d <= 2.05e+134) tmp = Float64(a / c); else tmp = Float64(a / d); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (d <= 2.05e+134) tmp = a / c; else tmp = a / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[d, 2.05e+134], N[(a / c), $MachinePrecision], N[(a / d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 2.05 \cdot 10^{+134}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{d}\\
\end{array}
\end{array}
if d < 2.0500000000000002e134Initial program 62.5%
Taylor expanded in c around inf 39.9%
if 2.0500000000000002e134 < d Initial program 35.5%
+-commutative35.5%
fma-udef35.5%
*-un-lft-identity35.5%
associate-*r/35.5%
add-sqr-sqrt35.5%
times-frac35.4%
fma-udef35.4%
+-commutative35.4%
hypot-def35.4%
fma-def35.4%
fma-udef35.4%
+-commutative35.4%
hypot-def62.6%
Applied egg-rr62.6%
associate-*l/62.7%
*-un-lft-identity62.7%
Applied egg-rr62.7%
Taylor expanded in c around 0 85.3%
associate-/l*97.7%
Simplified97.7%
Taylor expanded in d around 0 22.4%
Final simplification36.7%
(FPCore (a b c d) :precision binary64 (/ a c))
double code(double a, double b, double c, double d) {
return a / c;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = a / c
end function
public static double code(double a, double b, double c, double d) {
return a / c;
}
def code(a, b, c, d): return a / c
function code(a, b, c, d) return Float64(a / c) end
function tmp = code(a, b, c, d) tmp = a / c; end
code[a_, b_, c_, d_] := N[(a / c), $MachinePrecision]
\begin{array}{l}
\\
\frac{a}{c}
\end{array}
Initial program 57.5%
Taylor expanded in c around inf 33.7%
Final simplification33.7%
(FPCore (a b c d) :precision binary64 (if (< (fabs d) (fabs c)) (/ (+ a (* b (/ d c))) (+ c (* d (/ d c)))) (/ (+ b (* a (/ c d))) (+ d (* c (/ c d))))))
double code(double a, double b, double c, double d) {
double tmp;
if (fabs(d) < fabs(c)) {
tmp = (a + (b * (d / c))) / (c + (d * (d / c)));
} else {
tmp = (b + (a * (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 = (a + (b * (d / c))) / (c + (d * (d / c)))
else
tmp = (b + (a * (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 = (a + (b * (d / c))) / (c + (d * (d / c)));
} else {
tmp = (b + (a * (c / d))) / (d + (c * (c / d)));
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if math.fabs(d) < math.fabs(c): tmp = (a + (b * (d / c))) / (c + (d * (d / c))) else: tmp = (b + (a * (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(a + Float64(b * Float64(d / c))) / Float64(c + Float64(d * Float64(d / c)))); else tmp = Float64(Float64(b + Float64(a * 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 = (a + (b * (d / c))) / (c + (d * (d / c))); else tmp = (b + (a * (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[(a + N[(b * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c + N[(d * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b + N[(a * 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{a + b \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + a \cdot \frac{c}{d}}{d + c \cdot \frac{c}{d}}\\
\end{array}
\end{array}
herbie shell --seed 2024018
(FPCore (a b c d)
:name "Complex division, real part"
:precision binary64
:herbie-target
(if (< (fabs d) (fabs c)) (/ (+ a (* b (/ d c))) (+ c (* d (/ d c)))) (/ (+ b (* a (/ c d))) (+ d (* c (/ c d)))))
(/ (+ (* a c) (* b d)) (+ (* c c) (* d d))))