
(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 11 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 (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) {
return fma((c / hypot(c, d)), (b / hypot(c, d)), (a * ((d / hypot(d, c)) / -hypot(d, c))));
}
function code(a, b, c, d) return fma(Float64(c / hypot(c, d)), Float64(b / hypot(c, d)), Float64(a * Float64(Float64(d / hypot(d, c)) / Float64(-hypot(d, c))))) end
code[a_, b_, c_, d_] := N[(N[(c / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(d / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision] / (-N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, a \cdot \frac{\frac{d}{\mathsf{hypot}\left(d, c\right)}}{-\mathsf{hypot}\left(d, c\right)}\right)
\end{array}
Initial program 67.5%
div-sub65.1%
*-commutative65.1%
add-sqr-sqrt65.1%
times-frac67.0%
fmm-def67.0%
hypot-define67.0%
hypot-define82.3%
associate-/l*84.6%
add-sqr-sqrt84.6%
pow284.6%
hypot-define84.6%
Applied egg-rr84.6%
*-un-lft-identity84.6%
unpow284.6%
times-frac96.7%
hypot-undefine84.6%
+-commutative84.6%
hypot-undefine96.7%
hypot-undefine84.6%
+-commutative84.6%
hypot-undefine96.7%
Applied egg-rr96.7%
associate-*l/96.8%
*-lft-identity96.8%
Simplified96.8%
Final simplification96.8%
(FPCore (a b c d)
:precision binary64
(let* ((t_0
(fma
(/ c (hypot c d))
(/ b (hypot c d))
(* (/ d (pow (hypot c d) 2.0)) (- a))))
(t_1 (/ (- (/ c (/ d b)) a) d)))
(if (<= d -2.95e+180)
t_1
(if (<= d -1.3e-120)
t_0
(if (<= d 4e-175)
(/ (- b (/ (* d a) c)) c)
(if (<= d 2.2e+152) t_0 t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = fma((c / hypot(c, d)), (b / hypot(c, d)), ((d / pow(hypot(c, d), 2.0)) * -a));
double t_1 = ((c / (d / b)) - a) / d;
double tmp;
if (d <= -2.95e+180) {
tmp = t_1;
} else if (d <= -1.3e-120) {
tmp = t_0;
} else if (d <= 4e-175) {
tmp = (b - ((d * a) / c)) / c;
} else if (d <= 2.2e+152) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(a, b, c, d) t_0 = fma(Float64(c / hypot(c, d)), Float64(b / hypot(c, d)), Float64(Float64(d / (hypot(c, d) ^ 2.0)) * Float64(-a))) t_1 = Float64(Float64(Float64(c / Float64(d / b)) - a) / d) tmp = 0.0 if (d <= -2.95e+180) tmp = t_1; elseif (d <= -1.3e-120) tmp = t_0; elseif (d <= 4e-175) tmp = Float64(Float64(b - Float64(Float64(d * a) / c)) / c); elseif (d <= 2.2e+152) tmp = t_0; else tmp = t_1; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(c / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] + N[(N[(d / N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * (-a)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(c / N[(d / b), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -2.95e+180], t$95$1, If[LessEqual[d, -1.3e-120], t$95$0, If[LessEqual[d, 4e-175], N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 2.2e+152], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{d}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}} \cdot \left(-a\right)\right)\\
t_1 := \frac{\frac{c}{\frac{d}{b}} - a}{d}\\
\mathbf{if}\;d \leq -2.95 \cdot 10^{+180}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d \leq -1.3 \cdot 10^{-120}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 4 \cdot 10^{-175}:\\
\;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
\mathbf{elif}\;d \leq 2.2 \cdot 10^{+152}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d < -2.9500000000000001e180 or 2.1999999999999998e152 < d Initial program 34.3%
Taylor expanded in c around 0 70.4%
+-commutative70.4%
mul-1-neg70.4%
unsub-neg70.4%
unpow270.4%
associate-/r*74.1%
div-sub74.1%
*-commutative74.1%
associate-/l*89.2%
Simplified89.2%
clear-num91.0%
un-div-inv91.0%
Applied egg-rr91.0%
if -2.9500000000000001e180 < d < -1.3000000000000001e-120 or 4e-175 < d < 2.1999999999999998e152Initial program 78.0%
div-sub78.0%
*-commutative78.0%
add-sqr-sqrt77.9%
times-frac80.5%
fmm-def80.5%
hypot-define80.6%
hypot-define90.5%
associate-/l*93.9%
add-sqr-sqrt93.9%
pow293.9%
hypot-define93.9%
Applied egg-rr93.9%
if -1.3000000000000001e-120 < d < 4e-175Initial program 71.2%
div-sub63.8%
*-commutative63.8%
add-sqr-sqrt63.8%
times-frac66.4%
fmm-def66.4%
hypot-define66.4%
hypot-define89.1%
associate-/l*89.2%
add-sqr-sqrt89.2%
pow289.2%
hypot-define89.2%
Applied egg-rr89.2%
Taylor expanded in c around inf 96.3%
mul-1-neg96.3%
unsub-neg96.3%
*-commutative96.3%
Simplified96.3%
Final simplification94.1%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (/ c (/ d b)) a) d)))
(if (<= d -2.1e+118)
t_0
(if (<= d -2.5e-114)
(/ (fma b c (* d (- a))) (fma d d (* c c)))
(if (<= d 5.4e-158)
(/ (- b (/ (* d a) c)) c)
(if (<= d 1.45e+75)
(/ (- (* c b) (* d a)) (+ (* c c) (* d d)))
t_0))))))
double code(double a, double b, double c, double d) {
double t_0 = ((c / (d / b)) - a) / d;
double tmp;
if (d <= -2.1e+118) {
tmp = t_0;
} else if (d <= -2.5e-114) {
tmp = fma(b, c, (d * -a)) / fma(d, d, (c * c));
} else if (d <= 5.4e-158) {
tmp = (b - ((d * a) / c)) / c;
} else if (d <= 1.45e+75) {
tmp = ((c * b) - (d * a)) / ((c * c) + (d * d));
} else {
tmp = t_0;
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(Float64(Float64(c / Float64(d / b)) - a) / d) tmp = 0.0 if (d <= -2.1e+118) tmp = t_0; elseif (d <= -2.5e-114) tmp = Float64(fma(b, c, Float64(d * Float64(-a))) / fma(d, d, Float64(c * c))); elseif (d <= 5.4e-158) tmp = Float64(Float64(b - Float64(Float64(d * a) / c)) / c); elseif (d <= 1.45e+75) tmp = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(Float64(c * c) + Float64(d * d))); else tmp = t_0; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(c / N[(d / b), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -2.1e+118], t$95$0, If[LessEqual[d, -2.5e-114], N[(N[(b * c + N[(d * (-a)), $MachinePrecision]), $MachinePrecision] / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.4e-158], N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 1.45e+75], N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{c}{\frac{d}{b}} - a}{d}\\
\mathbf{if}\;d \leq -2.1 \cdot 10^{+118}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -2.5 \cdot 10^{-114}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, c, d \cdot \left(-a\right)\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\
\mathbf{elif}\;d \leq 5.4 \cdot 10^{-158}:\\
\;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
\mathbf{elif}\;d \leq 1.45 \cdot 10^{+75}:\\
\;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d < -2.1e118 or 1.4499999999999999e75 < d Initial program 41.3%
Taylor expanded in c around 0 66.6%
+-commutative66.6%
mul-1-neg66.6%
unsub-neg66.6%
unpow266.6%
associate-/r*69.1%
div-sub69.1%
*-commutative69.1%
associate-/l*80.4%
Simplified80.4%
clear-num82.8%
un-div-inv82.8%
Applied egg-rr82.8%
if -2.1e118 < d < -2.49999999999999995e-114Initial program 82.8%
fmm-def82.8%
distribute-rgt-neg-out82.8%
+-commutative82.8%
fma-define82.8%
Simplified82.8%
if -2.49999999999999995e-114 < d < 5.3999999999999997e-158Initial program 71.0%
div-sub64.0%
*-commutative64.0%
add-sqr-sqrt64.0%
times-frac66.4%
fmm-def66.4%
hypot-define66.4%
hypot-define88.8%
associate-/l*88.9%
add-sqr-sqrt88.9%
pow288.9%
hypot-define88.9%
Applied egg-rr88.9%
Taylor expanded in c around inf 95.5%
mul-1-neg95.5%
unsub-neg95.5%
*-commutative95.5%
Simplified95.5%
if 5.3999999999999997e-158 < d < 1.4499999999999999e75Initial program 88.1%
Final simplification88.0%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (+ (* c c) (* d d))))
(t_1 (/ (- (/ c (/ d b)) a) d)))
(if (<= d -1.9e+118)
t_1
(if (<= d -1.45e-114)
t_0
(if (<= d 1.65e-158)
(/ (- b (/ (* d a) c)) c)
(if (<= d 1.8e+75) t_0 t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d));
double t_1 = ((c / (d / b)) - a) / d;
double tmp;
if (d <= -1.9e+118) {
tmp = t_1;
} else if (d <= -1.45e-114) {
tmp = t_0;
} else if (d <= 1.65e-158) {
tmp = (b - ((d * a) / c)) / c;
} else if (d <= 1.8e+75) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d))
t_1 = ((c / (d / b)) - a) / d
if (d <= (-1.9d+118)) then
tmp = t_1
else if (d <= (-1.45d-114)) then
tmp = t_0
else if (d <= 1.65d-158) then
tmp = (b - ((d * a) / c)) / c
else if (d <= 1.8d+75) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d));
double t_1 = ((c / (d / b)) - a) / d;
double tmp;
if (d <= -1.9e+118) {
tmp = t_1;
} else if (d <= -1.45e-114) {
tmp = t_0;
} else if (d <= 1.65e-158) {
tmp = (b - ((d * a) / c)) / c;
} else if (d <= 1.8e+75) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d)) t_1 = ((c / (d / b)) - a) / d tmp = 0 if d <= -1.9e+118: tmp = t_1 elif d <= -1.45e-114: tmp = t_0 elif d <= 1.65e-158: tmp = (b - ((d * a) / c)) / c elif d <= 1.8e+75: tmp = t_0 else: tmp = t_1 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(Float64(c * c) + Float64(d * d))) t_1 = Float64(Float64(Float64(c / Float64(d / b)) - a) / d) tmp = 0.0 if (d <= -1.9e+118) tmp = t_1; elseif (d <= -1.45e-114) tmp = t_0; elseif (d <= 1.65e-158) tmp = Float64(Float64(b - Float64(Float64(d * a) / c)) / c); elseif (d <= 1.8e+75) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d)); t_1 = ((c / (d / b)) - a) / d; tmp = 0.0; if (d <= -1.9e+118) tmp = t_1; elseif (d <= -1.45e-114) tmp = t_0; elseif (d <= 1.65e-158) tmp = (b - ((d * a) / c)) / c; elseif (d <= 1.8e+75) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(c / N[(d / b), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -1.9e+118], t$95$1, If[LessEqual[d, -1.45e-114], t$95$0, If[LessEqual[d, 1.65e-158], N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 1.8e+75], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
t_1 := \frac{\frac{c}{\frac{d}{b}} - a}{d}\\
\mathbf{if}\;d \leq -1.9 \cdot 10^{+118}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d \leq -1.45 \cdot 10^{-114}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 1.65 \cdot 10^{-158}:\\
\;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
\mathbf{elif}\;d \leq 1.8 \cdot 10^{+75}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d < -1.90000000000000008e118 or 1.8e75 < d Initial program 41.3%
Taylor expanded in c around 0 66.6%
+-commutative66.6%
mul-1-neg66.6%
unsub-neg66.6%
unpow266.6%
associate-/r*69.1%
div-sub69.1%
*-commutative69.1%
associate-/l*80.4%
Simplified80.4%
clear-num82.8%
un-div-inv82.8%
Applied egg-rr82.8%
if -1.90000000000000008e118 < d < -1.44999999999999998e-114 or 1.6500000000000001e-158 < d < 1.8e75Initial program 85.2%
if -1.44999999999999998e-114 < d < 1.6500000000000001e-158Initial program 71.0%
div-sub64.0%
*-commutative64.0%
add-sqr-sqrt64.0%
times-frac66.4%
fmm-def66.4%
hypot-define66.4%
hypot-define88.8%
associate-/l*88.9%
add-sqr-sqrt88.9%
pow288.9%
hypot-define88.9%
Applied egg-rr88.9%
Taylor expanded in c around inf 95.5%
mul-1-neg95.5%
unsub-neg95.5%
*-commutative95.5%
Simplified95.5%
Final simplification88.0%
(FPCore (a b c d)
:precision binary64
(if (<= c -5.6e-108)
(/ (- b (/ (* d a) c)) c)
(if (<= c 7.5e-113)
(/ (- (/ (* c b) d) a) d)
(if (<= c 1.05e-30)
(/ (* c b) (+ (* c c) (* d d)))
(if (<= c 3600.0)
(/ (- (* b (/ c d)) a) d)
(/ (- b (* d (/ a c))) c))))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -5.6e-108) {
tmp = (b - ((d * a) / c)) / c;
} else if (c <= 7.5e-113) {
tmp = (((c * b) / d) - a) / d;
} else if (c <= 1.05e-30) {
tmp = (c * b) / ((c * c) + (d * d));
} else if (c <= 3600.0) {
tmp = ((b * (c / d)) - a) / d;
} else {
tmp = (b - (d * (a / 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 (c <= (-5.6d-108)) then
tmp = (b - ((d * a) / c)) / c
else if (c <= 7.5d-113) then
tmp = (((c * b) / d) - a) / d
else if (c <= 1.05d-30) then
tmp = (c * b) / ((c * c) + (d * d))
else if (c <= 3600.0d0) then
tmp = ((b * (c / d)) - a) / d
else
tmp = (b - (d * (a / c))) / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if (c <= -5.6e-108) {
tmp = (b - ((d * a) / c)) / c;
} else if (c <= 7.5e-113) {
tmp = (((c * b) / d) - a) / d;
} else if (c <= 1.05e-30) {
tmp = (c * b) / ((c * c) + (d * d));
} else if (c <= 3600.0) {
tmp = ((b * (c / d)) - a) / d;
} else {
tmp = (b - (d * (a / c))) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -5.6e-108: tmp = (b - ((d * a) / c)) / c elif c <= 7.5e-113: tmp = (((c * b) / d) - a) / d elif c <= 1.05e-30: tmp = (c * b) / ((c * c) + (d * d)) elif c <= 3600.0: tmp = ((b * (c / d)) - a) / d else: tmp = (b - (d * (a / c))) / c return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -5.6e-108) tmp = Float64(Float64(b - Float64(Float64(d * a) / c)) / c); elseif (c <= 7.5e-113) tmp = Float64(Float64(Float64(Float64(c * b) / d) - a) / d); elseif (c <= 1.05e-30) tmp = Float64(Float64(c * b) / Float64(Float64(c * c) + Float64(d * d))); elseif (c <= 3600.0) tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d); else tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (c <= -5.6e-108) tmp = (b - ((d * a) / c)) / c; elseif (c <= 7.5e-113) tmp = (((c * b) / d) - a) / d; elseif (c <= 1.05e-30) tmp = (c * b) / ((c * c) + (d * d)); elseif (c <= 3600.0) tmp = ((b * (c / d)) - a) / d; else tmp = (b - (d * (a / c))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -5.6e-108], N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 7.5e-113], N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 1.05e-30], N[(N[(c * b), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 3600.0], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -5.6 \cdot 10^{-108}:\\
\;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
\mathbf{elif}\;c \leq 7.5 \cdot 10^{-113}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{elif}\;c \leq 1.05 \cdot 10^{-30}:\\
\;\;\;\;\frac{c \cdot b}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;c \leq 3600:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\end{array}
\end{array}
if c < -5.6e-108Initial program 67.6%
div-sub67.6%
*-commutative67.6%
add-sqr-sqrt67.6%
times-frac70.4%
fmm-def70.4%
hypot-define70.4%
hypot-define89.6%
associate-/l*90.9%
add-sqr-sqrt90.9%
pow290.9%
hypot-define90.8%
Applied egg-rr90.8%
Taylor expanded in c around inf 74.9%
mul-1-neg74.9%
unsub-neg74.9%
*-commutative74.9%
Simplified74.9%
if -5.6e-108 < c < 7.5000000000000002e-113Initial program 82.0%
Taylor expanded in c around 0 84.5%
+-commutative84.5%
mul-1-neg84.5%
unsub-neg84.5%
unpow284.5%
associate-/r*91.0%
div-sub93.5%
*-commutative93.5%
associate-/l*92.1%
Simplified92.1%
associate-*r/93.5%
Applied egg-rr93.5%
if 7.5000000000000002e-113 < c < 1.0500000000000001e-30Initial program 99.7%
Taylor expanded in b around inf 79.1%
*-commutative79.1%
Simplified79.1%
if 1.0500000000000001e-30 < c < 3600Initial program 43.7%
Taylor expanded in c around 0 86.0%
+-commutative86.0%
mul-1-neg86.0%
unsub-neg86.0%
unpow286.0%
associate-/r*86.2%
div-sub86.2%
*-commutative86.2%
associate-/l*86.0%
Simplified86.0%
clear-num86.0%
un-div-inv86.0%
Applied egg-rr86.0%
associate-/r/86.2%
Applied egg-rr86.2%
if 3600 < c Initial program 48.2%
div-sub48.2%
*-commutative48.2%
add-sqr-sqrt48.2%
times-frac52.8%
fmm-def52.8%
hypot-define52.8%
hypot-define80.8%
associate-/l*83.4%
add-sqr-sqrt83.4%
pow283.4%
hypot-define83.4%
Applied egg-rr83.4%
Taylor expanded in c around inf 68.4%
mul-1-neg68.4%
unsub-neg68.4%
*-commutative68.4%
Simplified68.4%
associate-/l*74.9%
Applied egg-rr74.9%
Final simplification81.0%
(FPCore (a b c d) :precision binary64 (if (or (<= d -1.2e+79) (not (<= d 4.7e+33))) (/ a (- d)) (/ (- b (* a (/ d c))) c)))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -1.2e+79) || !(d <= 4.7e+33)) {
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 <= (-1.2d+79)) .or. (.not. (d <= 4.7d+33))) 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 <= -1.2e+79) || !(d <= 4.7e+33)) {
tmp = a / -d;
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -1.2e+79) or not (d <= 4.7e+33): tmp = a / -d else: tmp = (b - (a * (d / c))) / c return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -1.2e+79) || !(d <= 4.7e+33)) tmp = Float64(a / Float64(-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 <= -1.2e+79) || ~((d <= 4.7e+33))) tmp = a / -d; else tmp = (b - (a * (d / c))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -1.2e+79], N[Not[LessEqual[d, 4.7e+33]], $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 -1.2 \cdot 10^{+79} \lor \neg \left(d \leq 4.7 \cdot 10^{+33}\right):\\
\;\;\;\;\frac{a}{-d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if d < -1.19999999999999993e79 or 4.6999999999999998e33 < d Initial program 52.0%
Taylor expanded in c around 0 67.0%
associate-*r/67.0%
neg-mul-167.0%
Simplified67.0%
if -1.19999999999999993e79 < d < 4.6999999999999998e33Initial program 76.5%
Taylor expanded in c around inf 75.6%
mul-1-neg75.6%
unsub-neg75.6%
unsub-neg75.6%
mul-1-neg75.6%
remove-double-neg75.6%
mul-1-neg75.6%
neg-mul-175.6%
distribute-lft-in75.6%
distribute-lft-in75.6%
mul-1-neg75.6%
unsub-neg75.6%
neg-mul-175.6%
mul-1-neg75.6%
remove-double-neg75.6%
associate-/l*76.5%
Simplified76.5%
Final simplification73.0%
(FPCore (a b c d) :precision binary64 (if (<= c -1.35e-105) (/ (- b (/ (* d a) c)) c) (if (<= c 3000.0) (/ (- (* c (/ b d)) a) d) (/ (- b (* d (/ a c))) c))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -1.35e-105) {
tmp = (b - ((d * a) / c)) / c;
} else if (c <= 3000.0) {
tmp = ((c * (b / d)) - a) / d;
} else {
tmp = (b - (d * (a / 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 (c <= (-1.35d-105)) then
tmp = (b - ((d * a) / c)) / c
else if (c <= 3000.0d0) then
tmp = ((c * (b / d)) - a) / d
else
tmp = (b - (d * (a / c))) / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if (c <= -1.35e-105) {
tmp = (b - ((d * a) / c)) / c;
} else if (c <= 3000.0) {
tmp = ((c * (b / d)) - a) / d;
} else {
tmp = (b - (d * (a / c))) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -1.35e-105: tmp = (b - ((d * a) / c)) / c elif c <= 3000.0: tmp = ((c * (b / d)) - a) / d else: tmp = (b - (d * (a / c))) / c return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -1.35e-105) tmp = Float64(Float64(b - Float64(Float64(d * a) / c)) / c); elseif (c <= 3000.0) tmp = Float64(Float64(Float64(c * Float64(b / d)) - a) / d); else tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (c <= -1.35e-105) tmp = (b - ((d * a) / c)) / c; elseif (c <= 3000.0) tmp = ((c * (b / d)) - a) / d; else tmp = (b - (d * (a / c))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -1.35e-105], N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 3000.0], N[(N[(N[(c * N[(b / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.35 \cdot 10^{-105}:\\
\;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
\mathbf{elif}\;c \leq 3000:\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\end{array}
\end{array}
if c < -1.34999999999999996e-105Initial program 67.6%
div-sub67.6%
*-commutative67.6%
add-sqr-sqrt67.6%
times-frac70.4%
fmm-def70.4%
hypot-define70.4%
hypot-define89.6%
associate-/l*90.9%
add-sqr-sqrt90.9%
pow290.9%
hypot-define90.8%
Applied egg-rr90.8%
Taylor expanded in c around inf 74.9%
mul-1-neg74.9%
unsub-neg74.9%
*-commutative74.9%
Simplified74.9%
if -1.34999999999999996e-105 < c < 3e3Initial program 81.8%
Taylor expanded in c around 0 79.0%
+-commutative79.0%
mul-1-neg79.0%
unsub-neg79.0%
unpow279.0%
associate-/r*84.1%
div-sub86.2%
*-commutative86.2%
associate-/l*85.1%
Simplified85.1%
if 3e3 < c Initial program 48.2%
div-sub48.2%
*-commutative48.2%
add-sqr-sqrt48.2%
times-frac52.8%
fmm-def52.8%
hypot-define52.8%
hypot-define80.8%
associate-/l*83.4%
add-sqr-sqrt83.4%
pow283.4%
hypot-define83.4%
Applied egg-rr83.4%
Taylor expanded in c around inf 68.4%
mul-1-neg68.4%
unsub-neg68.4%
*-commutative68.4%
Simplified68.4%
associate-/l*74.9%
Applied egg-rr74.9%
Final simplification78.8%
(FPCore (a b c d) :precision binary64 (if (<= c -1.35e-105) (/ (- b (/ (* d a) c)) c) (if (<= c 2900.0) (/ (- (* b (/ c d)) a) d) (/ (- b (* d (/ a c))) c))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -1.35e-105) {
tmp = (b - ((d * a) / c)) / c;
} else if (c <= 2900.0) {
tmp = ((b * (c / d)) - a) / d;
} else {
tmp = (b - (d * (a / 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 (c <= (-1.35d-105)) then
tmp = (b - ((d * a) / c)) / c
else if (c <= 2900.0d0) then
tmp = ((b * (c / d)) - a) / d
else
tmp = (b - (d * (a / c))) / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if (c <= -1.35e-105) {
tmp = (b - ((d * a) / c)) / c;
} else if (c <= 2900.0) {
tmp = ((b * (c / d)) - a) / d;
} else {
tmp = (b - (d * (a / c))) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -1.35e-105: tmp = (b - ((d * a) / c)) / c elif c <= 2900.0: tmp = ((b * (c / d)) - a) / d else: tmp = (b - (d * (a / c))) / c return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -1.35e-105) tmp = Float64(Float64(b - Float64(Float64(d * a) / c)) / c); elseif (c <= 2900.0) tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d); else tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (c <= -1.35e-105) tmp = (b - ((d * a) / c)) / c; elseif (c <= 2900.0) tmp = ((b * (c / d)) - a) / d; else tmp = (b - (d * (a / c))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -1.35e-105], N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 2900.0], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.35 \cdot 10^{-105}:\\
\;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
\mathbf{elif}\;c \leq 2900:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\end{array}
\end{array}
if c < -1.34999999999999996e-105Initial program 67.6%
div-sub67.6%
*-commutative67.6%
add-sqr-sqrt67.6%
times-frac70.4%
fmm-def70.4%
hypot-define70.4%
hypot-define89.6%
associate-/l*90.9%
add-sqr-sqrt90.9%
pow290.9%
hypot-define90.8%
Applied egg-rr90.8%
Taylor expanded in c around inf 74.9%
mul-1-neg74.9%
unsub-neg74.9%
*-commutative74.9%
Simplified74.9%
if -1.34999999999999996e-105 < c < 2900Initial program 81.8%
Taylor expanded in c around 0 79.0%
+-commutative79.0%
mul-1-neg79.0%
unsub-neg79.0%
unpow279.0%
associate-/r*84.1%
div-sub86.2%
*-commutative86.2%
associate-/l*85.1%
Simplified85.1%
clear-num85.0%
un-div-inv85.1%
Applied egg-rr85.1%
associate-/r/86.0%
Applied egg-rr86.0%
if 2900 < c Initial program 48.2%
div-sub48.2%
*-commutative48.2%
add-sqr-sqrt48.2%
times-frac52.8%
fmm-def52.8%
hypot-define52.8%
hypot-define80.8%
associate-/l*83.4%
add-sqr-sqrt83.4%
pow283.4%
hypot-define83.4%
Applied egg-rr83.4%
Taylor expanded in c around inf 68.4%
mul-1-neg68.4%
unsub-neg68.4%
*-commutative68.4%
Simplified68.4%
associate-/l*74.9%
Applied egg-rr74.9%
Final simplification79.1%
(FPCore (a b c d) :precision binary64 (if (<= c -2.9e-108) (/ (- b (/ (* d a) c)) c) (if (<= c 2800.0) (/ (- (/ (* c b) d) a) d) (/ (- b (* d (/ a c))) c))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -2.9e-108) {
tmp = (b - ((d * a) / c)) / c;
} else if (c <= 2800.0) {
tmp = (((c * b) / d) - a) / d;
} else {
tmp = (b - (d * (a / 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 (c <= (-2.9d-108)) then
tmp = (b - ((d * a) / c)) / c
else if (c <= 2800.0d0) then
tmp = (((c * b) / d) - a) / d
else
tmp = (b - (d * (a / c))) / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if (c <= -2.9e-108) {
tmp = (b - ((d * a) / c)) / c;
} else if (c <= 2800.0) {
tmp = (((c * b) / d) - a) / d;
} else {
tmp = (b - (d * (a / c))) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -2.9e-108: tmp = (b - ((d * a) / c)) / c elif c <= 2800.0: tmp = (((c * b) / d) - a) / d else: tmp = (b - (d * (a / c))) / c return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -2.9e-108) tmp = Float64(Float64(b - Float64(Float64(d * a) / c)) / c); elseif (c <= 2800.0) tmp = Float64(Float64(Float64(Float64(c * b) / d) - a) / d); else tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (c <= -2.9e-108) tmp = (b - ((d * a) / c)) / c; elseif (c <= 2800.0) tmp = (((c * b) / d) - a) / d; else tmp = (b - (d * (a / c))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -2.9e-108], N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 2800.0], N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.9 \cdot 10^{-108}:\\
\;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
\mathbf{elif}\;c \leq 2800:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\end{array}
\end{array}
if c < -2.9000000000000001e-108Initial program 67.6%
div-sub67.6%
*-commutative67.6%
add-sqr-sqrt67.6%
times-frac70.4%
fmm-def70.4%
hypot-define70.4%
hypot-define89.6%
associate-/l*90.9%
add-sqr-sqrt90.9%
pow290.9%
hypot-define90.8%
Applied egg-rr90.8%
Taylor expanded in c around inf 74.9%
mul-1-neg74.9%
unsub-neg74.9%
*-commutative74.9%
Simplified74.9%
if -2.9000000000000001e-108 < c < 2800Initial program 81.8%
Taylor expanded in c around 0 79.0%
+-commutative79.0%
mul-1-neg79.0%
unsub-neg79.0%
unpow279.0%
associate-/r*84.1%
div-sub86.2%
*-commutative86.2%
associate-/l*85.1%
Simplified85.1%
associate-*r/86.2%
Applied egg-rr86.2%
if 2800 < c Initial program 48.2%
div-sub48.2%
*-commutative48.2%
add-sqr-sqrt48.2%
times-frac52.8%
fmm-def52.8%
hypot-define52.8%
hypot-define80.8%
associate-/l*83.4%
add-sqr-sqrt83.4%
pow283.4%
hypot-define83.4%
Applied egg-rr83.4%
Taylor expanded in c around inf 68.4%
mul-1-neg68.4%
unsub-neg68.4%
*-commutative68.4%
Simplified68.4%
associate-/l*74.9%
Applied egg-rr74.9%
Final simplification79.2%
(FPCore (a b c d) :precision binary64 (if (or (<= c -5.6e-108) (not (<= c 8.5e-124))) (/ b c) (/ a (- d))))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -5.6e-108) || !(c <= 8.5e-124)) {
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.6d-108)) .or. (.not. (c <= 8.5d-124))) 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.6e-108) || !(c <= 8.5e-124)) {
tmp = b / c;
} else {
tmp = a / -d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -5.6e-108) or not (c <= 8.5e-124): tmp = b / c else: tmp = a / -d return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -5.6e-108) || !(c <= 8.5e-124)) tmp = Float64(b / c); else tmp = Float64(a / Float64(-d)); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((c <= -5.6e-108) || ~((c <= 8.5e-124))) tmp = b / c; else tmp = a / -d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -5.6e-108], N[Not[LessEqual[c, 8.5e-124]], $MachinePrecision]], N[(b / c), $MachinePrecision], N[(a / (-d)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -5.6 \cdot 10^{-108} \lor \neg \left(c \leq 8.5 \cdot 10^{-124}\right):\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{-d}\\
\end{array}
\end{array}
if c < -5.6e-108 or 8.5000000000000002e-124 < c Initial program 61.7%
Taylor expanded in c around inf 60.0%
if -5.6e-108 < c < 8.5000000000000002e-124Initial program 81.5%
Taylor expanded in c around 0 71.2%
associate-*r/71.2%
neg-mul-171.2%
Simplified71.2%
Final simplification63.3%
(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 67.5%
Taylor expanded in c around inf 47.4%
Final simplification47.4%
(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 2024095
(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))))