
(FPCore (a b c d) :precision binary64 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = ((b * c) - (a * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d): return ((b * c) - (a * d)) / ((c * c) + (d * d))
function code(a, b, c, d) return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))) end
function tmp = code(a, b, c, d) tmp = ((b * c) - (a * d)) / ((c * c) + (d * d)); end
code[a_, b_, c_, d_] := N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c d) :precision binary64 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = ((b * c) - (a * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d): return ((b * c) - (a * d)) / ((c * c) + (d * d))
function code(a, b, c, d) return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))) end
function tmp = code(a, b, c, d) tmp = ((b * c) - (a * d)) / ((c * c) + (d * d)); end
code[a_, b_, c_, d_] := N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\end{array}
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* b c) (* a d))))
(if (<= (/ t_0 (+ (* c c) (* d d))) 5e+143)
(* (/ 1.0 (hypot c d)) (/ t_0 (hypot c d)))
(fma
(/ c (hypot c d))
(/ b (hypot c d))
(/ (- a) (* (hypot c d) (/ (hypot c d) d)))))))
double code(double a, double b, double c, double d) {
double t_0 = (b * c) - (a * d);
double tmp;
if ((t_0 / ((c * c) + (d * d))) <= 5e+143) {
tmp = (1.0 / hypot(c, d)) * (t_0 / hypot(c, d));
} else {
tmp = fma((c / hypot(c, d)), (b / hypot(c, d)), (-a / (hypot(c, d) * (hypot(c, d) / d))));
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(Float64(b * c) - Float64(a * d)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(c * c) + Float64(d * d))) <= 5e+143) tmp = Float64(Float64(1.0 / hypot(c, d)) * Float64(t_0 / hypot(c, d))); else tmp = fma(Float64(c / hypot(c, d)), Float64(b / hypot(c, d)), Float64(Float64(-a) / Float64(hypot(c, d) * Float64(hypot(c, d) / d)))); end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+143], N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision] * N[(N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot c - a \cdot d\\
\mathbf{if}\;\frac{t_0}{c \cdot c + d \cdot d} \leq 5 \cdot 10^{+143}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t_0}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{-a}{\mathsf{hypot}\left(c, d\right) \cdot \frac{\mathsf{hypot}\left(c, d\right)}{d}}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < 5.00000000000000012e143Initial program 80.1%
*-un-lft-identity80.1%
add-sqr-sqrt80.1%
times-frac80.2%
hypot-def80.2%
hypot-def98.0%
Applied egg-rr98.0%
if 5.00000000000000012e143 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) Initial program 24.6%
div-sub21.7%
sub-neg21.7%
*-commutative21.7%
add-sqr-sqrt21.7%
times-frac26.3%
fma-def26.3%
hypot-def26.3%
hypot-def69.5%
associate-/l*72.0%
add-sqr-sqrt72.0%
pow272.0%
hypot-def72.0%
Applied egg-rr72.0%
unpow272.0%
*-un-lft-identity72.0%
times-frac97.1%
Applied egg-rr97.1%
Final simplification97.8%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* b c) (* a d))))
(if (<= (/ t_0 (+ (* c c) (* d d))) 5e+271)
(* (/ 1.0 (hypot c d)) (/ t_0 (hypot c d)))
(fma 1.0 (/ b (hypot c d)) (/ (- a) (* (hypot c d) (/ (hypot c d) d)))))))
double code(double a, double b, double c, double d) {
double t_0 = (b * c) - (a * d);
double tmp;
if ((t_0 / ((c * c) + (d * d))) <= 5e+271) {
tmp = (1.0 / hypot(c, d)) * (t_0 / hypot(c, d));
} else {
tmp = fma(1.0, (b / hypot(c, d)), (-a / (hypot(c, d) * (hypot(c, d) / d))));
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(Float64(b * c) - Float64(a * d)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(c * c) + Float64(d * d))) <= 5e+271) tmp = Float64(Float64(1.0 / hypot(c, d)) * Float64(t_0 / hypot(c, d))); else tmp = fma(1.0, Float64(b / hypot(c, d)), Float64(Float64(-a) / Float64(hypot(c, d) * Float64(hypot(c, d) / d)))); end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+271], N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] + N[((-a) / N[(N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision] * N[(N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot c - a \cdot d\\
\mathbf{if}\;\frac{t_0}{c \cdot c + d \cdot d} \leq 5 \cdot 10^{+271}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t_0}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, \frac{b}{\mathsf{hypot}\left(c, d\right)}, \frac{-a}{\mathsf{hypot}\left(c, d\right) \cdot \frac{\mathsf{hypot}\left(c, d\right)}{d}}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < 5.0000000000000003e271Initial program 81.2%
*-un-lft-identity81.2%
add-sqr-sqrt81.2%
times-frac81.3%
hypot-def81.3%
hypot-def98.1%
Applied egg-rr98.1%
if 5.0000000000000003e271 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) Initial program 10.5%
div-sub7.0%
sub-neg7.0%
*-commutative7.0%
add-sqr-sqrt7.0%
times-frac12.4%
fma-def12.4%
hypot-def12.5%
hypot-def63.8%
associate-/l*66.8%
add-sqr-sqrt66.8%
pow266.8%
hypot-def66.8%
Applied egg-rr66.8%
unpow266.8%
*-un-lft-identity66.8%
times-frac96.6%
Applied egg-rr96.6%
Taylor expanded in c around inf 72.5%
Final simplification92.3%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* b c) (* a d))))
(if (<= (/ t_0 (+ (* c c) (* d d))) 1e+261)
(* (/ 1.0 (hypot c d)) (/ t_0 (hypot c d)))
(fma (/ c (hypot c d)) (/ b (hypot c d)) (- (/ a d))))))
double code(double a, double b, double c, double d) {
double t_0 = (b * c) - (a * d);
double tmp;
if ((t_0 / ((c * c) + (d * d))) <= 1e+261) {
tmp = (1.0 / hypot(c, d)) * (t_0 / hypot(c, d));
} else {
tmp = fma((c / hypot(c, d)), (b / hypot(c, d)), -(a / d));
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(Float64(b * c) - Float64(a * d)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(c * c) + Float64(d * d))) <= 1e+261) tmp = Float64(Float64(1.0 / hypot(c, d)) * Float64(t_0 / hypot(c, d))); else tmp = fma(Float64(c / hypot(c, d)), Float64(b / hypot(c, d)), Float64(-Float64(a / d))); end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+261], N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] + (-N[(a / d), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot c - a \cdot d\\
\mathbf{if}\;\frac{t_0}{c \cdot c + d \cdot d} \leq 10^{+261}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t_0}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{hypot}\left(c, d\right)}, \frac{b}{\mathsf{hypot}\left(c, d\right)}, -\frac{a}{d}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < 9.9999999999999993e260Initial program 81.1%
*-un-lft-identity81.1%
add-sqr-sqrt81.1%
times-frac81.2%
hypot-def81.2%
hypot-def98.1%
Applied egg-rr98.1%
if 9.9999999999999993e260 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) Initial program 12.0%
div-sub8.6%
sub-neg8.6%
*-commutative8.6%
add-sqr-sqrt8.6%
times-frac13.9%
fma-def13.9%
hypot-def13.9%
hypot-def64.4%
associate-/l*67.4%
add-sqr-sqrt67.4%
pow267.4%
hypot-def67.4%
Applied egg-rr67.4%
Taylor expanded in c around 0 70.3%
Final simplification91.7%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* b c) (* a d))))
(if (<= (/ t_0 (+ (* c c) (* d d))) 5e+248)
(* (/ 1.0 (hypot c d)) (/ t_0 (hypot c d)))
(- (/ b c) (/ (* a (/ d c)) c)))))
double code(double a, double b, double c, double d) {
double t_0 = (b * c) - (a * d);
double tmp;
if ((t_0 / ((c * c) + (d * d))) <= 5e+248) {
tmp = (1.0 / hypot(c, d)) * (t_0 / hypot(c, d));
} else {
tmp = (b / c) - ((a * (d / c)) / c);
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = (b * c) - (a * d);
double tmp;
if ((t_0 / ((c * c) + (d * d))) <= 5e+248) {
tmp = (1.0 / Math.hypot(c, d)) * (t_0 / Math.hypot(c, d));
} else {
tmp = (b / c) - ((a * (d / c)) / c);
}
return tmp;
}
def code(a, b, c, d): t_0 = (b * c) - (a * d) tmp = 0 if (t_0 / ((c * c) + (d * d))) <= 5e+248: tmp = (1.0 / math.hypot(c, d)) * (t_0 / math.hypot(c, d)) else: tmp = (b / c) - ((a * (d / c)) / c) return tmp
function code(a, b, c, d) t_0 = Float64(Float64(b * c) - Float64(a * d)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(c * c) + Float64(d * d))) <= 5e+248) tmp = Float64(Float64(1.0 / hypot(c, d)) * Float64(t_0 / hypot(c, d))); else tmp = Float64(Float64(b / c) - Float64(Float64(a * Float64(d / c)) / c)); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (b * c) - (a * d); tmp = 0.0; if ((t_0 / ((c * c) + (d * d))) <= 5e+248) tmp = (1.0 / hypot(c, d)) * (t_0 / hypot(c, d)); else tmp = (b / c) - ((a * (d / c)) / c); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+248], N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b / c), $MachinePrecision] - N[(N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot c - a \cdot d\\
\mathbf{if}\;\frac{t_0}{c \cdot c + d \cdot d} \leq 5 \cdot 10^{+248}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t_0}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < 4.9999999999999996e248Initial program 81.0%
*-un-lft-identity81.0%
add-sqr-sqrt81.0%
times-frac81.1%
hypot-def81.1%
hypot-def98.1%
Applied egg-rr98.1%
if 4.9999999999999996e248 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) Initial program 13.4%
Taylor expanded in c around inf 61.8%
+-commutative61.8%
mul-1-neg61.8%
unsub-neg61.8%
*-commutative61.8%
associate-/l*60.7%
Simplified60.7%
*-un-lft-identity60.7%
add-sqr-sqrt36.0%
times-frac36.0%
sqrt-div36.0%
unpow236.0%
sqrt-prod25.4%
add-sqr-sqrt34.1%
sqrt-div34.1%
unpow234.1%
sqrt-prod27.0%
add-sqr-sqrt43.7%
Applied egg-rr43.7%
associate-*l/43.7%
*-lft-identity43.7%
associate-/r/43.7%
Simplified43.7%
sub-neg43.7%
associate-/r/42.2%
Applied egg-rr42.2%
sub-neg42.2%
associate-*l/43.8%
associate-*l*43.8%
rem-square-sqrt68.5%
Simplified68.5%
Final simplification91.2%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
(t_1 (- (/ b c) (/ (* a (/ d c)) c))))
(if (<= c -4e+123)
t_1
(if (<= c -1.8e-105)
t_0
(if (<= c 3.3e-102)
(- (/ 1.0 (/ (pow d 2.0) (* b c))) (/ a d))
(if (<= c 1.7e+142) t_0 t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d));
double t_1 = (b / c) - ((a * (d / c)) / c);
double tmp;
if (c <= -4e+123) {
tmp = t_1;
} else if (c <= -1.8e-105) {
tmp = t_0;
} else if (c <= 3.3e-102) {
tmp = (1.0 / (pow(d, 2.0) / (b * c))) - (a / d);
} else if (c <= 1.7e+142) {
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) - (a * d)) / ((c * c) + (d * d))
t_1 = (b / c) - ((a * (d / c)) / c)
if (c <= (-4d+123)) then
tmp = t_1
else if (c <= (-1.8d-105)) then
tmp = t_0
else if (c <= 3.3d-102) then
tmp = (1.0d0 / ((d ** 2.0d0) / (b * c))) - (a / d)
else if (c <= 1.7d+142) 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) - (a * d)) / ((c * c) + (d * d));
double t_1 = (b / c) - ((a * (d / c)) / c);
double tmp;
if (c <= -4e+123) {
tmp = t_1;
} else if (c <= -1.8e-105) {
tmp = t_0;
} else if (c <= 3.3e-102) {
tmp = (1.0 / (Math.pow(d, 2.0) / (b * c))) - (a / d);
} else if (c <= 1.7e+142) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d)) t_1 = (b / c) - ((a * (d / c)) / c) tmp = 0 if c <= -4e+123: tmp = t_1 elif c <= -1.8e-105: tmp = t_0 elif c <= 3.3e-102: tmp = (1.0 / (math.pow(d, 2.0) / (b * c))) - (a / d) elif c <= 1.7e+142: tmp = t_0 else: tmp = t_1 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))) t_1 = Float64(Float64(b / c) - Float64(Float64(a * Float64(d / c)) / c)) tmp = 0.0 if (c <= -4e+123) tmp = t_1; elseif (c <= -1.8e-105) tmp = t_0; elseif (c <= 3.3e-102) tmp = Float64(Float64(1.0 / Float64((d ^ 2.0) / Float64(b * c))) - Float64(a / d)); elseif (c <= 1.7e+142) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d)); t_1 = (b / c) - ((a * (d / c)) / c); tmp = 0.0; if (c <= -4e+123) tmp = t_1; elseif (c <= -1.8e-105) tmp = t_0; elseif (c <= 3.3e-102) tmp = (1.0 / ((d ^ 2.0) / (b * c))) - (a / d); elseif (c <= 1.7e+142) 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 * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b / c), $MachinePrecision] - N[(N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -4e+123], t$95$1, If[LessEqual[c, -1.8e-105], t$95$0, If[LessEqual[c, 3.3e-102], N[(N[(1.0 / N[(N[Power[d, 2.0], $MachinePrecision] / N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.7e+142], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\
t_1 := \frac{b}{c} - \frac{a \cdot \frac{d}{c}}{c}\\
\mathbf{if}\;c \leq -4 \cdot 10^{+123}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -1.8 \cdot 10^{-105}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 3.3 \cdot 10^{-102}:\\
\;\;\;\;\frac{1}{\frac{{d}^{2}}{b \cdot c}} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 1.7 \cdot 10^{+142}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if c < -3.99999999999999991e123 or 1.6999999999999999e142 < c Initial program 33.2%
Taylor expanded in c around inf 86.9%
+-commutative86.9%
mul-1-neg86.9%
unsub-neg86.9%
*-commutative86.9%
associate-/l*87.2%
Simplified87.2%
*-un-lft-identity87.2%
add-sqr-sqrt47.3%
times-frac47.3%
sqrt-div47.3%
unpow247.3%
sqrt-prod28.8%
add-sqr-sqrt47.3%
sqrt-div47.3%
unpow247.3%
sqrt-prod31.2%
add-sqr-sqrt54.5%
Applied egg-rr54.5%
associate-*l/54.5%
*-lft-identity54.5%
associate-/r/54.6%
Simplified54.6%
sub-neg54.6%
associate-/r/52.2%
Applied egg-rr52.2%
sub-neg52.2%
associate-*l/54.6%
associate-*l*54.6%
rem-square-sqrt94.6%
Simplified94.6%
if -3.99999999999999991e123 < c < -1.79999999999999982e-105 or 3.3e-102 < c < 1.6999999999999999e142Initial program 85.2%
if -1.79999999999999982e-105 < c < 3.3e-102Initial program 71.8%
Taylor expanded in c around 0 84.7%
+-commutative84.7%
mul-1-neg84.7%
unsub-neg84.7%
associate-/l*88.4%
associate-/r/80.5%
Simplified80.5%
pow280.5%
associate-*l/84.7%
clear-num84.7%
pow284.7%
*-commutative84.7%
Applied egg-rr84.7%
Final simplification87.9%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
(t_1 (- (/ b c) (/ (* a (/ d c)) c))))
(if (<= c -8e+122)
t_1
(if (<= c -3.8e-147)
t_0
(if (<= c 5.2e-103)
(- (* (* b c) (pow d -2.0)) (/ a d))
(if (<= c 1.7e+142) t_0 t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d));
double t_1 = (b / c) - ((a * (d / c)) / c);
double tmp;
if (c <= -8e+122) {
tmp = t_1;
} else if (c <= -3.8e-147) {
tmp = t_0;
} else if (c <= 5.2e-103) {
tmp = ((b * c) * pow(d, -2.0)) - (a / d);
} else if (c <= 1.7e+142) {
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) - (a * d)) / ((c * c) + (d * d))
t_1 = (b / c) - ((a * (d / c)) / c)
if (c <= (-8d+122)) then
tmp = t_1
else if (c <= (-3.8d-147)) then
tmp = t_0
else if (c <= 5.2d-103) then
tmp = ((b * c) * (d ** (-2.0d0))) - (a / d)
else if (c <= 1.7d+142) 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) - (a * d)) / ((c * c) + (d * d));
double t_1 = (b / c) - ((a * (d / c)) / c);
double tmp;
if (c <= -8e+122) {
tmp = t_1;
} else if (c <= -3.8e-147) {
tmp = t_0;
} else if (c <= 5.2e-103) {
tmp = ((b * c) * Math.pow(d, -2.0)) - (a / d);
} else if (c <= 1.7e+142) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d)) t_1 = (b / c) - ((a * (d / c)) / c) tmp = 0 if c <= -8e+122: tmp = t_1 elif c <= -3.8e-147: tmp = t_0 elif c <= 5.2e-103: tmp = ((b * c) * math.pow(d, -2.0)) - (a / d) elif c <= 1.7e+142: tmp = t_0 else: tmp = t_1 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))) t_1 = Float64(Float64(b / c) - Float64(Float64(a * Float64(d / c)) / c)) tmp = 0.0 if (c <= -8e+122) tmp = t_1; elseif (c <= -3.8e-147) tmp = t_0; elseif (c <= 5.2e-103) tmp = Float64(Float64(Float64(b * c) * (d ^ -2.0)) - Float64(a / d)); elseif (c <= 1.7e+142) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d)); t_1 = (b / c) - ((a * (d / c)) / c); tmp = 0.0; if (c <= -8e+122) tmp = t_1; elseif (c <= -3.8e-147) tmp = t_0; elseif (c <= 5.2e-103) tmp = ((b * c) * (d ^ -2.0)) - (a / d); elseif (c <= 1.7e+142) 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 * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b / c), $MachinePrecision] - N[(N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -8e+122], t$95$1, If[LessEqual[c, -3.8e-147], t$95$0, If[LessEqual[c, 5.2e-103], N[(N[(N[(b * c), $MachinePrecision] * N[Power[d, -2.0], $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.7e+142], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\
t_1 := \frac{b}{c} - \frac{a \cdot \frac{d}{c}}{c}\\
\mathbf{if}\;c \leq -8 \cdot 10^{+122}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -3.8 \cdot 10^{-147}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 5.2 \cdot 10^{-103}:\\
\;\;\;\;\left(b \cdot c\right) \cdot {d}^{-2} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 1.7 \cdot 10^{+142}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if c < -8.00000000000000012e122 or 1.6999999999999999e142 < c Initial program 33.2%
Taylor expanded in c around inf 86.9%
+-commutative86.9%
mul-1-neg86.9%
unsub-neg86.9%
*-commutative86.9%
associate-/l*87.2%
Simplified87.2%
*-un-lft-identity87.2%
add-sqr-sqrt47.3%
times-frac47.3%
sqrt-div47.3%
unpow247.3%
sqrt-prod28.8%
add-sqr-sqrt47.3%
sqrt-div47.3%
unpow247.3%
sqrt-prod31.2%
add-sqr-sqrt54.5%
Applied egg-rr54.5%
associate-*l/54.5%
*-lft-identity54.5%
associate-/r/54.6%
Simplified54.6%
sub-neg54.6%
associate-/r/52.2%
Applied egg-rr52.2%
sub-neg52.2%
associate-*l/54.6%
associate-*l*54.6%
rem-square-sqrt94.6%
Simplified94.6%
if -8.00000000000000012e122 < c < -3.80000000000000028e-147 or 5.19999999999999993e-103 < c < 1.6999999999999999e142Initial program 85.5%
if -3.80000000000000028e-147 < c < 5.19999999999999993e-103Initial program 69.8%
Taylor expanded in c around 0 84.2%
+-commutative84.2%
mul-1-neg84.2%
unsub-neg84.2%
associate-/l*88.4%
associate-/r/80.8%
Simplified80.8%
add-cbrt-cube57.7%
pow1/332.2%
pow332.2%
*-commutative32.2%
pow232.2%
fma-neg32.2%
div-inv32.2%
pow232.2%
pow-flip32.2%
metadata-eval32.2%
Applied egg-rr32.2%
unpow1/357.7%
rem-cbrt-cube80.8%
fma-udef80.8%
unsub-neg80.8%
Applied egg-rr80.8%
associate-*r*84.2%
Simplified84.2%
Final simplification87.9%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
(t_1 (- (/ b c) (/ (* a (/ d c)) c))))
(if (<= c -3.4e+120)
t_1
(if (<= c -7.5e-147)
t_0
(if (<= c 7.2e-86)
(- (* c (* (/ 1.0 d) (/ b d))) (/ a d))
(if (<= c 2.35e+142) t_0 t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d));
double t_1 = (b / c) - ((a * (d / c)) / c);
double tmp;
if (c <= -3.4e+120) {
tmp = t_1;
} else if (c <= -7.5e-147) {
tmp = t_0;
} else if (c <= 7.2e-86) {
tmp = (c * ((1.0 / d) * (b / d))) - (a / d);
} else if (c <= 2.35e+142) {
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) - (a * d)) / ((c * c) + (d * d))
t_1 = (b / c) - ((a * (d / c)) / c)
if (c <= (-3.4d+120)) then
tmp = t_1
else if (c <= (-7.5d-147)) then
tmp = t_0
else if (c <= 7.2d-86) then
tmp = (c * ((1.0d0 / d) * (b / d))) - (a / d)
else if (c <= 2.35d+142) 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) - (a * d)) / ((c * c) + (d * d));
double t_1 = (b / c) - ((a * (d / c)) / c);
double tmp;
if (c <= -3.4e+120) {
tmp = t_1;
} else if (c <= -7.5e-147) {
tmp = t_0;
} else if (c <= 7.2e-86) {
tmp = (c * ((1.0 / d) * (b / d))) - (a / d);
} else if (c <= 2.35e+142) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d)) t_1 = (b / c) - ((a * (d / c)) / c) tmp = 0 if c <= -3.4e+120: tmp = t_1 elif c <= -7.5e-147: tmp = t_0 elif c <= 7.2e-86: tmp = (c * ((1.0 / d) * (b / d))) - (a / d) elif c <= 2.35e+142: tmp = t_0 else: tmp = t_1 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))) t_1 = Float64(Float64(b / c) - Float64(Float64(a * Float64(d / c)) / c)) tmp = 0.0 if (c <= -3.4e+120) tmp = t_1; elseif (c <= -7.5e-147) tmp = t_0; elseif (c <= 7.2e-86) tmp = Float64(Float64(c * Float64(Float64(1.0 / d) * Float64(b / d))) - Float64(a / d)); elseif (c <= 2.35e+142) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d)); t_1 = (b / c) - ((a * (d / c)) / c); tmp = 0.0; if (c <= -3.4e+120) tmp = t_1; elseif (c <= -7.5e-147) tmp = t_0; elseif (c <= 7.2e-86) tmp = (c * ((1.0 / d) * (b / d))) - (a / d); elseif (c <= 2.35e+142) 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 * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b / c), $MachinePrecision] - N[(N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -3.4e+120], t$95$1, If[LessEqual[c, -7.5e-147], t$95$0, If[LessEqual[c, 7.2e-86], N[(N[(c * N[(N[(1.0 / d), $MachinePrecision] * N[(b / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.35e+142], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\
t_1 := \frac{b}{c} - \frac{a \cdot \frac{d}{c}}{c}\\
\mathbf{if}\;c \leq -3.4 \cdot 10^{+120}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -7.5 \cdot 10^{-147}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 7.2 \cdot 10^{-86}:\\
\;\;\;\;c \cdot \left(\frac{1}{d} \cdot \frac{b}{d}\right) - \frac{a}{d}\\
\mathbf{elif}\;c \leq 2.35 \cdot 10^{+142}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if c < -3.39999999999999999e120 or 2.35e142 < c Initial program 33.2%
Taylor expanded in c around inf 86.9%
+-commutative86.9%
mul-1-neg86.9%
unsub-neg86.9%
*-commutative86.9%
associate-/l*87.2%
Simplified87.2%
*-un-lft-identity87.2%
add-sqr-sqrt47.3%
times-frac47.3%
sqrt-div47.3%
unpow247.3%
sqrt-prod28.8%
add-sqr-sqrt47.3%
sqrt-div47.3%
unpow247.3%
sqrt-prod31.2%
add-sqr-sqrt54.5%
Applied egg-rr54.5%
associate-*l/54.5%
*-lft-identity54.5%
associate-/r/54.6%
Simplified54.6%
sub-neg54.6%
associate-/r/52.2%
Applied egg-rr52.2%
sub-neg52.2%
associate-*l/54.6%
associate-*l*54.6%
rem-square-sqrt94.6%
Simplified94.6%
if -3.39999999999999999e120 < c < -7.50000000000000047e-147 or 7.19999999999999932e-86 < c < 2.35e142Initial program 86.1%
if -7.50000000000000047e-147 < c < 7.19999999999999932e-86Initial program 69.7%
Taylor expanded in c around 0 82.3%
+-commutative82.3%
mul-1-neg82.3%
unsub-neg82.3%
associate-/l*86.3%
associate-/r/79.0%
Simplified79.0%
*-un-lft-identity79.0%
pow279.0%
times-frac82.8%
Applied egg-rr82.8%
Final simplification87.7%
(FPCore (a b c d)
:precision binary64
(if (or (<= c -1.6e-9)
(not
(or (<= c 3.8e-63)
(and (not (<= c 240000000000.0)) (<= c 7.2e+47)))))
(- (/ b c) (/ (* a (/ d c)) c))
(- (* c (* (/ 1.0 d) (/ b d))) (/ a d))))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -1.6e-9) || !((c <= 3.8e-63) || (!(c <= 240000000000.0) && (c <= 7.2e+47)))) {
tmp = (b / c) - ((a * (d / c)) / c);
} else {
tmp = (c * ((1.0 / d) * (b / d))) - (a / d);
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((c <= (-1.6d-9)) .or. (.not. (c <= 3.8d-63) .or. (.not. (c <= 240000000000.0d0)) .and. (c <= 7.2d+47))) then
tmp = (b / c) - ((a * (d / c)) / c)
else
tmp = (c * ((1.0d0 / d) * (b / d))) - (a / d)
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -1.6e-9) || !((c <= 3.8e-63) || (!(c <= 240000000000.0) && (c <= 7.2e+47)))) {
tmp = (b / c) - ((a * (d / c)) / c);
} else {
tmp = (c * ((1.0 / d) * (b / d))) - (a / d);
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -1.6e-9) or not ((c <= 3.8e-63) or (not (c <= 240000000000.0) and (c <= 7.2e+47))): tmp = (b / c) - ((a * (d / c)) / c) else: tmp = (c * ((1.0 / d) * (b / d))) - (a / d) return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -1.6e-9) || !((c <= 3.8e-63) || (!(c <= 240000000000.0) && (c <= 7.2e+47)))) tmp = Float64(Float64(b / c) - Float64(Float64(a * Float64(d / c)) / c)); else tmp = Float64(Float64(c * Float64(Float64(1.0 / d) * Float64(b / d))) - Float64(a / d)); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((c <= -1.6e-9) || ~(((c <= 3.8e-63) || (~((c <= 240000000000.0)) && (c <= 7.2e+47))))) tmp = (b / c) - ((a * (d / c)) / c); else tmp = (c * ((1.0 / d) * (b / d))) - (a / d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -1.6e-9], N[Not[Or[LessEqual[c, 3.8e-63], And[N[Not[LessEqual[c, 240000000000.0]], $MachinePrecision], LessEqual[c, 7.2e+47]]]], $MachinePrecision]], N[(N[(b / c), $MachinePrecision] - N[(N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], N[(N[(c * N[(N[(1.0 / d), $MachinePrecision] * N[(b / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.6 \cdot 10^{-9} \lor \neg \left(c \leq 3.8 \cdot 10^{-63} \lor \neg \left(c \leq 240000000000\right) \land c \leq 7.2 \cdot 10^{+47}\right):\\
\;\;\;\;\frac{b}{c} - \frac{a \cdot \frac{d}{c}}{c}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(\frac{1}{d} \cdot \frac{b}{d}\right) - \frac{a}{d}\\
\end{array}
\end{array}
if c < -1.60000000000000006e-9 or 3.80000000000000017e-63 < c < 2.4e11 or 7.20000000000000015e47 < c Initial program 59.0%
Taylor expanded in c around inf 83.9%
+-commutative83.9%
mul-1-neg83.9%
unsub-neg83.9%
*-commutative83.9%
associate-/l*83.3%
Simplified83.3%
*-un-lft-identity83.3%
add-sqr-sqrt44.6%
times-frac44.6%
sqrt-div44.7%
unpow244.7%
sqrt-prod26.3%
add-sqr-sqrt43.2%
sqrt-div44.0%
unpow244.0%
sqrt-prod28.4%
add-sqr-sqrt49.5%
Applied egg-rr49.5%
associate-*l/49.5%
*-lft-identity49.5%
associate-/r/49.0%
Simplified49.0%
sub-neg49.0%
associate-/r/47.7%
Applied egg-rr47.7%
sub-neg47.7%
associate-*l/49.0%
associate-*l*49.0%
rem-square-sqrt85.8%
Simplified85.8%
if -1.60000000000000006e-9 < c < 3.80000000000000017e-63 or 2.4e11 < c < 7.20000000000000015e47Initial program 72.4%
Taylor expanded in c around 0 76.7%
+-commutative76.7%
mul-1-neg76.7%
unsub-neg76.7%
associate-/l*79.4%
associate-/r/73.8%
Simplified73.8%
*-un-lft-identity73.8%
pow273.8%
times-frac78.8%
Applied egg-rr78.8%
Final simplification82.6%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* c (* (/ 1.0 d) (/ b d))) (/ a d)))
(t_1 (* a (/ d c)))
(t_2 (- (/ b c) (/ t_1 c))))
(if (<= c -1.6e-10)
t_2
(if (<= c 3.8e-63)
t_0
(if (<= c 265000000000.0)
(+ (/ b c) (/ -1.0 (/ c t_1)))
(if (<= c 7.2e+47) t_0 t_2))))))
double code(double a, double b, double c, double d) {
double t_0 = (c * ((1.0 / d) * (b / d))) - (a / d);
double t_1 = a * (d / c);
double t_2 = (b / c) - (t_1 / c);
double tmp;
if (c <= -1.6e-10) {
tmp = t_2;
} else if (c <= 3.8e-63) {
tmp = t_0;
} else if (c <= 265000000000.0) {
tmp = (b / c) + (-1.0 / (c / t_1));
} else if (c <= 7.2e+47) {
tmp = t_0;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_0 = (c * ((1.0d0 / d) * (b / d))) - (a / d)
t_1 = a * (d / c)
t_2 = (b / c) - (t_1 / c)
if (c <= (-1.6d-10)) then
tmp = t_2
else if (c <= 3.8d-63) then
tmp = t_0
else if (c <= 265000000000.0d0) then
tmp = (b / c) + ((-1.0d0) / (c / t_1))
else if (c <= 7.2d+47) then
tmp = t_0
else
tmp = t_2
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double t_0 = (c * ((1.0 / d) * (b / d))) - (a / d);
double t_1 = a * (d / c);
double t_2 = (b / c) - (t_1 / c);
double tmp;
if (c <= -1.6e-10) {
tmp = t_2;
} else if (c <= 3.8e-63) {
tmp = t_0;
} else if (c <= 265000000000.0) {
tmp = (b / c) + (-1.0 / (c / t_1));
} else if (c <= 7.2e+47) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
def code(a, b, c, d): t_0 = (c * ((1.0 / d) * (b / d))) - (a / d) t_1 = a * (d / c) t_2 = (b / c) - (t_1 / c) tmp = 0 if c <= -1.6e-10: tmp = t_2 elif c <= 3.8e-63: tmp = t_0 elif c <= 265000000000.0: tmp = (b / c) + (-1.0 / (c / t_1)) elif c <= 7.2e+47: tmp = t_0 else: tmp = t_2 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(c * Float64(Float64(1.0 / d) * Float64(b / d))) - Float64(a / d)) t_1 = Float64(a * Float64(d / c)) t_2 = Float64(Float64(b / c) - Float64(t_1 / c)) tmp = 0.0 if (c <= -1.6e-10) tmp = t_2; elseif (c <= 3.8e-63) tmp = t_0; elseif (c <= 265000000000.0) tmp = Float64(Float64(b / c) + Float64(-1.0 / Float64(c / t_1))); elseif (c <= 7.2e+47) tmp = t_0; else tmp = t_2; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (c * ((1.0 / d) * (b / d))) - (a / d); t_1 = a * (d / c); t_2 = (b / c) - (t_1 / c); tmp = 0.0; if (c <= -1.6e-10) tmp = t_2; elseif (c <= 3.8e-63) tmp = t_0; elseif (c <= 265000000000.0) tmp = (b / c) + (-1.0 / (c / t_1)); elseif (c <= 7.2e+47) tmp = t_0; else tmp = t_2; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(c * N[(N[(1.0 / d), $MachinePrecision] * N[(b / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b / c), $MachinePrecision] - N[(t$95$1 / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1.6e-10], t$95$2, If[LessEqual[c, 3.8e-63], t$95$0, If[LessEqual[c, 265000000000.0], N[(N[(b / c), $MachinePrecision] + N[(-1.0 / N[(c / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 7.2e+47], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot \left(\frac{1}{d} \cdot \frac{b}{d}\right) - \frac{a}{d}\\
t_1 := a \cdot \frac{d}{c}\\
t_2 := \frac{b}{c} - \frac{t_1}{c}\\
\mathbf{if}\;c \leq -1.6 \cdot 10^{-10}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq 3.8 \cdot 10^{-63}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 265000000000:\\
\;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{t_1}}\\
\mathbf{elif}\;c \leq 7.2 \cdot 10^{+47}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if c < -1.5999999999999999e-10 or 7.20000000000000015e47 < c Initial program 53.8%
Taylor expanded in c around inf 86.0%
+-commutative86.0%
mul-1-neg86.0%
unsub-neg86.0%
*-commutative86.0%
associate-/l*86.2%
Simplified86.2%
*-un-lft-identity86.2%
add-sqr-sqrt46.2%
times-frac46.2%
sqrt-div46.2%
unpow246.2%
sqrt-prod25.1%
add-sqr-sqrt44.6%
sqrt-div44.6%
unpow244.6%
sqrt-prod26.6%
add-sqr-sqrt50.9%
Applied egg-rr50.9%
associate-*l/50.9%
*-lft-identity50.9%
associate-/r/50.3%
Simplified50.3%
sub-neg50.3%
associate-/r/48.8%
Applied egg-rr48.8%
sub-neg48.8%
associate-*l/50.3%
associate-*l*50.3%
rem-square-sqrt88.2%
Simplified88.2%
if -1.5999999999999999e-10 < c < 3.80000000000000017e-63 or 2.65e11 < c < 7.20000000000000015e47Initial program 72.4%
Taylor expanded in c around 0 76.7%
+-commutative76.7%
mul-1-neg76.7%
unsub-neg76.7%
associate-/l*79.4%
associate-/r/73.8%
Simplified73.8%
*-un-lft-identity73.8%
pow273.8%
times-frac78.8%
Applied egg-rr78.8%
if 3.80000000000000017e-63 < c < 2.65e11Initial program 94.1%
Taylor expanded in c around inf 69.9%
+-commutative69.9%
mul-1-neg69.9%
unsub-neg69.9%
*-commutative69.9%
associate-/l*64.0%
Simplified64.0%
*-un-lft-identity64.0%
add-sqr-sqrt34.2%
times-frac34.2%
sqrt-div34.4%
unpow234.4%
sqrt-prod34.4%
add-sqr-sqrt34.4%
sqrt-div40.1%
unpow240.1%
sqrt-prod40.2%
add-sqr-sqrt40.1%
Applied egg-rr40.1%
associate-*l/40.1%
*-lft-identity40.1%
associate-/r/40.1%
Simplified40.1%
clear-num40.3%
inv-pow40.3%
Applied egg-rr40.3%
unpow-140.3%
associate-/l/40.4%
associate-*l*40.3%
rem-square-sqrt70.1%
Simplified70.1%
Final simplification82.6%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* c (* (/ 1.0 d) (/ b d))) (/ a d))) (t_1 (* a (/ d c))))
(if (<= c -4e-9)
(- (/ b c) (/ t_1 c))
(if (<= c 3.8e-63)
t_0
(if (<= c 240000000000.0)
(+ (/ b c) (/ -1.0 (/ c t_1)))
(if (<= c 7.2e+47) t_0 (- (/ b c) (/ d (* c (/ c a))))))))))
double code(double a, double b, double c, double d) {
double t_0 = (c * ((1.0 / d) * (b / d))) - (a / d);
double t_1 = a * (d / c);
double tmp;
if (c <= -4e-9) {
tmp = (b / c) - (t_1 / c);
} else if (c <= 3.8e-63) {
tmp = t_0;
} else if (c <= 240000000000.0) {
tmp = (b / c) + (-1.0 / (c / t_1));
} else if (c <= 7.2e+47) {
tmp = t_0;
} else {
tmp = (b / c) - (d / (c * (c / a)));
}
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 * ((1.0d0 / d) * (b / d))) - (a / d)
t_1 = a * (d / c)
if (c <= (-4d-9)) then
tmp = (b / c) - (t_1 / c)
else if (c <= 3.8d-63) then
tmp = t_0
else if (c <= 240000000000.0d0) then
tmp = (b / c) + ((-1.0d0) / (c / t_1))
else if (c <= 7.2d+47) then
tmp = t_0
else
tmp = (b / c) - (d / (c * (c / a)))
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double t_0 = (c * ((1.0 / d) * (b / d))) - (a / d);
double t_1 = a * (d / c);
double tmp;
if (c <= -4e-9) {
tmp = (b / c) - (t_1 / c);
} else if (c <= 3.8e-63) {
tmp = t_0;
} else if (c <= 240000000000.0) {
tmp = (b / c) + (-1.0 / (c / t_1));
} else if (c <= 7.2e+47) {
tmp = t_0;
} else {
tmp = (b / c) - (d / (c * (c / a)));
}
return tmp;
}
def code(a, b, c, d): t_0 = (c * ((1.0 / d) * (b / d))) - (a / d) t_1 = a * (d / c) tmp = 0 if c <= -4e-9: tmp = (b / c) - (t_1 / c) elif c <= 3.8e-63: tmp = t_0 elif c <= 240000000000.0: tmp = (b / c) + (-1.0 / (c / t_1)) elif c <= 7.2e+47: tmp = t_0 else: tmp = (b / c) - (d / (c * (c / a))) return tmp
function code(a, b, c, d) t_0 = Float64(Float64(c * Float64(Float64(1.0 / d) * Float64(b / d))) - Float64(a / d)) t_1 = Float64(a * Float64(d / c)) tmp = 0.0 if (c <= -4e-9) tmp = Float64(Float64(b / c) - Float64(t_1 / c)); elseif (c <= 3.8e-63) tmp = t_0; elseif (c <= 240000000000.0) tmp = Float64(Float64(b / c) + Float64(-1.0 / Float64(c / t_1))); elseif (c <= 7.2e+47) tmp = t_0; else tmp = Float64(Float64(b / c) - Float64(d / Float64(c * Float64(c / a)))); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (c * ((1.0 / d) * (b / d))) - (a / d); t_1 = a * (d / c); tmp = 0.0; if (c <= -4e-9) tmp = (b / c) - (t_1 / c); elseif (c <= 3.8e-63) tmp = t_0; elseif (c <= 240000000000.0) tmp = (b / c) + (-1.0 / (c / t_1)); elseif (c <= 7.2e+47) tmp = t_0; else tmp = (b / c) - (d / (c * (c / a))); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(c * N[(N[(1.0 / d), $MachinePrecision] * N[(b / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -4e-9], N[(N[(b / c), $MachinePrecision] - N[(t$95$1 / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 3.8e-63], t$95$0, If[LessEqual[c, 240000000000.0], N[(N[(b / c), $MachinePrecision] + N[(-1.0 / N[(c / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 7.2e+47], t$95$0, N[(N[(b / c), $MachinePrecision] - N[(d / N[(c * N[(c / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot \left(\frac{1}{d} \cdot \frac{b}{d}\right) - \frac{a}{d}\\
t_1 := a \cdot \frac{d}{c}\\
\mathbf{if}\;c \leq -4 \cdot 10^{-9}:\\
\;\;\;\;\frac{b}{c} - \frac{t_1}{c}\\
\mathbf{elif}\;c \leq 3.8 \cdot 10^{-63}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 240000000000:\\
\;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{t_1}}\\
\mathbf{elif}\;c \leq 7.2 \cdot 10^{+47}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{d}{c \cdot \frac{c}{a}}\\
\end{array}
\end{array}
if c < -4.00000000000000025e-9Initial program 54.6%
Taylor expanded in c around inf 80.4%
+-commutative80.4%
mul-1-neg80.4%
unsub-neg80.4%
*-commutative80.4%
associate-/l*80.8%
Simplified80.8%
*-un-lft-identity80.8%
add-sqr-sqrt42.9%
times-frac42.9%
sqrt-div42.9%
unpow242.9%
sqrt-prod0.0%
add-sqr-sqrt39.5%
sqrt-div39.5%
unpow239.5%
sqrt-prod0.0%
add-sqr-sqrt49.2%
Applied egg-rr49.2%
associate-*l/49.2%
*-lft-identity49.2%
associate-/r/49.2%
Simplified49.2%
sub-neg49.2%
associate-/r/46.2%
Applied egg-rr46.2%
sub-neg46.2%
associate-*l/49.2%
associate-*l*49.2%
rem-square-sqrt86.1%
Simplified86.1%
if -4.00000000000000025e-9 < c < 3.80000000000000017e-63 or 2.4e11 < c < 7.20000000000000015e47Initial program 72.4%
Taylor expanded in c around 0 76.7%
+-commutative76.7%
mul-1-neg76.7%
unsub-neg76.7%
associate-/l*79.4%
associate-/r/73.8%
Simplified73.8%
*-un-lft-identity73.8%
pow273.8%
times-frac78.8%
Applied egg-rr78.8%
if 3.80000000000000017e-63 < c < 2.4e11Initial program 94.1%
Taylor expanded in c around inf 69.9%
+-commutative69.9%
mul-1-neg69.9%
unsub-neg69.9%
*-commutative69.9%
associate-/l*64.0%
Simplified64.0%
*-un-lft-identity64.0%
add-sqr-sqrt34.2%
times-frac34.2%
sqrt-div34.4%
unpow234.4%
sqrt-prod34.4%
add-sqr-sqrt34.4%
sqrt-div40.1%
unpow240.1%
sqrt-prod40.2%
add-sqr-sqrt40.1%
Applied egg-rr40.1%
associate-*l/40.1%
*-lft-identity40.1%
associate-/r/40.1%
Simplified40.1%
clear-num40.3%
inv-pow40.3%
Applied egg-rr40.3%
unpow-140.3%
associate-/l/40.4%
associate-*l*40.3%
rem-square-sqrt70.1%
Simplified70.1%
if 7.20000000000000015e47 < c Initial program 53.0%
Taylor expanded in c around inf 91.3%
+-commutative91.3%
mul-1-neg91.3%
unsub-neg91.3%
*-commutative91.3%
associate-/l*91.5%
Simplified91.5%
unpow291.5%
*-un-lft-identity91.5%
times-frac93.0%
Applied egg-rr93.0%
Final simplification83.2%
(FPCore (a b c d) :precision binary64 (if (or (<= c -1.66e-105) (not (<= c 2.25e-63))) (- (/ b c) (/ (* a (/ d c)) c)) (- (/ a d))))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -1.66e-105) || !(c <= 2.25e-63)) {
tmp = (b / c) - ((a * (d / 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.66d-105)) .or. (.not. (c <= 2.25d-63))) then
tmp = (b / c) - ((a * (d / 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.66e-105) || !(c <= 2.25e-63)) {
tmp = (b / c) - ((a * (d / c)) / c);
} else {
tmp = -(a / d);
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -1.66e-105) or not (c <= 2.25e-63): tmp = (b / c) - ((a * (d / c)) / c) else: tmp = -(a / d) return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -1.66e-105) || !(c <= 2.25e-63)) tmp = Float64(Float64(b / c) - Float64(Float64(a * Float64(d / 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.66e-105) || ~((c <= 2.25e-63))) tmp = (b / c) - ((a * (d / c)) / c); else tmp = -(a / d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -1.66e-105], N[Not[LessEqual[c, 2.25e-63]], $MachinePrecision]], N[(N[(b / c), $MachinePrecision] - N[(N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], (-N[(a / d), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.66 \cdot 10^{-105} \lor \neg \left(c \leq 2.25 \cdot 10^{-63}\right):\\
\;\;\;\;\frac{b}{c} - \frac{a \cdot \frac{d}{c}}{c}\\
\mathbf{else}:\\
\;\;\;\;-\frac{a}{d}\\
\end{array}
\end{array}
if c < -1.66000000000000009e-105 or 2.25e-63 < c Initial program 61.4%
Taylor expanded in c around inf 76.8%
+-commutative76.8%
mul-1-neg76.8%
unsub-neg76.8%
*-commutative76.8%
associate-/l*74.7%
Simplified74.7%
*-un-lft-identity74.7%
add-sqr-sqrt40.7%
times-frac40.8%
sqrt-div40.8%
unpow240.8%
sqrt-prod23.6%
add-sqr-sqrt39.4%
sqrt-div40.1%
unpow240.1%
sqrt-prod25.3%
add-sqr-sqrt45.8%
Applied egg-rr45.8%
associate-*l/45.8%
*-lft-identity45.8%
associate-/r/45.4%
Simplified45.4%
sub-neg45.4%
associate-/r/44.4%
Applied egg-rr44.4%
sub-neg44.4%
associate-*l/45.5%
associate-*l*45.5%
rem-square-sqrt78.4%
Simplified78.4%
if -1.66000000000000009e-105 < c < 2.25e-63Initial program 72.3%
Taylor expanded in c around 0 76.3%
associate-*r/76.3%
neg-mul-176.3%
Simplified76.3%
Final simplification77.7%
(FPCore (a b c d) :precision binary64 (if (or (<= c -1.75e-105) (not (<= c 5.2e-24))) (/ b c) (- (/ a d))))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -1.75e-105) || !(c <= 5.2e-24)) {
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 <= (-1.75d-105)) .or. (.not. (c <= 5.2d-24))) 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 <= -1.75e-105) || !(c <= 5.2e-24)) {
tmp = b / c;
} else {
tmp = -(a / d);
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -1.75e-105) or not (c <= 5.2e-24): tmp = b / c else: tmp = -(a / d) return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -1.75e-105) || !(c <= 5.2e-24)) 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 <= -1.75e-105) || ~((c <= 5.2e-24))) tmp = b / c; else tmp = -(a / d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -1.75e-105], N[Not[LessEqual[c, 5.2e-24]], $MachinePrecision]], N[(b / c), $MachinePrecision], (-N[(a / d), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.75 \cdot 10^{-105} \lor \neg \left(c \leq 5.2 \cdot 10^{-24}\right):\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;-\frac{a}{d}\\
\end{array}
\end{array}
if c < -1.75e-105 or 5.2e-24 < c Initial program 60.2%
Taylor expanded in c around inf 64.5%
if -1.75e-105 < c < 5.2e-24Initial program 73.8%
Taylor expanded in c around 0 73.6%
associate-*r/73.6%
neg-mul-173.6%
Simplified73.6%
Final simplification67.8%
(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 65.2%
Taylor expanded in c around inf 44.3%
Final simplification44.3%
(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 2023334
(FPCore (a b c d)
:name "Complex division, imag part"
:precision binary64
:herbie-target
(if (< (fabs d) (fabs c)) (/ (- b (* a (/ d c))) (+ c (* d (/ d c)))) (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d)))))
(/ (- (* b c) (* a d)) (+ (* c c) (* d d))))