
(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 16 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
(if (or (<= d -1.1e+86) (not (<= d 8.8e+136)))
(* (/ d (hypot d c)) (/ (- (* b (/ c d)) a) (hypot d c)))
(fma
(/ c (hypot c d))
(/ b (hypot c d))
(/ (- (/ (* a d) (hypot d c))) (hypot d c)))))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -1.1e+86) || !(d <= 8.8e+136)) {
tmp = (d / hypot(d, c)) * (((b * (c / d)) - a) / hypot(d, c));
} else {
tmp = fma((c / hypot(c, d)), (b / hypot(c, d)), (-((a * d) / hypot(d, c)) / hypot(d, c)));
}
return tmp;
}
function code(a, b, c, d) tmp = 0.0 if ((d <= -1.1e+86) || !(d <= 8.8e+136)) tmp = Float64(Float64(d / hypot(d, c)) * Float64(Float64(Float64(b * Float64(c / d)) - a) / hypot(d, c))); else tmp = fma(Float64(c / hypot(c, d)), Float64(b / hypot(c, d)), Float64(Float64(-Float64(Float64(a * d) / hypot(d, c))) / hypot(d, c))); end return tmp end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -1.1e+86], N[Not[LessEqual[d, 8.8e+136]], $MachinePrecision]], N[(N[(d / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] + N[((-N[(N[(a * d), $MachinePrecision] / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision]) / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.1 \cdot 10^{+86} \lor \neg \left(d \leq 8.8 \cdot 10^{+136}\right):\\
\;\;\;\;\frac{d}{\mathsf{hypot}\left(d, c\right)} \cdot \frac{b \cdot \frac{c}{d} - a}{\mathsf{hypot}\left(d, c\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{-\frac{a \cdot d}{\mathsf{hypot}\left(d, c\right)}}{\mathsf{hypot}\left(d, c\right)}\right)\\
\end{array}
\end{array}
if d < -1.10000000000000002e86 or 8.7999999999999998e136 < d Initial program 35.1%
Taylor expanded in d around inf 35.1%
associate-/l*32.9%
Simplified32.9%
*-commutative32.9%
+-commutative32.9%
add-sqr-sqrt32.9%
hypot-undefine32.9%
hypot-undefine32.9%
times-frac97.6%
Applied egg-rr97.6%
if -1.10000000000000002e86 < d < 8.7999999999999998e136Initial program 74.4%
div-sub72.5%
*-commutative72.5%
add-sqr-sqrt72.5%
times-frac74.1%
fma-neg74.1%
hypot-define74.1%
hypot-define93.3%
associate-/l*91.7%
add-sqr-sqrt91.7%
pow291.7%
hypot-define91.7%
Applied egg-rr91.7%
associate-*r/93.3%
remove-double-neg93.3%
distribute-lft-neg-out93.3%
unpow293.3%
associate-/r*98.1%
distribute-lft-neg-out98.1%
remove-double-neg98.1%
*-commutative98.1%
hypot-undefine93.4%
+-commutative93.4%
hypot-define98.1%
hypot-undefine93.4%
+-commutative93.4%
hypot-define98.1%
Applied egg-rr98.1%
Final simplification97.9%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ c (hypot c d))) (t_1 (/ b (hypot c d))))
(if (<= (/ (- (* b c) (* a d)) (+ (* c c) (* d d))) 2e+265)
(fma t_0 t_1 (/ (- (/ (* a d) (hypot d c))) (hypot d c)))
(fma t_0 t_1 (* a (* (/ d (hypot d c)) (/ -1.0 (hypot d c))))))))
double code(double a, double b, double c, double d) {
double t_0 = c / hypot(c, d);
double t_1 = b / hypot(c, d);
double tmp;
if ((((b * c) - (a * d)) / ((c * c) + (d * d))) <= 2e+265) {
tmp = fma(t_0, t_1, (-((a * d) / hypot(d, c)) / hypot(d, c)));
} else {
tmp = fma(t_0, t_1, (a * ((d / hypot(d, c)) * (-1.0 / hypot(d, c)))));
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(c / hypot(c, d)) t_1 = Float64(b / hypot(c, d)) tmp = 0.0 if (Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))) <= 2e+265) tmp = fma(t_0, t_1, Float64(Float64(-Float64(Float64(a * d) / hypot(d, c))) / hypot(d, c))); else tmp = fma(t_0, t_1, Float64(a * Float64(Float64(d / hypot(d, c)) * Float64(-1.0 / hypot(d, c))))); end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(c / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+265], N[(t$95$0 * t$95$1 + N[((-N[(N[(a * d), $MachinePrecision] / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision]) / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * t$95$1 + N[(a * N[(N[(d / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := \frac{b}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \leq 2 \cdot 10^{+265}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_1, \frac{-\frac{a \cdot d}{\mathsf{hypot}\left(d, c\right)}}{\mathsf{hypot}\left(d, c\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_1, a \cdot \left(\frac{d}{\mathsf{hypot}\left(d, c\right)} \cdot \frac{-1}{\mathsf{hypot}\left(d, c\right)}\right)\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < 2.00000000000000013e265Initial program 79.5%
div-sub79.5%
*-commutative79.5%
add-sqr-sqrt79.5%
times-frac79.1%
fma-neg79.1%
hypot-define79.1%
hypot-define88.0%
associate-/l*87.0%
add-sqr-sqrt86.9%
pow286.9%
hypot-define86.9%
Applied egg-rr86.9%
associate-*r/88.0%
remove-double-neg88.0%
distribute-lft-neg-out88.0%
unpow288.0%
associate-/r*97.3%
distribute-lft-neg-out97.3%
remove-double-neg97.3%
*-commutative97.3%
hypot-undefine88.0%
+-commutative88.0%
hypot-define97.3%
hypot-undefine88.0%
+-commutative88.0%
hypot-define97.3%
Applied egg-rr97.3%
if 2.00000000000000013e265 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) Initial program 12.0%
div-sub7.5%
*-commutative7.5%
add-sqr-sqrt7.5%
times-frac10.3%
fma-neg10.3%
hypot-define10.3%
hypot-define46.7%
associate-/l*56.8%
add-sqr-sqrt56.8%
pow256.8%
hypot-define56.8%
Applied egg-rr56.8%
*-un-lft-identity56.8%
unpow256.8%
times-frac98.6%
hypot-undefine56.8%
+-commutative56.8%
hypot-define98.6%
hypot-undefine56.8%
+-commutative56.8%
hypot-define98.6%
Applied egg-rr98.6%
Final simplification97.6%
(FPCore (a b c d)
:precision binary64
(if (or (<= d -1e+78) (not (<= d 5e+137)))
(* (/ d (hypot d c)) (/ (- (* b (/ c d)) a) (hypot d c)))
(fma
(/ c (hypot c d))
(/ b (hypot c d))
(* a (/ (- d) (pow (hypot c d) 2.0))))))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -1e+78) || !(d <= 5e+137)) {
tmp = (d / hypot(d, c)) * (((b * (c / d)) - a) / hypot(d, c));
} else {
tmp = fma((c / hypot(c, d)), (b / hypot(c, d)), (a * (-d / pow(hypot(c, d), 2.0))));
}
return tmp;
}
function code(a, b, c, d) tmp = 0.0 if ((d <= -1e+78) || !(d <= 5e+137)) tmp = Float64(Float64(d / hypot(d, c)) * Float64(Float64(Float64(b * Float64(c / d)) - a) / hypot(d, c))); else tmp = fma(Float64(c / hypot(c, d)), Float64(b / hypot(c, d)), Float64(a * Float64(Float64(-d) / (hypot(c, d) ^ 2.0)))); end return tmp end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -1e+78], N[Not[LessEqual[d, 5e+137]], $MachinePrecision]], N[(N[(d / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] + N[(a * N[((-d) / N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1 \cdot 10^{+78} \lor \neg \left(d \leq 5 \cdot 10^{+137}\right):\\
\;\;\;\;\frac{d}{\mathsf{hypot}\left(d, c\right)} \cdot \frac{b \cdot \frac{c}{d} - a}{\mathsf{hypot}\left(d, c\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, a \cdot \frac{-d}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}\right)\\
\end{array}
\end{array}
if d < -1.00000000000000001e78 or 5.0000000000000002e137 < d Initial program 35.1%
Taylor expanded in d around inf 35.1%
associate-/l*33.0%
Simplified33.0%
*-commutative33.0%
+-commutative33.0%
add-sqr-sqrt33.0%
hypot-undefine33.0%
hypot-undefine33.0%
times-frac97.7%
Applied egg-rr97.7%
if -1.00000000000000001e78 < d < 5.0000000000000002e137Initial program 75.0%
div-sub73.1%
*-commutative73.1%
add-sqr-sqrt73.1%
times-frac74.8%
fma-neg74.8%
hypot-define74.8%
hypot-define93.8%
associate-/l*92.1%
add-sqr-sqrt92.1%
pow292.1%
hypot-define92.1%
Applied egg-rr92.1%
Final simplification94.0%
(FPCore (a b c d)
:precision binary64
(if (<= c -1.1e+136)
(/ (/ c (hypot d c)) (/ (hypot d c) b))
(if (<= c -3.6e-65)
(/ (- (* b c) (* a d)) (+ (* c c) (* d d)))
(if (<= c 1.16e-80)
(/ (- (/ (* b c) d) a) d)
(if (<= c 7.8e+119)
(/ (fma b c (* a (- d))) (fma d d (* c c)))
(/ (- b (/ d (/ c a))) c))))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -1.1e+136) {
tmp = (c / hypot(d, c)) / (hypot(d, c) / b);
} else if (c <= -3.6e-65) {
tmp = ((b * c) - (a * d)) / ((c * c) + (d * d));
} else if (c <= 1.16e-80) {
tmp = (((b * c) / d) - a) / d;
} else if (c <= 7.8e+119) {
tmp = fma(b, c, (a * -d)) / fma(d, d, (c * c));
} else {
tmp = (b - (d / (c / a))) / c;
}
return tmp;
}
function code(a, b, c, d) tmp = 0.0 if (c <= -1.1e+136) tmp = Float64(Float64(c / hypot(d, c)) / Float64(hypot(d, c) / b)); elseif (c <= -3.6e-65) tmp = Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))); elseif (c <= 1.16e-80) tmp = Float64(Float64(Float64(Float64(b * c) / d) - a) / d); elseif (c <= 7.8e+119) tmp = Float64(fma(b, c, Float64(a * Float64(-d))) / fma(d, d, Float64(c * c))); else tmp = Float64(Float64(b - Float64(d / Float64(c / a))) / c); end return tmp end
code[a_, b_, c_, d_] := If[LessEqual[c, -1.1e+136], N[(N[(c / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -3.6e-65], N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.16e-80], N[(N[(N[(N[(b * c), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 7.8e+119], N[(N[(b * c + N[(a * (-d)), $MachinePrecision]), $MachinePrecision] / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b - N[(d / N[(c / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.1 \cdot 10^{+136}:\\
\;\;\;\;\frac{\frac{c}{\mathsf{hypot}\left(d, c\right)}}{\frac{\mathsf{hypot}\left(d, c\right)}{b}}\\
\mathbf{elif}\;c \leq -3.6 \cdot 10^{-65}:\\
\;\;\;\;\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;c \leq 1.16 \cdot 10^{-80}:\\
\;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\
\mathbf{elif}\;c \leq 7.8 \cdot 10^{+119}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, c, a \cdot \left(-d\right)\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\end{array}
\end{array}
if c < -1.1e136Initial program 46.0%
Taylor expanded in b around inf 46.2%
rem-square-sqrt46.2%
unpow246.2%
unpow246.2%
hypot-undefine46.2%
unpow246.2%
unpow246.2%
hypot-undefine46.2%
unpow246.2%
*-commutative46.2%
associate-*r/47.4%
hypot-undefine47.4%
unpow247.4%
unpow247.4%
+-commutative47.4%
unpow247.4%
unpow247.4%
hypot-define47.4%
Simplified47.4%
associate-*r/46.2%
unpow246.2%
frac-times90.1%
hypot-undefine47.4%
+-commutative47.4%
hypot-undefine90.1%
hypot-undefine47.4%
+-commutative47.4%
hypot-undefine90.1%
clear-num89.8%
un-div-inv89.8%
hypot-undefine47.4%
+-commutative47.4%
hypot-undefine89.8%
hypot-undefine47.4%
+-commutative47.4%
hypot-undefine89.8%
Applied egg-rr89.8%
if -1.1e136 < c < -3.5999999999999998e-65Initial program 72.7%
if -3.5999999999999998e-65 < c < 1.15999999999999996e-80Initial program 68.5%
div-sub64.9%
*-commutative64.9%
add-sqr-sqrt64.9%
times-frac60.8%
fma-neg60.8%
hypot-define60.8%
hypot-define64.2%
associate-/l*67.9%
add-sqr-sqrt67.9%
pow267.9%
hypot-define67.9%
Applied egg-rr67.9%
Taylor expanded in d around inf 93.8%
if 1.15999999999999996e-80 < c < 7.7999999999999997e119Initial program 72.6%
fma-neg72.6%
distribute-rgt-neg-out72.6%
+-commutative72.6%
fma-define72.6%
Simplified72.6%
if 7.7999999999999997e119 < c Initial program 41.2%
div-sub41.2%
*-commutative41.2%
add-sqr-sqrt41.2%
times-frac42.3%
fma-neg42.3%
hypot-define42.3%
hypot-define82.6%
associate-/l*83.1%
add-sqr-sqrt83.1%
pow283.1%
hypot-define83.1%
Applied egg-rr83.1%
Taylor expanded in c around inf 87.9%
mul-1-neg87.9%
*-commutative87.9%
associate-*r/94.5%
unsub-neg94.5%
Simplified94.5%
clear-num94.5%
un-div-inv94.5%
Applied egg-rr94.5%
(FPCore (a b c d) :precision binary64 (if (or (<= d -2.1e-82) (not (<= d 2.8e-108))) (* (/ d (hypot d c)) (/ (- (* b (/ c d)) a) (hypot d c))) (/ (- b (/ (* a d) c)) c)))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -2.1e-82) || !(d <= 2.8e-108)) {
tmp = (d / hypot(d, c)) * (((b * (c / d)) - a) / hypot(d, c));
} else {
tmp = (b - ((a * d) / c)) / c;
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -2.1e-82) || !(d <= 2.8e-108)) {
tmp = (d / Math.hypot(d, c)) * (((b * (c / d)) - a) / Math.hypot(d, c));
} else {
tmp = (b - ((a * d) / c)) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -2.1e-82) or not (d <= 2.8e-108): tmp = (d / math.hypot(d, c)) * (((b * (c / d)) - a) / math.hypot(d, c)) else: tmp = (b - ((a * d) / c)) / c return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -2.1e-82) || !(d <= 2.8e-108)) tmp = Float64(Float64(d / hypot(d, c)) * Float64(Float64(Float64(b * Float64(c / d)) - a) / hypot(d, c))); else tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((d <= -2.1e-82) || ~((d <= 2.8e-108))) tmp = (d / hypot(d, c)) * (((b * (c / d)) - a) / hypot(d, c)); else tmp = (b - ((a * d) / c)) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -2.1e-82], N[Not[LessEqual[d, 2.8e-108]], $MachinePrecision]], N[(N[(d / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.1 \cdot 10^{-82} \lor \neg \left(d \leq 2.8 \cdot 10^{-108}\right):\\
\;\;\;\;\frac{d}{\mathsf{hypot}\left(d, c\right)} \cdot \frac{b \cdot \frac{c}{d} - a}{\mathsf{hypot}\left(d, c\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
\end{array}
\end{array}
if d < -2.1e-82 or 2.8e-108 < d Initial program 55.8%
Taylor expanded in d around inf 55.3%
associate-/l*53.6%
Simplified53.6%
*-commutative53.6%
+-commutative53.6%
add-sqr-sqrt53.6%
hypot-undefine53.6%
hypot-undefine53.6%
times-frac93.2%
Applied egg-rr93.2%
if -2.1e-82 < d < 2.8e-108Initial program 73.3%
Taylor expanded in c around inf 95.2%
remove-double-neg95.2%
mul-1-neg95.2%
neg-mul-195.2%
distribute-lft-in95.2%
distribute-lft-in95.2%
mul-1-neg95.2%
unsub-neg95.2%
neg-mul-195.2%
mul-1-neg95.2%
remove-double-neg95.2%
associate-/l*93.3%
Simplified93.3%
*-commutative93.3%
associate-*l/95.2%
Applied egg-rr95.2%
Final simplification93.8%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* b c) (* a d)) (+ (* c c) (* d d)))))
(if (<= c -1.3e+136)
(/ (/ c (hypot d c)) (/ (hypot d c) b))
(if (<= c -6.4e-69)
t_0
(if (<= c 6.2e-81)
(/ (- (/ (* b c) d) a) d)
(if (<= c 1.6e+120) t_0 (/ (- b (/ d (/ c a))) c)))))))
double code(double a, double b, double c, double d) {
double t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d));
double tmp;
if (c <= -1.3e+136) {
tmp = (c / hypot(d, c)) / (hypot(d, c) / b);
} else if (c <= -6.4e-69) {
tmp = t_0;
} else if (c <= 6.2e-81) {
tmp = (((b * c) / d) - a) / d;
} else if (c <= 1.6e+120) {
tmp = t_0;
} else {
tmp = (b - (d / (c / a))) / c;
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d));
double tmp;
if (c <= -1.3e+136) {
tmp = (c / Math.hypot(d, c)) / (Math.hypot(d, c) / b);
} else if (c <= -6.4e-69) {
tmp = t_0;
} else if (c <= 6.2e-81) {
tmp = (((b * c) / d) - a) / d;
} else if (c <= 1.6e+120) {
tmp = t_0;
} else {
tmp = (b - (d / (c / a))) / c;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d)) tmp = 0 if c <= -1.3e+136: tmp = (c / math.hypot(d, c)) / (math.hypot(d, c) / b) elif c <= -6.4e-69: tmp = t_0 elif c <= 6.2e-81: tmp = (((b * c) / d) - a) / d elif c <= 1.6e+120: tmp = t_0 else: tmp = (b - (d / (c / a))) / c return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))) tmp = 0.0 if (c <= -1.3e+136) tmp = Float64(Float64(c / hypot(d, c)) / Float64(hypot(d, c) / b)); elseif (c <= -6.4e-69) tmp = t_0; elseif (c <= 6.2e-81) tmp = Float64(Float64(Float64(Float64(b * c) / d) - a) / d); elseif (c <= 1.6e+120) tmp = t_0; else tmp = Float64(Float64(b - Float64(d / Float64(c / a))) / c); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d)); tmp = 0.0; if (c <= -1.3e+136) tmp = (c / hypot(d, c)) / (hypot(d, c) / b); elseif (c <= -6.4e-69) tmp = t_0; elseif (c <= 6.2e-81) tmp = (((b * c) / d) - a) / d; elseif (c <= 1.6e+120) tmp = t_0; else tmp = (b - (d / (c / a))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1.3e+136], N[(N[(c / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -6.4e-69], t$95$0, If[LessEqual[c, 6.2e-81], N[(N[(N[(N[(b * c), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 1.6e+120], t$95$0, N[(N[(b - N[(d / N[(c / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -1.3 \cdot 10^{+136}:\\
\;\;\;\;\frac{\frac{c}{\mathsf{hypot}\left(d, c\right)}}{\frac{\mathsf{hypot}\left(d, c\right)}{b}}\\
\mathbf{elif}\;c \leq -6.4 \cdot 10^{-69}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;c \leq 6.2 \cdot 10^{-81}:\\
\;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\
\mathbf{elif}\;c \leq 1.6 \cdot 10^{+120}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\end{array}
\end{array}
if c < -1.3000000000000001e136Initial program 46.0%
Taylor expanded in b around inf 46.2%
rem-square-sqrt46.2%
unpow246.2%
unpow246.2%
hypot-undefine46.2%
unpow246.2%
unpow246.2%
hypot-undefine46.2%
unpow246.2%
*-commutative46.2%
associate-*r/47.4%
hypot-undefine47.4%
unpow247.4%
unpow247.4%
+-commutative47.4%
unpow247.4%
unpow247.4%
hypot-define47.4%
Simplified47.4%
associate-*r/46.2%
unpow246.2%
frac-times90.1%
hypot-undefine47.4%
+-commutative47.4%
hypot-undefine90.1%
hypot-undefine47.4%
+-commutative47.4%
hypot-undefine90.1%
clear-num89.8%
un-div-inv89.8%
hypot-undefine47.4%
+-commutative47.4%
hypot-undefine89.8%
hypot-undefine47.4%
+-commutative47.4%
hypot-undefine89.8%
Applied egg-rr89.8%
if -1.3000000000000001e136 < c < -6.39999999999999997e-69 or 6.19999999999999976e-81 < c < 1.59999999999999991e120Initial program 72.6%
if -6.39999999999999997e-69 < c < 6.19999999999999976e-81Initial program 68.5%
div-sub64.9%
*-commutative64.9%
add-sqr-sqrt64.9%
times-frac60.8%
fma-neg60.8%
hypot-define60.8%
hypot-define64.2%
associate-/l*67.9%
add-sqr-sqrt67.9%
pow267.9%
hypot-define67.9%
Applied egg-rr67.9%
Taylor expanded in d around inf 93.8%
if 1.59999999999999991e120 < c Initial program 41.2%
div-sub41.2%
*-commutative41.2%
add-sqr-sqrt41.2%
times-frac42.3%
fma-neg42.3%
hypot-define42.3%
hypot-define82.6%
associate-/l*83.1%
add-sqr-sqrt83.1%
pow283.1%
hypot-define83.1%
Applied egg-rr83.1%
Taylor expanded in c around inf 87.9%
mul-1-neg87.9%
*-commutative87.9%
associate-*r/94.5%
unsub-neg94.5%
Simplified94.5%
clear-num94.5%
un-div-inv94.5%
Applied egg-rr94.5%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* b c) (* a d)) (+ (* c c) (* d d)))))
(if (<= d -9e+83)
(/ (- (* c (/ b d)) a) d)
(if (<= d -7.2e-84)
t_0
(if (<= d 8e-168)
(/ (- b (/ (* a d) c)) c)
(if (<= d 6.2e+130) t_0 (/ (- (* b (/ c d)) a) d)))))))
double code(double a, double b, double c, double d) {
double t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d));
double tmp;
if (d <= -9e+83) {
tmp = ((c * (b / d)) - a) / d;
} else if (d <= -7.2e-84) {
tmp = t_0;
} else if (d <= 8e-168) {
tmp = (b - ((a * d) / c)) / c;
} else if (d <= 6.2e+130) {
tmp = t_0;
} else {
tmp = ((b * (c / d)) - a) / d;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d))
if (d <= (-9d+83)) then
tmp = ((c * (b / d)) - a) / d
else if (d <= (-7.2d-84)) then
tmp = t_0
else if (d <= 8d-168) then
tmp = (b - ((a * d) / c)) / c
else if (d <= 6.2d+130) then
tmp = t_0
else
tmp = ((b * (c / d)) - a) / d
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d));
double tmp;
if (d <= -9e+83) {
tmp = ((c * (b / d)) - a) / d;
} else if (d <= -7.2e-84) {
tmp = t_0;
} else if (d <= 8e-168) {
tmp = (b - ((a * d) / c)) / c;
} else if (d <= 6.2e+130) {
tmp = t_0;
} else {
tmp = ((b * (c / d)) - a) / d;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d)) tmp = 0 if d <= -9e+83: tmp = ((c * (b / d)) - a) / d elif d <= -7.2e-84: tmp = t_0 elif d <= 8e-168: tmp = (b - ((a * d) / c)) / c elif d <= 6.2e+130: tmp = t_0 else: tmp = ((b * (c / d)) - a) / d return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))) tmp = 0.0 if (d <= -9e+83) tmp = Float64(Float64(Float64(c * Float64(b / d)) - a) / d); elseif (d <= -7.2e-84) tmp = t_0; elseif (d <= 8e-168) tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c); elseif (d <= 6.2e+130) tmp = t_0; else tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d)); tmp = 0.0; if (d <= -9e+83) tmp = ((c * (b / d)) - a) / d; elseif (d <= -7.2e-84) tmp = t_0; elseif (d <= 8e-168) tmp = (b - ((a * d) / c)) / c; elseif (d <= 6.2e+130) tmp = t_0; else tmp = ((b * (c / d)) - a) / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -9e+83], N[(N[(N[(c * N[(b / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[d, -7.2e-84], t$95$0, If[LessEqual[d, 8e-168], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 6.2e+130], t$95$0, N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\
\mathbf{if}\;d \leq -9 \cdot 10^{+83}:\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\
\mathbf{elif}\;d \leq -7.2 \cdot 10^{-84}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 8 \cdot 10^{-168}:\\
\;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
\mathbf{elif}\;d \leq 6.2 \cdot 10^{+130}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\end{array}
\end{array}
if d < -8.9999999999999999e83Initial program 40.9%
Taylor expanded in c around 0 79.9%
+-commutative79.9%
mul-1-neg79.9%
unsub-neg79.9%
unpow279.9%
associate-/r*80.1%
div-sub80.1%
associate-/l*82.4%
Simplified82.4%
clear-num82.4%
un-div-inv82.4%
Applied egg-rr82.4%
associate-/r/86.3%
Simplified86.3%
if -8.9999999999999999e83 < d < -7.20000000000000007e-84 or 8.0000000000000004e-168 < d < 6.1999999999999999e130Initial program 79.8%
if -7.20000000000000007e-84 < d < 8.0000000000000004e-168Initial program 70.8%
Taylor expanded in c around inf 95.9%
remove-double-neg95.9%
mul-1-neg95.9%
neg-mul-195.9%
distribute-lft-in95.9%
distribute-lft-in95.9%
mul-1-neg95.9%
unsub-neg95.9%
neg-mul-195.9%
mul-1-neg95.9%
remove-double-neg95.9%
associate-/l*93.8%
Simplified93.8%
*-commutative93.8%
associate-*l/95.9%
Applied egg-rr95.9%
if 6.1999999999999999e130 < d Initial program 25.5%
Taylor expanded in c around 0 70.9%
+-commutative70.9%
mul-1-neg70.9%
unsub-neg70.9%
unpow270.9%
associate-/r*78.6%
div-sub78.6%
associate-/l*83.4%
Simplified83.4%
Final simplification86.1%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- b (/ d (/ c a))) c)))
(if (<= c -1.2e+60)
t_0
(if (<= c -6.5e-49)
(/ (- (/ b (/ d c)) a) d)
(if (<= c -2.4e-64)
(/ 1.0 (/ c (- b (* a (/ d c)))))
(if (<= c 50000.0) (/ (- (/ (* b c) d) a) d) t_0))))))
double code(double a, double b, double c, double d) {
double t_0 = (b - (d / (c / a))) / c;
double tmp;
if (c <= -1.2e+60) {
tmp = t_0;
} else if (c <= -6.5e-49) {
tmp = ((b / (d / c)) - a) / d;
} else if (c <= -2.4e-64) {
tmp = 1.0 / (c / (b - (a * (d / c))));
} else if (c <= 50000.0) {
tmp = (((b * c) / d) - a) / d;
} 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 / a))) / c
if (c <= (-1.2d+60)) then
tmp = t_0
else if (c <= (-6.5d-49)) then
tmp = ((b / (d / c)) - a) / d
else if (c <= (-2.4d-64)) then
tmp = 1.0d0 / (c / (b - (a * (d / c))))
else if (c <= 50000.0d0) then
tmp = (((b * c) / d) - a) / d
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 / a))) / c;
double tmp;
if (c <= -1.2e+60) {
tmp = t_0;
} else if (c <= -6.5e-49) {
tmp = ((b / (d / c)) - a) / d;
} else if (c <= -2.4e-64) {
tmp = 1.0 / (c / (b - (a * (d / c))));
} else if (c <= 50000.0) {
tmp = (((b * c) / d) - a) / d;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, c, d): t_0 = (b - (d / (c / a))) / c tmp = 0 if c <= -1.2e+60: tmp = t_0 elif c <= -6.5e-49: tmp = ((b / (d / c)) - a) / d elif c <= -2.4e-64: tmp = 1.0 / (c / (b - (a * (d / c)))) elif c <= 50000.0: tmp = (((b * c) / d) - a) / d else: tmp = t_0 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(b - Float64(d / Float64(c / a))) / c) tmp = 0.0 if (c <= -1.2e+60) tmp = t_0; elseif (c <= -6.5e-49) tmp = Float64(Float64(Float64(b / Float64(d / c)) - a) / d); elseif (c <= -2.4e-64) tmp = Float64(1.0 / Float64(c / Float64(b - Float64(a * Float64(d / c))))); elseif (c <= 50000.0) tmp = Float64(Float64(Float64(Float64(b * c) / d) - a) / d); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (b - (d / (c / a))) / c; tmp = 0.0; if (c <= -1.2e+60) tmp = t_0; elseif (c <= -6.5e-49) tmp = ((b / (d / c)) - a) / d; elseif (c <= -2.4e-64) tmp = 1.0 / (c / (b - (a * (d / c)))); elseif (c <= 50000.0) tmp = (((b * c) / d) - a) / d; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b - N[(d / N[(c / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -1.2e+60], t$95$0, If[LessEqual[c, -6.5e-49], N[(N[(N[(b / N[(d / c), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, -2.4e-64], N[(1.0 / N[(c / N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 50000.0], N[(N[(N[(N[(b * c), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\mathbf{if}\;c \leq -1.2 \cdot 10^{+60}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;c \leq -6.5 \cdot 10^{-49}:\\
\;\;\;\;\frac{\frac{b}{\frac{d}{c}} - a}{d}\\
\mathbf{elif}\;c \leq -2.4 \cdot 10^{-64}:\\
\;\;\;\;\frac{1}{\frac{c}{b - a \cdot \frac{d}{c}}}\\
\mathbf{elif}\;c \leq 50000:\\
\;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if c < -1.2e60 or 5e4 < c Initial program 53.6%
div-sub53.6%
*-commutative53.6%
add-sqr-sqrt53.6%
times-frac57.4%
fma-neg57.4%
hypot-define57.4%
hypot-define87.2%
associate-/l*86.8%
add-sqr-sqrt86.8%
pow286.8%
hypot-define86.8%
Applied egg-rr86.8%
Taylor expanded in c around inf 78.7%
mul-1-neg78.7%
*-commutative78.7%
associate-*r/83.1%
unsub-neg83.1%
Simplified83.1%
clear-num83.1%
un-div-inv83.1%
Applied egg-rr83.1%
if -1.2e60 < c < -6.49999999999999968e-49Initial program 56.1%
Taylor expanded in c around 0 57.0%
+-commutative57.0%
mul-1-neg57.0%
unsub-neg57.0%
unpow257.0%
associate-/r*62.5%
div-sub62.5%
associate-/l*66.7%
Simplified66.7%
clear-num66.7%
un-div-inv66.7%
Applied egg-rr66.7%
if -6.49999999999999968e-49 < c < -2.39999999999999998e-64Initial program 99.4%
div-sub99.4%
*-commutative99.4%
add-sqr-sqrt99.4%
times-frac99.4%
fma-neg99.4%
hypot-define99.4%
hypot-define99.4%
associate-/l*99.4%
add-sqr-sqrt99.4%
pow299.4%
hypot-define99.4%
Applied egg-rr99.4%
Taylor expanded in c around inf 99.7%
mul-1-neg99.7%
*-commutative99.7%
associate-*r/42.8%
unsub-neg42.8%
Simplified42.8%
clear-num42.5%
inv-pow42.5%
associate-*r/100.0%
Applied egg-rr100.0%
unpow-1100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
if -2.39999999999999998e-64 < c < 5e4Initial program 70.2%
div-sub67.1%
*-commutative67.1%
add-sqr-sqrt67.1%
times-frac63.4%
fma-neg63.4%
hypot-define63.4%
hypot-define66.4%
associate-/l*69.8%
add-sqr-sqrt69.8%
pow269.8%
hypot-define69.8%
Applied egg-rr69.8%
Taylor expanded in d around inf 90.1%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- b (/ d (/ c a))) c)))
(if (<= c -7.8e+59)
t_0
(if (<= c -2.3e-47)
(/ (- (/ b (/ d c)) a) d)
(if (<= c -4e-65)
(/ (- b (/ (* a d) c)) c)
(if (<= c 2900000.0) (/ (- (/ (* b c) d) a) d) t_0))))))
double code(double a, double b, double c, double d) {
double t_0 = (b - (d / (c / a))) / c;
double tmp;
if (c <= -7.8e+59) {
tmp = t_0;
} else if (c <= -2.3e-47) {
tmp = ((b / (d / c)) - a) / d;
} else if (c <= -4e-65) {
tmp = (b - ((a * d) / c)) / c;
} else if (c <= 2900000.0) {
tmp = (((b * c) / d) - a) / d;
} 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 / a))) / c
if (c <= (-7.8d+59)) then
tmp = t_0
else if (c <= (-2.3d-47)) then
tmp = ((b / (d / c)) - a) / d
else if (c <= (-4d-65)) then
tmp = (b - ((a * d) / c)) / c
else if (c <= 2900000.0d0) then
tmp = (((b * c) / d) - a) / d
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 / a))) / c;
double tmp;
if (c <= -7.8e+59) {
tmp = t_0;
} else if (c <= -2.3e-47) {
tmp = ((b / (d / c)) - a) / d;
} else if (c <= -4e-65) {
tmp = (b - ((a * d) / c)) / c;
} else if (c <= 2900000.0) {
tmp = (((b * c) / d) - a) / d;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, c, d): t_0 = (b - (d / (c / a))) / c tmp = 0 if c <= -7.8e+59: tmp = t_0 elif c <= -2.3e-47: tmp = ((b / (d / c)) - a) / d elif c <= -4e-65: tmp = (b - ((a * d) / c)) / c elif c <= 2900000.0: tmp = (((b * c) / d) - a) / d else: tmp = t_0 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(b - Float64(d / Float64(c / a))) / c) tmp = 0.0 if (c <= -7.8e+59) tmp = t_0; elseif (c <= -2.3e-47) tmp = Float64(Float64(Float64(b / Float64(d / c)) - a) / d); elseif (c <= -4e-65) tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c); elseif (c <= 2900000.0) tmp = Float64(Float64(Float64(Float64(b * c) / d) - a) / d); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (b - (d / (c / a))) / c; tmp = 0.0; if (c <= -7.8e+59) tmp = t_0; elseif (c <= -2.3e-47) tmp = ((b / (d / c)) - a) / d; elseif (c <= -4e-65) tmp = (b - ((a * d) / c)) / c; elseif (c <= 2900000.0) tmp = (((b * c) / d) - a) / d; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b - N[(d / N[(c / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -7.8e+59], t$95$0, If[LessEqual[c, -2.3e-47], N[(N[(N[(b / N[(d / c), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, -4e-65], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 2900000.0], N[(N[(N[(N[(b * c), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\mathbf{if}\;c \leq -7.8 \cdot 10^{+59}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;c \leq -2.3 \cdot 10^{-47}:\\
\;\;\;\;\frac{\frac{b}{\frac{d}{c}} - a}{d}\\
\mathbf{elif}\;c \leq -4 \cdot 10^{-65}:\\
\;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
\mathbf{elif}\;c \leq 2900000:\\
\;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if c < -7.80000000000000043e59 or 2.9e6 < c Initial program 53.6%
div-sub53.6%
*-commutative53.6%
add-sqr-sqrt53.6%
times-frac57.4%
fma-neg57.4%
hypot-define57.4%
hypot-define87.2%
associate-/l*86.8%
add-sqr-sqrt86.8%
pow286.8%
hypot-define86.8%
Applied egg-rr86.8%
Taylor expanded in c around inf 78.7%
mul-1-neg78.7%
*-commutative78.7%
associate-*r/83.1%
unsub-neg83.1%
Simplified83.1%
clear-num83.1%
un-div-inv83.1%
Applied egg-rr83.1%
if -7.80000000000000043e59 < c < -2.29999999999999982e-47Initial program 56.1%
Taylor expanded in c around 0 57.0%
+-commutative57.0%
mul-1-neg57.0%
unsub-neg57.0%
unpow257.0%
associate-/r*62.5%
div-sub62.5%
associate-/l*66.7%
Simplified66.7%
clear-num66.7%
un-div-inv66.7%
Applied egg-rr66.7%
if -2.29999999999999982e-47 < c < -3.99999999999999969e-65Initial program 99.4%
Taylor expanded in c around inf 99.7%
remove-double-neg99.7%
mul-1-neg99.7%
neg-mul-199.7%
distribute-lft-in99.7%
distribute-lft-in99.7%
mul-1-neg99.7%
unsub-neg99.7%
neg-mul-199.7%
mul-1-neg99.7%
remove-double-neg99.7%
associate-/l*99.4%
Simplified99.4%
*-commutative99.4%
associate-*l/99.7%
Applied egg-rr99.7%
if -3.99999999999999969e-65 < c < 2.9e6Initial program 70.2%
div-sub67.1%
*-commutative67.1%
add-sqr-sqrt67.1%
times-frac63.4%
fma-neg63.4%
hypot-define63.4%
hypot-define66.4%
associate-/l*69.8%
add-sqr-sqrt69.8%
pow269.8%
hypot-define69.8%
Applied egg-rr69.8%
Taylor expanded in d around inf 90.1%
Final simplification84.8%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (/ b (/ d c)) a) d)) (t_1 (/ (- b (/ d (/ c a))) c)))
(if (<= c -1.1e+66)
t_1
(if (<= c -1.65e-45)
t_0
(if (<= c -2.4e-64)
(/ (- b (/ (* a d) c)) c)
(if (<= c 16000.0) t_0 t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = ((b / (d / c)) - a) / d;
double t_1 = (b - (d / (c / a))) / c;
double tmp;
if (c <= -1.1e+66) {
tmp = t_1;
} else if (c <= -1.65e-45) {
tmp = t_0;
} else if (c <= -2.4e-64) {
tmp = (b - ((a * d) / c)) / c;
} else if (c <= 16000.0) {
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 = ((b / (d / c)) - a) / d
t_1 = (b - (d / (c / a))) / c
if (c <= (-1.1d+66)) then
tmp = t_1
else if (c <= (-1.65d-45)) then
tmp = t_0
else if (c <= (-2.4d-64)) then
tmp = (b - ((a * d) / c)) / c
else if (c <= 16000.0d0) 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 = ((b / (d / c)) - a) / d;
double t_1 = (b - (d / (c / a))) / c;
double tmp;
if (c <= -1.1e+66) {
tmp = t_1;
} else if (c <= -1.65e-45) {
tmp = t_0;
} else if (c <= -2.4e-64) {
tmp = (b - ((a * d) / c)) / c;
} else if (c <= 16000.0) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((b / (d / c)) - a) / d t_1 = (b - (d / (c / a))) / c tmp = 0 if c <= -1.1e+66: tmp = t_1 elif c <= -1.65e-45: tmp = t_0 elif c <= -2.4e-64: tmp = (b - ((a * d) / c)) / c elif c <= 16000.0: tmp = t_0 else: tmp = t_1 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(b / Float64(d / c)) - a) / d) t_1 = Float64(Float64(b - Float64(d / Float64(c / a))) / c) tmp = 0.0 if (c <= -1.1e+66) tmp = t_1; elseif (c <= -1.65e-45) tmp = t_0; elseif (c <= -2.4e-64) tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c); elseif (c <= 16000.0) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((b / (d / c)) - a) / d; t_1 = (b - (d / (c / a))) / c; tmp = 0.0; if (c <= -1.1e+66) tmp = t_1; elseif (c <= -1.65e-45) tmp = t_0; elseif (c <= -2.4e-64) tmp = (b - ((a * d) / c)) / c; elseif (c <= 16000.0) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(b / N[(d / c), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b - N[(d / N[(c / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -1.1e+66], t$95$1, If[LessEqual[c, -1.65e-45], t$95$0, If[LessEqual[c, -2.4e-64], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 16000.0], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{b}{\frac{d}{c}} - a}{d}\\
t_1 := \frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\mathbf{if}\;c \leq -1.1 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -1.65 \cdot 10^{-45}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;c \leq -2.4 \cdot 10^{-64}:\\
\;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
\mathbf{elif}\;c \leq 16000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -1.0999999999999999e66 or 16000 < c Initial program 53.6%
div-sub53.6%
*-commutative53.6%
add-sqr-sqrt53.6%
times-frac57.4%
fma-neg57.4%
hypot-define57.4%
hypot-define87.2%
associate-/l*86.8%
add-sqr-sqrt86.8%
pow286.8%
hypot-define86.8%
Applied egg-rr86.8%
Taylor expanded in c around inf 78.7%
mul-1-neg78.7%
*-commutative78.7%
associate-*r/83.1%
unsub-neg83.1%
Simplified83.1%
clear-num83.1%
un-div-inv83.1%
Applied egg-rr83.1%
if -1.0999999999999999e66 < c < -1.65e-45 or -2.39999999999999998e-64 < c < 16000Initial program 67.6%
Taylor expanded in c around 0 79.8%
+-commutative79.8%
mul-1-neg79.8%
unsub-neg79.8%
unpow279.8%
associate-/r*85.0%
div-sub85.0%
associate-/l*85.0%
Simplified85.0%
clear-num85.0%
un-div-inv85.0%
Applied egg-rr85.0%
if -1.65e-45 < c < -2.39999999999999998e-64Initial program 99.4%
Taylor expanded in c around inf 99.7%
remove-double-neg99.7%
mul-1-neg99.7%
neg-mul-199.7%
distribute-lft-in99.7%
distribute-lft-in99.7%
mul-1-neg99.7%
unsub-neg99.7%
neg-mul-199.7%
mul-1-neg99.7%
remove-double-neg99.7%
associate-/l*99.4%
Simplified99.4%
*-commutative99.4%
associate-*l/99.7%
Applied egg-rr99.7%
Final simplification84.4%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* b (/ c d)) a) d)) (t_1 (/ (- b (/ d (/ c a))) c)))
(if (<= c -6.8e+59)
t_1
(if (<= c -1.6e-41)
t_0
(if (<= c -2.4e-64)
(/ (- b (/ (* a d) c)) c)
(if (<= c 9000.0) t_0 t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = ((b * (c / d)) - a) / d;
double t_1 = (b - (d / (c / a))) / c;
double tmp;
if (c <= -6.8e+59) {
tmp = t_1;
} else if (c <= -1.6e-41) {
tmp = t_0;
} else if (c <= -2.4e-64) {
tmp = (b - ((a * d) / c)) / c;
} else if (c <= 9000.0) {
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 = ((b * (c / d)) - a) / d
t_1 = (b - (d / (c / a))) / c
if (c <= (-6.8d+59)) then
tmp = t_1
else if (c <= (-1.6d-41)) then
tmp = t_0
else if (c <= (-2.4d-64)) then
tmp = (b - ((a * d) / c)) / c
else if (c <= 9000.0d0) 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 = ((b * (c / d)) - a) / d;
double t_1 = (b - (d / (c / a))) / c;
double tmp;
if (c <= -6.8e+59) {
tmp = t_1;
} else if (c <= -1.6e-41) {
tmp = t_0;
} else if (c <= -2.4e-64) {
tmp = (b - ((a * d) / c)) / c;
} else if (c <= 9000.0) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((b * (c / d)) - a) / d t_1 = (b - (d / (c / a))) / c tmp = 0 if c <= -6.8e+59: tmp = t_1 elif c <= -1.6e-41: tmp = t_0 elif c <= -2.4e-64: tmp = (b - ((a * d) / c)) / c elif c <= 9000.0: tmp = t_0 else: tmp = t_1 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(b * Float64(c / d)) - a) / d) t_1 = Float64(Float64(b - Float64(d / Float64(c / a))) / c) tmp = 0.0 if (c <= -6.8e+59) tmp = t_1; elseif (c <= -1.6e-41) tmp = t_0; elseif (c <= -2.4e-64) tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c); elseif (c <= 9000.0) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((b * (c / d)) - a) / d; t_1 = (b - (d / (c / a))) / c; tmp = 0.0; if (c <= -6.8e+59) tmp = t_1; elseif (c <= -1.6e-41) tmp = t_0; elseif (c <= -2.4e-64) tmp = (b - ((a * d) / c)) / c; elseif (c <= 9000.0) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b - N[(d / N[(c / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -6.8e+59], t$95$1, If[LessEqual[c, -1.6e-41], t$95$0, If[LessEqual[c, -2.4e-64], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 9000.0], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b \cdot \frac{c}{d} - a}{d}\\
t_1 := \frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\mathbf{if}\;c \leq -6.8 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -1.6 \cdot 10^{-41}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;c \leq -2.4 \cdot 10^{-64}:\\
\;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
\mathbf{elif}\;c \leq 9000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -6.80000000000000012e59 or 9e3 < c Initial program 53.6%
div-sub53.6%
*-commutative53.6%
add-sqr-sqrt53.6%
times-frac57.4%
fma-neg57.4%
hypot-define57.4%
hypot-define87.2%
associate-/l*86.8%
add-sqr-sqrt86.8%
pow286.8%
hypot-define86.8%
Applied egg-rr86.8%
Taylor expanded in c around inf 78.7%
mul-1-neg78.7%
*-commutative78.7%
associate-*r/83.1%
unsub-neg83.1%
Simplified83.1%
clear-num83.1%
un-div-inv83.1%
Applied egg-rr83.1%
if -6.80000000000000012e59 < c < -1.60000000000000006e-41 or -2.39999999999999998e-64 < c < 9e3Initial program 67.6%
Taylor expanded in c around 0 79.8%
+-commutative79.8%
mul-1-neg79.8%
unsub-neg79.8%
unpow279.8%
associate-/r*85.0%
div-sub85.0%
associate-/l*85.0%
Simplified85.0%
if -1.60000000000000006e-41 < c < -2.39999999999999998e-64Initial program 99.4%
Taylor expanded in c around inf 99.7%
remove-double-neg99.7%
mul-1-neg99.7%
neg-mul-199.7%
distribute-lft-in99.7%
distribute-lft-in99.7%
mul-1-neg99.7%
unsub-neg99.7%
neg-mul-199.7%
mul-1-neg99.7%
remove-double-neg99.7%
associate-/l*99.4%
Simplified99.4%
*-commutative99.4%
associate-*l/99.7%
Applied egg-rr99.7%
Final simplification84.4%
(FPCore (a b c d) :precision binary64 (if (or (<= c -2.2e-12) (not (<= c 2500.0))) (/ (- b (/ d (/ c a))) c) (/ (- a) d)))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -2.2e-12) || !(c <= 2500.0)) {
tmp = (b - (d / (c / 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 ((c <= (-2.2d-12)) .or. (.not. (c <= 2500.0d0))) then
tmp = (b - (d / (c / 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 ((c <= -2.2e-12) || !(c <= 2500.0)) {
tmp = (b - (d / (c / a))) / c;
} else {
tmp = -a / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -2.2e-12) or not (c <= 2500.0): tmp = (b - (d / (c / a))) / c else: tmp = -a / d return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -2.2e-12) || !(c <= 2500.0)) tmp = Float64(Float64(b - Float64(d / Float64(c / a))) / c); else tmp = Float64(Float64(-a) / d); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((c <= -2.2e-12) || ~((c <= 2500.0))) tmp = (b - (d / (c / a))) / c; else tmp = -a / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -2.2e-12], N[Not[LessEqual[c, 2500.0]], $MachinePrecision]], N[(N[(b - N[(d / N[(c / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[((-a) / d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.2 \cdot 10^{-12} \lor \neg \left(c \leq 2500\right):\\
\;\;\;\;\frac{b - \frac{d}{\frac{c}{a}}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\
\end{array}
\end{array}
if c < -2.19999999999999992e-12 or 2500 < c Initial program 54.2%
div-sub54.2%
*-commutative54.2%
add-sqr-sqrt54.2%
times-frac57.6%
fma-neg57.6%
hypot-define57.6%
hypot-define85.1%
associate-/l*85.5%
add-sqr-sqrt85.5%
pow285.5%
hypot-define85.5%
Applied egg-rr85.5%
Taylor expanded in c around inf 75.5%
mul-1-neg75.5%
*-commutative75.5%
associate-*r/79.4%
unsub-neg79.4%
Simplified79.4%
clear-num79.4%
un-div-inv79.4%
Applied egg-rr79.4%
if -2.19999999999999992e-12 < c < 2500Initial program 70.1%
Taylor expanded in c around 0 73.2%
associate-*r/73.2%
neg-mul-173.2%
Simplified73.2%
Final simplification76.6%
(FPCore (a b c d) :precision binary64 (if (or (<= c -1.2e-13) (not (<= c 6200.0))) (/ (- b (* d (/ a c))) c) (/ (- a) d)))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -1.2e-13) || !(c <= 6200.0)) {
tmp = (b - (d * (a / c))) / 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 <= (-1.2d-13)) .or. (.not. (c <= 6200.0d0))) then
tmp = (b - (d * (a / c))) / 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 <= -1.2e-13) || !(c <= 6200.0)) {
tmp = (b - (d * (a / c))) / c;
} else {
tmp = -a / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -1.2e-13) or not (c <= 6200.0): tmp = (b - (d * (a / c))) / c else: tmp = -a / d return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -1.2e-13) || !(c <= 6200.0)) tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); else tmp = Float64(Float64(-a) / d); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((c <= -1.2e-13) || ~((c <= 6200.0))) tmp = (b - (d * (a / c))) / c; else tmp = -a / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -1.2e-13], N[Not[LessEqual[c, 6200.0]], $MachinePrecision]], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[((-a) / d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.2 \cdot 10^{-13} \lor \neg \left(c \leq 6200\right):\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\
\end{array}
\end{array}
if c < -1.1999999999999999e-13 or 6200 < c Initial program 54.2%
div-sub54.2%
*-commutative54.2%
add-sqr-sqrt54.2%
times-frac57.6%
fma-neg57.6%
hypot-define57.6%
hypot-define85.1%
associate-/l*85.5%
add-sqr-sqrt85.5%
pow285.5%
hypot-define85.5%
Applied egg-rr85.5%
Taylor expanded in c around inf 75.5%
mul-1-neg75.5%
*-commutative75.5%
associate-*r/79.4%
unsub-neg79.4%
Simplified79.4%
if -1.1999999999999999e-13 < c < 6200Initial program 70.1%
Taylor expanded in c around 0 73.2%
associate-*r/73.2%
neg-mul-173.2%
Simplified73.2%
Final simplification76.6%
(FPCore (a b c d) :precision binary64 (if (or (<= d -53000000.0) (not (<= d 6.5e+144))) (/ (- a) d) (/ (- b (* a (/ d c))) c)))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -53000000.0) || !(d <= 6.5e+144)) {
tmp = -a / d;
} else {
tmp = (b - (a * (d / c))) / 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 <= (-53000000.0d0)) .or. (.not. (d <= 6.5d+144))) then
tmp = -a / d
else
tmp = (b - (a * (d / c))) / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -53000000.0) || !(d <= 6.5e+144)) {
tmp = -a / d;
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -53000000.0) or not (d <= 6.5e+144): tmp = -a / d else: tmp = (b - (a * (d / c))) / c return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -53000000.0) || !(d <= 6.5e+144)) tmp = Float64(Float64(-a) / d); else tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((d <= -53000000.0) || ~((d <= 6.5e+144))) tmp = -a / d; else tmp = (b - (a * (d / c))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -53000000.0], N[Not[LessEqual[d, 6.5e+144]], $MachinePrecision]], N[((-a) / d), $MachinePrecision], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -53000000 \lor \neg \left(d \leq 6.5 \cdot 10^{+144}\right):\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if d < -5.3e7 or 6.50000000000000007e144 < d Initial program 43.8%
Taylor expanded in c around 0 72.5%
associate-*r/72.5%
neg-mul-172.5%
Simplified72.5%
if -5.3e7 < d < 6.50000000000000007e144Initial program 73.5%
Taylor expanded in c around inf 79.2%
remove-double-neg79.2%
mul-1-neg79.2%
neg-mul-179.2%
distribute-lft-in79.2%
distribute-lft-in79.2%
mul-1-neg79.2%
unsub-neg79.2%
neg-mul-179.2%
mul-1-neg79.2%
remove-double-neg79.2%
associate-/l*78.9%
Simplified78.9%
Final simplification76.2%
(FPCore (a b c d) :precision binary64 (if (or (<= c -5.2e+74) (not (<= c 4600.0))) (/ b c) (/ (- a) d)))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -5.2e+74) || !(c <= 4600.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 <= (-5.2d+74)) .or. (.not. (c <= 4600.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 <= -5.2e+74) || !(c <= 4600.0)) {
tmp = b / c;
} else {
tmp = -a / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -5.2e+74) or not (c <= 4600.0): tmp = b / c else: tmp = -a / d return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -5.2e+74) || !(c <= 4600.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 <= -5.2e+74) || ~((c <= 4600.0))) tmp = b / c; else tmp = -a / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -5.2e+74], N[Not[LessEqual[c, 4600.0]], $MachinePrecision]], N[(b / c), $MachinePrecision], N[((-a) / d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -5.2 \cdot 10^{+74} \lor \neg \left(c \leq 4600\right):\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\
\end{array}
\end{array}
if c < -5.2000000000000001e74 or 4600 < c Initial program 53.2%
Taylor expanded in c around inf 69.6%
if -5.2000000000000001e74 < c < 4600Initial program 69.1%
Taylor expanded in c around 0 68.2%
associate-*r/68.2%
neg-mul-168.2%
Simplified68.2%
Final simplification68.9%
(FPCore (a b c d) :precision binary64 (/ b c))
double code(double a, double b, double c, double d) {
return b / c;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = b / c
end function
public static double code(double a, double b, double c, double d) {
return b / c;
}
def code(a, b, c, d): return b / c
function code(a, b, c, d) return Float64(b / c) end
function tmp = code(a, b, c, d) tmp = b / c; end
code[a_, b_, c_, d_] := N[(b / c), $MachinePrecision]
\begin{array}{l}
\\
\frac{b}{c}
\end{array}
Initial program 61.3%
Taylor expanded in c around inf 41.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 2024085
(FPCore (a b c d)
:name "Complex division, imag part"
:precision binary64
:alt
(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))))