
(FPCore (a b c d) :precision binary64 (/ (+ (* a c) (* b d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
return ((a * c) + (b * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = ((a * c) + (b * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
return ((a * c) + (b * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d): return ((a * c) + (b * d)) / ((c * c) + (d * d))
function code(a, b, c, d) return Float64(Float64(Float64(a * c) + Float64(b * d)) / Float64(Float64(c * c) + Float64(d * d))) end
function tmp = code(a, b, c, d) tmp = ((a * c) + (b * d)) / ((c * c) + (d * d)); end
code[a_, b_, c_, d_] := N[(N[(N[(a * c), $MachinePrecision] + N[(b * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c d) :precision binary64 (/ (+ (* a c) (* b d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
return ((a * c) + (b * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = ((a * c) + (b * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
return ((a * c) + (b * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d): return ((a * c) + (b * d)) / ((c * c) + (d * d))
function code(a, b, c, d) return Float64(Float64(Float64(a * c) + Float64(b * d)) / Float64(Float64(c * c) + Float64(d * d))) end
function tmp = code(a, b, c, d) tmp = ((a * c) + (b * d)) / ((c * c) + (d * d)); end
code[a_, b_, c_, d_] := N[(N[(N[(a * c), $MachinePrecision] + N[(b * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}
\end{array}
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (+ (* a c) (* b d)) (+ (* c c) (* d d)))))
(if (<= c -1.9e+27)
(* (+ a (/ b (/ c d))) (/ -1.0 (hypot c d)))
(if (<= c -9.5e-79)
t_0
(if (<= c 9.2e-154)
(+ (/ b d) (/ (/ (* a c) d) d))
(if (<= c 1.85e-56)
t_0
(if (<= c 2150000000.0)
(+ (/ b d) (* (/ c d) (/ a d)))
(/ (+ a (* b (/ d c))) (hypot c d)))))))))
double code(double a, double b, double c, double d) {
double t_0 = ((a * c) + (b * d)) / ((c * c) + (d * d));
double tmp;
if (c <= -1.9e+27) {
tmp = (a + (b / (c / d))) * (-1.0 / hypot(c, d));
} else if (c <= -9.5e-79) {
tmp = t_0;
} else if (c <= 9.2e-154) {
tmp = (b / d) + (((a * c) / d) / d);
} else if (c <= 1.85e-56) {
tmp = t_0;
} else if (c <= 2150000000.0) {
tmp = (b / d) + ((c / d) * (a / d));
} else {
tmp = (a + (b * (d / c))) / hypot(c, d);
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = ((a * c) + (b * d)) / ((c * c) + (d * d));
double tmp;
if (c <= -1.9e+27) {
tmp = (a + (b / (c / d))) * (-1.0 / Math.hypot(c, d));
} else if (c <= -9.5e-79) {
tmp = t_0;
} else if (c <= 9.2e-154) {
tmp = (b / d) + (((a * c) / d) / d);
} else if (c <= 1.85e-56) {
tmp = t_0;
} else if (c <= 2150000000.0) {
tmp = (b / d) + ((c / d) * (a / d));
} else {
tmp = (a + (b * (d / c))) / Math.hypot(c, d);
}
return tmp;
}
def code(a, b, c, d): t_0 = ((a * c) + (b * d)) / ((c * c) + (d * d)) tmp = 0 if c <= -1.9e+27: tmp = (a + (b / (c / d))) * (-1.0 / math.hypot(c, d)) elif c <= -9.5e-79: tmp = t_0 elif c <= 9.2e-154: tmp = (b / d) + (((a * c) / d) / d) elif c <= 1.85e-56: tmp = t_0 elif c <= 2150000000.0: tmp = (b / d) + ((c / d) * (a / d)) else: tmp = (a + (b * (d / c))) / math.hypot(c, d) return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(a * c) + Float64(b * d)) / Float64(Float64(c * c) + Float64(d * d))) tmp = 0.0 if (c <= -1.9e+27) tmp = Float64(Float64(a + Float64(b / Float64(c / d))) * Float64(-1.0 / hypot(c, d))); elseif (c <= -9.5e-79) tmp = t_0; elseif (c <= 9.2e-154) tmp = Float64(Float64(b / d) + Float64(Float64(Float64(a * c) / d) / d)); elseif (c <= 1.85e-56) tmp = t_0; elseif (c <= 2150000000.0) tmp = Float64(Float64(b / d) + Float64(Float64(c / d) * Float64(a / d))); else tmp = Float64(Float64(a + Float64(b * Float64(d / c))) / hypot(c, d)); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((a * c) + (b * d)) / ((c * c) + (d * d)); tmp = 0.0; if (c <= -1.9e+27) tmp = (a + (b / (c / d))) * (-1.0 / hypot(c, d)); elseif (c <= -9.5e-79) tmp = t_0; elseif (c <= 9.2e-154) tmp = (b / d) + (((a * c) / d) / d); elseif (c <= 1.85e-56) tmp = t_0; elseif (c <= 2150000000.0) tmp = (b / d) + ((c / d) * (a / d)); else tmp = (a + (b * (d / c))) / hypot(c, d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(a * c), $MachinePrecision] + N[(b * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1.9e+27], N[(N[(a + N[(b / N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -9.5e-79], t$95$0, If[LessEqual[c, 9.2e-154], N[(N[(b / d), $MachinePrecision] + N[(N[(N[(a * c), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.85e-56], t$95$0, If[LessEqual[c, 2150000000.0], N[(N[(b / d), $MachinePrecision] + N[(N[(c / d), $MachinePrecision] * N[(a / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a + N[(b * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -1.9 \cdot 10^{+27}:\\
\;\;\;\;\left(a + \frac{b}{\frac{c}{d}}\right) \cdot \frac{-1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{elif}\;c \leq -9.5 \cdot 10^{-79}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 9.2 \cdot 10^{-154}:\\
\;\;\;\;\frac{b}{d} + \frac{\frac{a \cdot c}{d}}{d}\\
\mathbf{elif}\;c \leq 1.85 \cdot 10^{-56}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 2150000000:\\
\;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a + b \cdot \frac{d}{c}}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if c < -1.90000000000000011e27Initial program 39.5%
*-un-lft-identity39.5%
add-sqr-sqrt39.5%
times-frac39.6%
hypot-def39.6%
fma-def39.6%
hypot-def59.7%
Applied egg-rr59.7%
Taylor expanded in c around -inf 74.8%
neg-mul-174.8%
+-commutative74.8%
unsub-neg74.8%
mul-1-neg74.8%
associate-/l*80.4%
distribute-neg-frac80.4%
Simplified80.4%
if -1.90000000000000011e27 < c < -9.4999999999999997e-79 or 9.1999999999999999e-154 < c < 1.8500000000000001e-56Initial program 89.8%
if -9.4999999999999997e-79 < c < 9.1999999999999999e-154Initial program 73.8%
Taylor expanded in c around 0 86.4%
associate-/l*86.0%
associate-/r/80.9%
Simplified80.9%
pow280.9%
associate-*l/86.4%
associate-/r*93.2%
Applied egg-rr93.2%
if 1.8500000000000001e-56 < c < 2.15e9Initial program 50.2%
Taylor expanded in c around 0 76.5%
associate-/l*64.2%
associate-/r/76.5%
Simplified76.5%
pow276.5%
associate-*l/76.5%
associate-/r*76.3%
Applied egg-rr76.3%
associate-/l/76.5%
*-commutative76.5%
times-frac76.7%
Applied egg-rr76.7%
if 2.15e9 < c Initial program 42.3%
*-un-lft-identity42.3%
add-sqr-sqrt42.3%
times-frac42.4%
hypot-def42.4%
fma-def42.4%
hypot-def63.2%
Applied egg-rr63.2%
associate-*l/63.3%
*-un-lft-identity63.3%
Applied egg-rr63.3%
Taylor expanded in c around inf 82.1%
*-lft-identity82.1%
times-frac84.0%
/-rgt-identity84.0%
Simplified84.0%
Final simplification86.8%
(FPCore (a b c d) :precision binary64 (if (<= (/ (+ (* a c) (* b d)) (+ (* c c) (* d d))) 5e+290) (/ (/ (fma a c (* b d)) (hypot c d)) (hypot c d)) (+ (/ b d) (* (/ c d) (/ a d)))))
double code(double a, double b, double c, double d) {
double tmp;
if ((((a * c) + (b * d)) / ((c * c) + (d * d))) <= 5e+290) {
tmp = (fma(a, c, (b * d)) / hypot(c, d)) / hypot(c, d);
} else {
tmp = (b / d) + ((c / d) * (a / d));
}
return tmp;
}
function code(a, b, c, d) tmp = 0.0 if (Float64(Float64(Float64(a * c) + Float64(b * d)) / Float64(Float64(c * c) + Float64(d * d))) <= 5e+290) tmp = Float64(Float64(fma(a, c, Float64(b * d)) / hypot(c, d)) / hypot(c, d)); else tmp = Float64(Float64(b / d) + Float64(Float64(c / d) * Float64(a / d))); end return tmp end
code[a_, b_, c_, d_] := If[LessEqual[N[(N[(N[(a * c), $MachinePrecision] + N[(b * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+290], N[(N[(N[(a * c + N[(b * d), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[(b / d), $MachinePrecision] + N[(N[(c / d), $MachinePrecision] * N[(a / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d} \leq 5 \cdot 10^{+290}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(a, c, b \cdot d\right)}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 a c) (*.f64 b d)) (+.f64 (*.f64 c c) (*.f64 d d))) < 4.9999999999999998e290Initial program 78.9%
*-un-lft-identity78.9%
add-sqr-sqrt78.9%
times-frac78.9%
hypot-def78.9%
fma-def78.9%
hypot-def95.1%
Applied egg-rr95.1%
associate-*l/95.3%
*-un-lft-identity95.3%
Applied egg-rr95.3%
if 4.9999999999999998e290 < (/.f64 (+.f64 (*.f64 a c) (*.f64 b d)) (+.f64 (*.f64 c c) (*.f64 d d))) Initial program 6.3%
Taylor expanded in c around 0 48.3%
associate-/l*50.2%
associate-/r/50.2%
Simplified50.2%
pow250.2%
associate-*l/48.3%
associate-/r*51.5%
Applied egg-rr51.5%
associate-/l/48.3%
*-commutative48.3%
times-frac55.9%
Applied egg-rr55.9%
Final simplification84.9%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (+ (* a c) (* b d)) (+ (* c c) (* d d)))))
(if (<= c -3.7e+78)
(+ (/ a c) (* d (* (/ 1.0 c) (/ b c))))
(if (<= c -2.65e-79)
t_0
(if (<= c 1.6e-153)
(+ (/ b d) (/ (/ (* a c) d) d))
(if (<= c 1.72e-56)
t_0
(if (<= c 880000000.0)
(+ (/ b d) (* (/ c d) (/ a d)))
(/ (+ a (* b (/ d c))) (hypot c d)))))))))
double code(double a, double b, double c, double d) {
double t_0 = ((a * c) + (b * d)) / ((c * c) + (d * d));
double tmp;
if (c <= -3.7e+78) {
tmp = (a / c) + (d * ((1.0 / c) * (b / c)));
} else if (c <= -2.65e-79) {
tmp = t_0;
} else if (c <= 1.6e-153) {
tmp = (b / d) + (((a * c) / d) / d);
} else if (c <= 1.72e-56) {
tmp = t_0;
} else if (c <= 880000000.0) {
tmp = (b / d) + ((c / d) * (a / d));
} else {
tmp = (a + (b * (d / c))) / hypot(c, d);
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = ((a * c) + (b * d)) / ((c * c) + (d * d));
double tmp;
if (c <= -3.7e+78) {
tmp = (a / c) + (d * ((1.0 / c) * (b / c)));
} else if (c <= -2.65e-79) {
tmp = t_0;
} else if (c <= 1.6e-153) {
tmp = (b / d) + (((a * c) / d) / d);
} else if (c <= 1.72e-56) {
tmp = t_0;
} else if (c <= 880000000.0) {
tmp = (b / d) + ((c / d) * (a / d));
} else {
tmp = (a + (b * (d / c))) / Math.hypot(c, d);
}
return tmp;
}
def code(a, b, c, d): t_0 = ((a * c) + (b * d)) / ((c * c) + (d * d)) tmp = 0 if c <= -3.7e+78: tmp = (a / c) + (d * ((1.0 / c) * (b / c))) elif c <= -2.65e-79: tmp = t_0 elif c <= 1.6e-153: tmp = (b / d) + (((a * c) / d) / d) elif c <= 1.72e-56: tmp = t_0 elif c <= 880000000.0: tmp = (b / d) + ((c / d) * (a / d)) else: tmp = (a + (b * (d / c))) / math.hypot(c, d) return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(a * c) + Float64(b * d)) / Float64(Float64(c * c) + Float64(d * d))) tmp = 0.0 if (c <= -3.7e+78) tmp = Float64(Float64(a / c) + Float64(d * Float64(Float64(1.0 / c) * Float64(b / c)))); elseif (c <= -2.65e-79) tmp = t_0; elseif (c <= 1.6e-153) tmp = Float64(Float64(b / d) + Float64(Float64(Float64(a * c) / d) / d)); elseif (c <= 1.72e-56) tmp = t_0; elseif (c <= 880000000.0) tmp = Float64(Float64(b / d) + Float64(Float64(c / d) * Float64(a / d))); else tmp = Float64(Float64(a + Float64(b * Float64(d / c))) / hypot(c, d)); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((a * c) + (b * d)) / ((c * c) + (d * d)); tmp = 0.0; if (c <= -3.7e+78) tmp = (a / c) + (d * ((1.0 / c) * (b / c))); elseif (c <= -2.65e-79) tmp = t_0; elseif (c <= 1.6e-153) tmp = (b / d) + (((a * c) / d) / d); elseif (c <= 1.72e-56) tmp = t_0; elseif (c <= 880000000.0) tmp = (b / d) + ((c / d) * (a / d)); else tmp = (a + (b * (d / c))) / hypot(c, d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(a * c), $MachinePrecision] + N[(b * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -3.7e+78], N[(N[(a / c), $MachinePrecision] + N[(d * N[(N[(1.0 / c), $MachinePrecision] * N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -2.65e-79], t$95$0, If[LessEqual[c, 1.6e-153], N[(N[(b / d), $MachinePrecision] + N[(N[(N[(a * c), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.72e-56], t$95$0, If[LessEqual[c, 880000000.0], N[(N[(b / d), $MachinePrecision] + N[(N[(c / d), $MachinePrecision] * N[(a / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a + N[(b * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -3.7 \cdot 10^{+78}:\\
\;\;\;\;\frac{a}{c} + d \cdot \left(\frac{1}{c} \cdot \frac{b}{c}\right)\\
\mathbf{elif}\;c \leq -2.65 \cdot 10^{-79}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 1.6 \cdot 10^{-153}:\\
\;\;\;\;\frac{b}{d} + \frac{\frac{a \cdot c}{d}}{d}\\
\mathbf{elif}\;c \leq 1.72 \cdot 10^{-56}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 880000000:\\
\;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a + b \cdot \frac{d}{c}}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if c < -3.69999999999999985e78Initial program 34.2%
Taylor expanded in c around inf 71.7%
associate-/l*75.4%
associate-/r/78.7%
Simplified78.7%
*-un-lft-identity78.7%
pow278.7%
times-frac82.1%
Applied egg-rr82.1%
if -3.69999999999999985e78 < c < -2.6499999999999999e-79 or 1.6e-153 < c < 1.72000000000000009e-56Initial program 83.0%
if -2.6499999999999999e-79 < c < 1.6e-153Initial program 73.8%
Taylor expanded in c around 0 86.4%
associate-/l*86.0%
associate-/r/80.9%
Simplified80.9%
pow280.9%
associate-*l/86.4%
associate-/r*93.2%
Applied egg-rr93.2%
if 1.72000000000000009e-56 < c < 8.8e8Initial program 50.2%
Taylor expanded in c around 0 76.5%
associate-/l*64.2%
associate-/r/76.5%
Simplified76.5%
pow276.5%
associate-*l/76.5%
associate-/r*76.3%
Applied egg-rr76.3%
associate-/l/76.5%
*-commutative76.5%
times-frac76.7%
Applied egg-rr76.7%
if 8.8e8 < c Initial program 42.3%
*-un-lft-identity42.3%
add-sqr-sqrt42.3%
times-frac42.4%
hypot-def42.4%
fma-def42.4%
hypot-def63.2%
Applied egg-rr63.2%
associate-*l/63.3%
*-un-lft-identity63.3%
Applied egg-rr63.3%
Taylor expanded in c around inf 82.1%
*-lft-identity82.1%
times-frac84.0%
/-rgt-identity84.0%
Simplified84.0%
Final simplification86.3%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (+ (/ b d) (* (/ c d) (/ a d))))
(t_1 (+ (/ a c) (* b (/ (/ d c) c))))
(t_2 (+ (/ a c) (/ (/ (* b d) c) c))))
(if (<= c -3.2e+115)
t_1
(if (<= c -2.7e+47)
t_0
(if (<= c -6.5e-6)
t_2
(if (<= c -2.75e-36)
t_0
(if (<= c -3.5e-78) t_1 (if (<= c 480000000000.0) t_0 t_2))))))))
double code(double a, double b, double c, double d) {
double t_0 = (b / d) + ((c / d) * (a / d));
double t_1 = (a / c) + (b * ((d / c) / c));
double t_2 = (a / c) + (((b * d) / c) / c);
double tmp;
if (c <= -3.2e+115) {
tmp = t_1;
} else if (c <= -2.7e+47) {
tmp = t_0;
} else if (c <= -6.5e-6) {
tmp = t_2;
} else if (c <= -2.75e-36) {
tmp = t_0;
} else if (c <= -3.5e-78) {
tmp = t_1;
} else if (c <= 480000000000.0) {
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 = (b / d) + ((c / d) * (a / d))
t_1 = (a / c) + (b * ((d / c) / c))
t_2 = (a / c) + (((b * d) / c) / c)
if (c <= (-3.2d+115)) then
tmp = t_1
else if (c <= (-2.7d+47)) then
tmp = t_0
else if (c <= (-6.5d-6)) then
tmp = t_2
else if (c <= (-2.75d-36)) then
tmp = t_0
else if (c <= (-3.5d-78)) then
tmp = t_1
else if (c <= 480000000000.0d0) 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 = (b / d) + ((c / d) * (a / d));
double t_1 = (a / c) + (b * ((d / c) / c));
double t_2 = (a / c) + (((b * d) / c) / c);
double tmp;
if (c <= -3.2e+115) {
tmp = t_1;
} else if (c <= -2.7e+47) {
tmp = t_0;
} else if (c <= -6.5e-6) {
tmp = t_2;
} else if (c <= -2.75e-36) {
tmp = t_0;
} else if (c <= -3.5e-78) {
tmp = t_1;
} else if (c <= 480000000000.0) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
def code(a, b, c, d): t_0 = (b / d) + ((c / d) * (a / d)) t_1 = (a / c) + (b * ((d / c) / c)) t_2 = (a / c) + (((b * d) / c) / c) tmp = 0 if c <= -3.2e+115: tmp = t_1 elif c <= -2.7e+47: tmp = t_0 elif c <= -6.5e-6: tmp = t_2 elif c <= -2.75e-36: tmp = t_0 elif c <= -3.5e-78: tmp = t_1 elif c <= 480000000000.0: tmp = t_0 else: tmp = t_2 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(b / d) + Float64(Float64(c / d) * Float64(a / d))) t_1 = Float64(Float64(a / c) + Float64(b * Float64(Float64(d / c) / c))) t_2 = Float64(Float64(a / c) + Float64(Float64(Float64(b * d) / c) / c)) tmp = 0.0 if (c <= -3.2e+115) tmp = t_1; elseif (c <= -2.7e+47) tmp = t_0; elseif (c <= -6.5e-6) tmp = t_2; elseif (c <= -2.75e-36) tmp = t_0; elseif (c <= -3.5e-78) tmp = t_1; elseif (c <= 480000000000.0) tmp = t_0; else tmp = t_2; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (b / d) + ((c / d) * (a / d)); t_1 = (a / c) + (b * ((d / c) / c)); t_2 = (a / c) + (((b * d) / c) / c); tmp = 0.0; if (c <= -3.2e+115) tmp = t_1; elseif (c <= -2.7e+47) tmp = t_0; elseif (c <= -6.5e-6) tmp = t_2; elseif (c <= -2.75e-36) tmp = t_0; elseif (c <= -3.5e-78) tmp = t_1; elseif (c <= 480000000000.0) tmp = t_0; else tmp = t_2; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b / d), $MachinePrecision] + N[(N[(c / d), $MachinePrecision] * N[(a / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(a / c), $MachinePrecision] + N[(b * N[(N[(d / c), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a / c), $MachinePrecision] + N[(N[(N[(b * d), $MachinePrecision] / c), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -3.2e+115], t$95$1, If[LessEqual[c, -2.7e+47], t$95$0, If[LessEqual[c, -6.5e-6], t$95$2, If[LessEqual[c, -2.75e-36], t$95$0, If[LessEqual[c, -3.5e-78], t$95$1, If[LessEqual[c, 480000000000.0], t$95$0, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\
t_1 := \frac{a}{c} + b \cdot \frac{\frac{d}{c}}{c}\\
t_2 := \frac{a}{c} + \frac{\frac{b \cdot d}{c}}{c}\\
\mathbf{if}\;c \leq -3.2 \cdot 10^{+115}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -2.7 \cdot 10^{+47}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -6.5 \cdot 10^{-6}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq -2.75 \cdot 10^{-36}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -3.5 \cdot 10^{-78}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 480000000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if c < -3.2e115 or -2.74999999999999992e-36 < c < -3.4999999999999999e-78Initial program 45.8%
Taylor expanded in c around inf 77.7%
associate-/l*81.1%
associate-/r/79.6%
Simplified79.6%
expm1-log1p-u77.9%
expm1-udef78.0%
pow278.0%
div-inv78.0%
associate-*l*79.3%
pow279.3%
pow-flip79.3%
metadata-eval79.3%
Applied egg-rr79.3%
expm1-def79.3%
expm1-log1p81.1%
*-commutative81.1%
Simplified81.1%
metadata-eval81.1%
pow-flip81.1%
pow281.1%
div-inv81.1%
associate-/r*82.7%
Applied egg-rr82.7%
if -3.2e115 < c < -2.69999999999999996e47 or -6.4999999999999996e-6 < c < -2.74999999999999992e-36 or -3.4999999999999999e-78 < c < 4.8e11Initial program 70.9%
Taylor expanded in c around 0 82.2%
associate-/l*81.2%
associate-/r/77.8%
Simplified77.8%
pow277.8%
associate-*l/82.2%
associate-/r*86.9%
Applied egg-rr86.9%
associate-/l/82.2%
*-commutative82.2%
times-frac86.1%
Applied egg-rr86.1%
if -2.69999999999999996e47 < c < -6.4999999999999996e-6 or 4.8e11 < c Initial program 50.7%
Taylor expanded in c around inf 78.2%
associate-/l*78.3%
associate-/r/78.3%
Simplified78.3%
pow278.3%
associate-*l/78.2%
associate-/r*81.1%
Applied egg-rr81.1%
Final simplification84.0%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (+ (/ b d) (/ (* c (/ a d)) d)))
(t_1 (+ (/ a c) (* b (/ (/ d c) c))))
(t_2 (+ (/ a c) (/ (/ (* b d) c) c))))
(if (<= c -3.2e+115)
t_1
(if (<= c -2.5e+47)
t_0
(if (<= c -1.25e-7)
t_2
(if (<= c -2.4e-36)
(+ (/ b d) (* (/ c d) (/ a d)))
(if (<= c -3.5e-78) t_1 (if (<= c 7000000000.0) t_0 t_2))))))))
double code(double a, double b, double c, double d) {
double t_0 = (b / d) + ((c * (a / d)) / d);
double t_1 = (a / c) + (b * ((d / c) / c));
double t_2 = (a / c) + (((b * d) / c) / c);
double tmp;
if (c <= -3.2e+115) {
tmp = t_1;
} else if (c <= -2.5e+47) {
tmp = t_0;
} else if (c <= -1.25e-7) {
tmp = t_2;
} else if (c <= -2.4e-36) {
tmp = (b / d) + ((c / d) * (a / d));
} else if (c <= -3.5e-78) {
tmp = t_1;
} else if (c <= 7000000000.0) {
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 = (b / d) + ((c * (a / d)) / d)
t_1 = (a / c) + (b * ((d / c) / c))
t_2 = (a / c) + (((b * d) / c) / c)
if (c <= (-3.2d+115)) then
tmp = t_1
else if (c <= (-2.5d+47)) then
tmp = t_0
else if (c <= (-1.25d-7)) then
tmp = t_2
else if (c <= (-2.4d-36)) then
tmp = (b / d) + ((c / d) * (a / d))
else if (c <= (-3.5d-78)) then
tmp = t_1
else if (c <= 7000000000.0d0) 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 = (b / d) + ((c * (a / d)) / d);
double t_1 = (a / c) + (b * ((d / c) / c));
double t_2 = (a / c) + (((b * d) / c) / c);
double tmp;
if (c <= -3.2e+115) {
tmp = t_1;
} else if (c <= -2.5e+47) {
tmp = t_0;
} else if (c <= -1.25e-7) {
tmp = t_2;
} else if (c <= -2.4e-36) {
tmp = (b / d) + ((c / d) * (a / d));
} else if (c <= -3.5e-78) {
tmp = t_1;
} else if (c <= 7000000000.0) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
def code(a, b, c, d): t_0 = (b / d) + ((c * (a / d)) / d) t_1 = (a / c) + (b * ((d / c) / c)) t_2 = (a / c) + (((b * d) / c) / c) tmp = 0 if c <= -3.2e+115: tmp = t_1 elif c <= -2.5e+47: tmp = t_0 elif c <= -1.25e-7: tmp = t_2 elif c <= -2.4e-36: tmp = (b / d) + ((c / d) * (a / d)) elif c <= -3.5e-78: tmp = t_1 elif c <= 7000000000.0: tmp = t_0 else: tmp = t_2 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(b / d) + Float64(Float64(c * Float64(a / d)) / d)) t_1 = Float64(Float64(a / c) + Float64(b * Float64(Float64(d / c) / c))) t_2 = Float64(Float64(a / c) + Float64(Float64(Float64(b * d) / c) / c)) tmp = 0.0 if (c <= -3.2e+115) tmp = t_1; elseif (c <= -2.5e+47) tmp = t_0; elseif (c <= -1.25e-7) tmp = t_2; elseif (c <= -2.4e-36) tmp = Float64(Float64(b / d) + Float64(Float64(c / d) * Float64(a / d))); elseif (c <= -3.5e-78) tmp = t_1; elseif (c <= 7000000000.0) tmp = t_0; else tmp = t_2; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (b / d) + ((c * (a / d)) / d); t_1 = (a / c) + (b * ((d / c) / c)); t_2 = (a / c) + (((b * d) / c) / c); tmp = 0.0; if (c <= -3.2e+115) tmp = t_1; elseif (c <= -2.5e+47) tmp = t_0; elseif (c <= -1.25e-7) tmp = t_2; elseif (c <= -2.4e-36) tmp = (b / d) + ((c / d) * (a / d)); elseif (c <= -3.5e-78) tmp = t_1; elseif (c <= 7000000000.0) tmp = t_0; else tmp = t_2; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b / d), $MachinePrecision] + N[(N[(c * N[(a / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(a / c), $MachinePrecision] + N[(b * N[(N[(d / c), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a / c), $MachinePrecision] + N[(N[(N[(b * d), $MachinePrecision] / c), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -3.2e+115], t$95$1, If[LessEqual[c, -2.5e+47], t$95$0, If[LessEqual[c, -1.25e-7], t$95$2, If[LessEqual[c, -2.4e-36], N[(N[(b / d), $MachinePrecision] + N[(N[(c / d), $MachinePrecision] * N[(a / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -3.5e-78], t$95$1, If[LessEqual[c, 7000000000.0], t$95$0, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{d} + \frac{c \cdot \frac{a}{d}}{d}\\
t_1 := \frac{a}{c} + b \cdot \frac{\frac{d}{c}}{c}\\
t_2 := \frac{a}{c} + \frac{\frac{b \cdot d}{c}}{c}\\
\mathbf{if}\;c \leq -3.2 \cdot 10^{+115}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -2.5 \cdot 10^{+47}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -1.25 \cdot 10^{-7}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq -2.4 \cdot 10^{-36}:\\
\;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\
\mathbf{elif}\;c \leq -3.5 \cdot 10^{-78}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 7000000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if c < -3.2e115 or -2.4e-36 < c < -3.4999999999999999e-78Initial program 45.8%
Taylor expanded in c around inf 77.7%
associate-/l*81.1%
associate-/r/79.6%
Simplified79.6%
expm1-log1p-u77.9%
expm1-udef78.0%
pow278.0%
div-inv78.0%
associate-*l*79.3%
pow279.3%
pow-flip79.3%
metadata-eval79.3%
Applied egg-rr79.3%
expm1-def79.3%
expm1-log1p81.1%
*-commutative81.1%
Simplified81.1%
metadata-eval81.1%
pow-flip81.1%
pow281.1%
div-inv81.1%
associate-/r*82.7%
Applied egg-rr82.7%
if -3.2e115 < c < -2.50000000000000011e47 or -3.4999999999999999e-78 < c < 7e9Initial program 72.1%
Taylor expanded in c around 0 81.4%
associate-/l*80.4%
associate-/r/76.9%
Simplified76.9%
pow276.9%
associate-*l/81.4%
associate-/r*86.3%
Applied egg-rr86.3%
associate-/l*87.1%
associate-/r/85.6%
Applied egg-rr85.6%
if -2.50000000000000011e47 < c < -1.24999999999999994e-7 or 7e9 < c Initial program 50.7%
Taylor expanded in c around inf 78.2%
associate-/l*78.3%
associate-/r/78.3%
Simplified78.3%
pow278.3%
associate-*l/78.2%
associate-/r*81.1%
Applied egg-rr81.1%
if -1.24999999999999994e-7 < c < -2.4e-36Initial program 41.2%
Taylor expanded in c around 0 100.0%
associate-/l*100.0%
associate-/r/100.0%
Simplified100.0%
pow2100.0%
associate-*l/100.0%
associate-/r*99.7%
Applied egg-rr99.7%
associate-/l/100.0%
*-commutative100.0%
times-frac100.0%
Applied egg-rr100.0%
Final simplification84.0%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (+ (/ a c) (* b (/ (/ d c) c))))
(t_1 (+ (/ a c) (/ (/ (* b d) c) c))))
(if (<= c -3.2e+115)
t_0
(if (<= c -3e+47)
(+ (/ b d) (/ (* c (/ a d)) d))
(if (<= c -8.4e-7)
t_1
(if (<= c -9.2e-36)
(+ (/ b d) (* (/ c d) (/ a d)))
(if (<= c -3e-78)
t_0
(if (<= c 14500000000.0)
(+ (/ b d) (/ (/ (* a c) d) d))
t_1))))))))
double code(double a, double b, double c, double d) {
double t_0 = (a / c) + (b * ((d / c) / c));
double t_1 = (a / c) + (((b * d) / c) / c);
double tmp;
if (c <= -3.2e+115) {
tmp = t_0;
} else if (c <= -3e+47) {
tmp = (b / d) + ((c * (a / d)) / d);
} else if (c <= -8.4e-7) {
tmp = t_1;
} else if (c <= -9.2e-36) {
tmp = (b / d) + ((c / d) * (a / d));
} else if (c <= -3e-78) {
tmp = t_0;
} else if (c <= 14500000000.0) {
tmp = (b / d) + (((a * c) / d) / d);
} 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 = (a / c) + (b * ((d / c) / c))
t_1 = (a / c) + (((b * d) / c) / c)
if (c <= (-3.2d+115)) then
tmp = t_0
else if (c <= (-3d+47)) then
tmp = (b / d) + ((c * (a / d)) / d)
else if (c <= (-8.4d-7)) then
tmp = t_1
else if (c <= (-9.2d-36)) then
tmp = (b / d) + ((c / d) * (a / d))
else if (c <= (-3d-78)) then
tmp = t_0
else if (c <= 14500000000.0d0) then
tmp = (b / d) + (((a * c) / d) / d)
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 = (a / c) + (b * ((d / c) / c));
double t_1 = (a / c) + (((b * d) / c) / c);
double tmp;
if (c <= -3.2e+115) {
tmp = t_0;
} else if (c <= -3e+47) {
tmp = (b / d) + ((c * (a / d)) / d);
} else if (c <= -8.4e-7) {
tmp = t_1;
} else if (c <= -9.2e-36) {
tmp = (b / d) + ((c / d) * (a / d));
} else if (c <= -3e-78) {
tmp = t_0;
} else if (c <= 14500000000.0) {
tmp = (b / d) + (((a * c) / d) / d);
} else {
tmp = t_1;
}
return tmp;
}
def code(a, b, c, d): t_0 = (a / c) + (b * ((d / c) / c)) t_1 = (a / c) + (((b * d) / c) / c) tmp = 0 if c <= -3.2e+115: tmp = t_0 elif c <= -3e+47: tmp = (b / d) + ((c * (a / d)) / d) elif c <= -8.4e-7: tmp = t_1 elif c <= -9.2e-36: tmp = (b / d) + ((c / d) * (a / d)) elif c <= -3e-78: tmp = t_0 elif c <= 14500000000.0: tmp = (b / d) + (((a * c) / d) / d) else: tmp = t_1 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(a / c) + Float64(b * Float64(Float64(d / c) / c))) t_1 = Float64(Float64(a / c) + Float64(Float64(Float64(b * d) / c) / c)) tmp = 0.0 if (c <= -3.2e+115) tmp = t_0; elseif (c <= -3e+47) tmp = Float64(Float64(b / d) + Float64(Float64(c * Float64(a / d)) / d)); elseif (c <= -8.4e-7) tmp = t_1; elseif (c <= -9.2e-36) tmp = Float64(Float64(b / d) + Float64(Float64(c / d) * Float64(a / d))); elseif (c <= -3e-78) tmp = t_0; elseif (c <= 14500000000.0) tmp = Float64(Float64(b / d) + Float64(Float64(Float64(a * c) / d) / d)); else tmp = t_1; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (a / c) + (b * ((d / c) / c)); t_1 = (a / c) + (((b * d) / c) / c); tmp = 0.0; if (c <= -3.2e+115) tmp = t_0; elseif (c <= -3e+47) tmp = (b / d) + ((c * (a / d)) / d); elseif (c <= -8.4e-7) tmp = t_1; elseif (c <= -9.2e-36) tmp = (b / d) + ((c / d) * (a / d)); elseif (c <= -3e-78) tmp = t_0; elseif (c <= 14500000000.0) tmp = (b / d) + (((a * c) / d) / d); else tmp = t_1; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(a / c), $MachinePrecision] + N[(b * N[(N[(d / c), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(a / c), $MachinePrecision] + N[(N[(N[(b * d), $MachinePrecision] / c), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -3.2e+115], t$95$0, If[LessEqual[c, -3e+47], N[(N[(b / d), $MachinePrecision] + N[(N[(c * N[(a / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -8.4e-7], t$95$1, If[LessEqual[c, -9.2e-36], N[(N[(b / d), $MachinePrecision] + N[(N[(c / d), $MachinePrecision] * N[(a / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -3e-78], t$95$0, If[LessEqual[c, 14500000000.0], N[(N[(b / d), $MachinePrecision] + N[(N[(N[(a * c), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{c} + b \cdot \frac{\frac{d}{c}}{c}\\
t_1 := \frac{a}{c} + \frac{\frac{b \cdot d}{c}}{c}\\
\mathbf{if}\;c \leq -3.2 \cdot 10^{+115}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -3 \cdot 10^{+47}:\\
\;\;\;\;\frac{b}{d} + \frac{c \cdot \frac{a}{d}}{d}\\
\mathbf{elif}\;c \leq -8.4 \cdot 10^{-7}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -9.2 \cdot 10^{-36}:\\
\;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\
\mathbf{elif}\;c \leq -3 \cdot 10^{-78}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 14500000000:\\
\;\;\;\;\frac{b}{d} + \frac{\frac{a \cdot c}{d}}{d}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if c < -3.2e115 or -9.19999999999999986e-36 < c < -2.99999999999999988e-78Initial program 45.8%
Taylor expanded in c around inf 77.7%
associate-/l*81.1%
associate-/r/79.6%
Simplified79.6%
expm1-log1p-u77.9%
expm1-udef78.0%
pow278.0%
div-inv78.0%
associate-*l*79.3%
pow279.3%
pow-flip79.3%
metadata-eval79.3%
Applied egg-rr79.3%
expm1-def79.3%
expm1-log1p81.1%
*-commutative81.1%
Simplified81.1%
metadata-eval81.1%
pow-flip81.1%
pow281.1%
div-inv81.1%
associate-/r*82.7%
Applied egg-rr82.7%
if -3.2e115 < c < -3.0000000000000001e47Initial program 43.0%
Taylor expanded in c around 0 67.8%
associate-/l*67.8%
associate-/r/68.0%
Simplified68.0%
pow268.0%
associate-*l/67.8%
associate-/r*68.1%
Applied egg-rr68.1%
associate-/l*76.1%
associate-/r/76.1%
Applied egg-rr76.1%
if -3.0000000000000001e47 < c < -8.4e-7 or 1.45e10 < c Initial program 50.7%
Taylor expanded in c around inf 78.2%
associate-/l*78.3%
associate-/r/78.3%
Simplified78.3%
pow278.3%
associate-*l/78.2%
associate-/r*81.1%
Applied egg-rr81.1%
if -8.4e-7 < c < -9.19999999999999986e-36Initial program 41.2%
Taylor expanded in c around 0 100.0%
associate-/l*100.0%
associate-/r/100.0%
Simplified100.0%
pow2100.0%
associate-*l/100.0%
associate-/r*99.7%
Applied egg-rr99.7%
associate-/l/100.0%
*-commutative100.0%
times-frac100.0%
Applied egg-rr100.0%
if -2.99999999999999988e-78 < c < 1.45e10Initial program 75.2%
Taylor expanded in c around 0 82.9%
associate-/l*81.7%
associate-/r/77.9%
Simplified77.9%
pow277.9%
associate-*l/82.9%
associate-/r*88.3%
Applied egg-rr88.3%
Final simplification84.8%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (+ (* a c) (* b d)) (+ (* c c) (* d d))))
(t_1 (+ (/ a c) (* d (* (/ 1.0 c) (/ b c))))))
(if (<= c -3.65e+78)
t_1
(if (<= c -2.6e-79)
t_0
(if (<= c 2.6e-154)
(+ (/ b d) (/ (/ (* a c) d) d))
(if (<= c 2.8e-56)
t_0
(if (<= c 950000000000.0) (+ (/ b d) (* (/ c d) (/ a d))) t_1)))))))
double code(double a, double b, double c, double d) {
double t_0 = ((a * c) + (b * d)) / ((c * c) + (d * d));
double t_1 = (a / c) + (d * ((1.0 / c) * (b / c)));
double tmp;
if (c <= -3.65e+78) {
tmp = t_1;
} else if (c <= -2.6e-79) {
tmp = t_0;
} else if (c <= 2.6e-154) {
tmp = (b / d) + (((a * c) / d) / d);
} else if (c <= 2.8e-56) {
tmp = t_0;
} else if (c <= 950000000000.0) {
tmp = (b / d) + ((c / d) * (a / d));
} 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 = ((a * c) + (b * d)) / ((c * c) + (d * d))
t_1 = (a / c) + (d * ((1.0d0 / c) * (b / c)))
if (c <= (-3.65d+78)) then
tmp = t_1
else if (c <= (-2.6d-79)) then
tmp = t_0
else if (c <= 2.6d-154) then
tmp = (b / d) + (((a * c) / d) / d)
else if (c <= 2.8d-56) then
tmp = t_0
else if (c <= 950000000000.0d0) then
tmp = (b / d) + ((c / d) * (a / d))
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 = ((a * c) + (b * d)) / ((c * c) + (d * d));
double t_1 = (a / c) + (d * ((1.0 / c) * (b / c)));
double tmp;
if (c <= -3.65e+78) {
tmp = t_1;
} else if (c <= -2.6e-79) {
tmp = t_0;
} else if (c <= 2.6e-154) {
tmp = (b / d) + (((a * c) / d) / d);
} else if (c <= 2.8e-56) {
tmp = t_0;
} else if (c <= 950000000000.0) {
tmp = (b / d) + ((c / d) * (a / d));
} else {
tmp = t_1;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((a * c) + (b * d)) / ((c * c) + (d * d)) t_1 = (a / c) + (d * ((1.0 / c) * (b / c))) tmp = 0 if c <= -3.65e+78: tmp = t_1 elif c <= -2.6e-79: tmp = t_0 elif c <= 2.6e-154: tmp = (b / d) + (((a * c) / d) / d) elif c <= 2.8e-56: tmp = t_0 elif c <= 950000000000.0: tmp = (b / d) + ((c / d) * (a / d)) else: tmp = t_1 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(a * c) + Float64(b * d)) / Float64(Float64(c * c) + Float64(d * d))) t_1 = Float64(Float64(a / c) + Float64(d * Float64(Float64(1.0 / c) * Float64(b / c)))) tmp = 0.0 if (c <= -3.65e+78) tmp = t_1; elseif (c <= -2.6e-79) tmp = t_0; elseif (c <= 2.6e-154) tmp = Float64(Float64(b / d) + Float64(Float64(Float64(a * c) / d) / d)); elseif (c <= 2.8e-56) tmp = t_0; elseif (c <= 950000000000.0) tmp = Float64(Float64(b / d) + Float64(Float64(c / d) * Float64(a / d))); else tmp = t_1; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((a * c) + (b * d)) / ((c * c) + (d * d)); t_1 = (a / c) + (d * ((1.0 / c) * (b / c))); tmp = 0.0; if (c <= -3.65e+78) tmp = t_1; elseif (c <= -2.6e-79) tmp = t_0; elseif (c <= 2.6e-154) tmp = (b / d) + (((a * c) / d) / d); elseif (c <= 2.8e-56) tmp = t_0; elseif (c <= 950000000000.0) tmp = (b / d) + ((c / d) * (a / d)); else tmp = t_1; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(a * c), $MachinePrecision] + N[(b * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(a / c), $MachinePrecision] + N[(d * N[(N[(1.0 / c), $MachinePrecision] * N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -3.65e+78], t$95$1, If[LessEqual[c, -2.6e-79], t$95$0, If[LessEqual[c, 2.6e-154], N[(N[(b / d), $MachinePrecision] + N[(N[(N[(a * c), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.8e-56], t$95$0, If[LessEqual[c, 950000000000.0], N[(N[(b / d), $MachinePrecision] + N[(N[(c / d), $MachinePrecision] * N[(a / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}\\
t_1 := \frac{a}{c} + d \cdot \left(\frac{1}{c} \cdot \frac{b}{c}\right)\\
\mathbf{if}\;c \leq -3.65 \cdot 10^{+78}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -2.6 \cdot 10^{-79}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 2.6 \cdot 10^{-154}:\\
\;\;\;\;\frac{b}{d} + \frac{\frac{a \cdot c}{d}}{d}\\
\mathbf{elif}\;c \leq 2.8 \cdot 10^{-56}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 950000000000:\\
\;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if c < -3.65e78 or 9.5e11 < c Initial program 38.1%
Taylor expanded in c around inf 74.9%
associate-/l*76.9%
associate-/r/78.6%
Simplified78.6%
*-un-lft-identity78.6%
pow278.6%
times-frac82.1%
Applied egg-rr82.1%
if -3.65e78 < c < -2.59999999999999994e-79 or 2.6e-154 < c < 2.79999999999999993e-56Initial program 83.0%
if -2.59999999999999994e-79 < c < 2.6e-154Initial program 73.8%
Taylor expanded in c around 0 86.4%
associate-/l*86.0%
associate-/r/80.9%
Simplified80.9%
pow280.9%
associate-*l/86.4%
associate-/r*93.2%
Applied egg-rr93.2%
if 2.79999999999999993e-56 < c < 9.5e11Initial program 50.2%
Taylor expanded in c around 0 76.5%
associate-/l*64.2%
associate-/r/76.5%
Simplified76.5%
pow276.5%
associate-*l/76.5%
associate-/r*76.3%
Applied egg-rr76.3%
associate-/l/76.5%
*-commutative76.5%
times-frac76.7%
Applied egg-rr76.7%
Final simplification85.9%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (+ (/ a c) (* d (* (/ 1.0 c) (/ b c))))))
(if (<= c -0.00033)
t_0
(if (<= c -2.7e-36)
(+ (/ b d) (* (/ c d) (/ a d)))
(if (<= c -3.5e-78)
(+ (/ a c) (* b (/ (/ d c) c)))
(if (<= c 8200000000.0) (+ (/ b d) (/ (/ (* a c) d) d)) t_0))))))
double code(double a, double b, double c, double d) {
double t_0 = (a / c) + (d * ((1.0 / c) * (b / c)));
double tmp;
if (c <= -0.00033) {
tmp = t_0;
} else if (c <= -2.7e-36) {
tmp = (b / d) + ((c / d) * (a / d));
} else if (c <= -3.5e-78) {
tmp = (a / c) + (b * ((d / c) / c));
} else if (c <= 8200000000.0) {
tmp = (b / d) + (((a * c) / d) / 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 = (a / c) + (d * ((1.0d0 / c) * (b / c)))
if (c <= (-0.00033d0)) then
tmp = t_0
else if (c <= (-2.7d-36)) then
tmp = (b / d) + ((c / d) * (a / d))
else if (c <= (-3.5d-78)) then
tmp = (a / c) + (b * ((d / c) / c))
else if (c <= 8200000000.0d0) then
tmp = (b / d) + (((a * c) / d) / 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 = (a / c) + (d * ((1.0 / c) * (b / c)));
double tmp;
if (c <= -0.00033) {
tmp = t_0;
} else if (c <= -2.7e-36) {
tmp = (b / d) + ((c / d) * (a / d));
} else if (c <= -3.5e-78) {
tmp = (a / c) + (b * ((d / c) / c));
} else if (c <= 8200000000.0) {
tmp = (b / d) + (((a * c) / d) / d);
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, c, d): t_0 = (a / c) + (d * ((1.0 / c) * (b / c))) tmp = 0 if c <= -0.00033: tmp = t_0 elif c <= -2.7e-36: tmp = (b / d) + ((c / d) * (a / d)) elif c <= -3.5e-78: tmp = (a / c) + (b * ((d / c) / c)) elif c <= 8200000000.0: tmp = (b / d) + (((a * c) / d) / d) else: tmp = t_0 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(a / c) + Float64(d * Float64(Float64(1.0 / c) * Float64(b / c)))) tmp = 0.0 if (c <= -0.00033) tmp = t_0; elseif (c <= -2.7e-36) tmp = Float64(Float64(b / d) + Float64(Float64(c / d) * Float64(a / d))); elseif (c <= -3.5e-78) tmp = Float64(Float64(a / c) + Float64(b * Float64(Float64(d / c) / c))); elseif (c <= 8200000000.0) tmp = Float64(Float64(b / d) + Float64(Float64(Float64(a * c) / d) / d)); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (a / c) + (d * ((1.0 / c) * (b / c))); tmp = 0.0; if (c <= -0.00033) tmp = t_0; elseif (c <= -2.7e-36) tmp = (b / d) + ((c / d) * (a / d)); elseif (c <= -3.5e-78) tmp = (a / c) + (b * ((d / c) / c)); elseif (c <= 8200000000.0) tmp = (b / d) + (((a * c) / d) / d); else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(a / c), $MachinePrecision] + N[(d * N[(N[(1.0 / c), $MachinePrecision] * N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -0.00033], t$95$0, If[LessEqual[c, -2.7e-36], N[(N[(b / d), $MachinePrecision] + N[(N[(c / d), $MachinePrecision] * N[(a / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -3.5e-78], N[(N[(a / c), $MachinePrecision] + N[(b * N[(N[(d / c), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 8200000000.0], N[(N[(b / d), $MachinePrecision] + N[(N[(N[(a * c), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{c} + d \cdot \left(\frac{1}{c} \cdot \frac{b}{c}\right)\\
\mathbf{if}\;c \leq -0.00033:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -2.7 \cdot 10^{-36}:\\
\;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\
\mathbf{elif}\;c \leq -3.5 \cdot 10^{-78}:\\
\;\;\;\;\frac{a}{c} + b \cdot \frac{\frac{d}{c}}{c}\\
\mathbf{elif}\;c \leq 8200000000:\\
\;\;\;\;\frac{b}{d} + \frac{\frac{a \cdot c}{d}}{d}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if c < -3.3e-4 or 8.2e9 < c Initial program 43.5%
Taylor expanded in c around inf 72.6%
associate-/l*74.3%
associate-/r/76.5%
Simplified76.5%
*-un-lft-identity76.5%
pow276.5%
times-frac79.5%
Applied egg-rr79.5%
if -3.3e-4 < c < -2.70000000000000007e-36Initial program 41.2%
Taylor expanded in c around 0 100.0%
associate-/l*100.0%
associate-/r/100.0%
Simplified100.0%
pow2100.0%
associate-*l/100.0%
associate-/r*99.7%
Applied egg-rr99.7%
associate-/l/100.0%
*-commutative100.0%
times-frac100.0%
Applied egg-rr100.0%
if -2.70000000000000007e-36 < c < -3.4999999999999999e-78Initial program 99.6%
Taylor expanded in c around inf 77.0%
associate-/l*77.0%
associate-/r/68.7%
Simplified68.7%
expm1-log1p-u68.3%
expm1-udef68.3%
pow268.3%
div-inv68.3%
associate-*l*75.9%
pow275.9%
pow-flip75.9%
metadata-eval75.9%
Applied egg-rr75.9%
expm1-def75.9%
expm1-log1p77.1%
*-commutative77.1%
Simplified77.1%
metadata-eval77.1%
pow-flip77.1%
pow277.1%
div-inv77.1%
associate-/r*77.1%
Applied egg-rr77.1%
if -3.4999999999999999e-78 < c < 8.2e9Initial program 75.2%
Taylor expanded in c around 0 82.9%
associate-/l*81.7%
associate-/r/77.9%
Simplified77.9%
pow277.9%
associate-*l/82.9%
associate-/r*88.3%
Applied egg-rr88.3%
Final simplification83.6%
(FPCore (a b c d)
:precision binary64
(if (or (<= c -2.35e+86)
(not (or (<= c -3.2e+47) (and (not (<= c -3e-78)) (<= c 3e-153)))))
(+ (/ a c) (* b (/ (/ d c) c)))
(/ b d)))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -2.35e+86) || !((c <= -3.2e+47) || (!(c <= -3e-78) && (c <= 3e-153)))) {
tmp = (a / c) + (b * ((d / c) / c));
} else {
tmp = b / d;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((c <= (-2.35d+86)) .or. (.not. (c <= (-3.2d+47)) .or. (.not. (c <= (-3d-78))) .and. (c <= 3d-153))) then
tmp = (a / c) + (b * ((d / c) / c))
else
tmp = b / d
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -2.35e+86) || !((c <= -3.2e+47) || (!(c <= -3e-78) && (c <= 3e-153)))) {
tmp = (a / c) + (b * ((d / c) / c));
} else {
tmp = b / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -2.35e+86) or not ((c <= -3.2e+47) or (not (c <= -3e-78) and (c <= 3e-153))): tmp = (a / c) + (b * ((d / c) / c)) else: tmp = b / d return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -2.35e+86) || !((c <= -3.2e+47) || (!(c <= -3e-78) && (c <= 3e-153)))) tmp = Float64(Float64(a / c) + Float64(b * Float64(Float64(d / c) / c))); else tmp = Float64(b / d); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((c <= -2.35e+86) || ~(((c <= -3.2e+47) || (~((c <= -3e-78)) && (c <= 3e-153))))) tmp = (a / c) + (b * ((d / c) / c)); else tmp = b / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -2.35e+86], N[Not[Or[LessEqual[c, -3.2e+47], And[N[Not[LessEqual[c, -3e-78]], $MachinePrecision], LessEqual[c, 3e-153]]]], $MachinePrecision]], N[(N[(a / c), $MachinePrecision] + N[(b * N[(N[(d / c), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b / d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.35 \cdot 10^{+86} \lor \neg \left(c \leq -3.2 \cdot 10^{+47} \lor \neg \left(c \leq -3 \cdot 10^{-78}\right) \land c \leq 3 \cdot 10^{-153}\right):\\
\;\;\;\;\frac{a}{c} + b \cdot \frac{\frac{d}{c}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{d}\\
\end{array}
\end{array}
if c < -2.3500000000000001e86 or -3.2e47 < c < -2.99999999999999988e-78 or 3e-153 < c Initial program 53.1%
Taylor expanded in c around inf 69.8%
associate-/l*70.6%
associate-/r/69.5%
Simplified69.5%
expm1-log1p-u66.4%
expm1-udef65.2%
pow265.2%
div-inv65.2%
associate-*l*66.3%
pow266.3%
pow-flip66.3%
metadata-eval66.3%
Applied egg-rr66.3%
expm1-def67.0%
expm1-log1p70.7%
*-commutative70.7%
Simplified70.7%
metadata-eval70.7%
pow-flip70.7%
pow270.7%
div-inv70.7%
associate-/r*71.3%
Applied egg-rr71.3%
if -2.3500000000000001e86 < c < -3.2e47 or -2.99999999999999988e-78 < c < 3e-153Initial program 70.5%
Taylor expanded in c around 0 84.8%
Final simplification76.4%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (+ (/ a c) (/ (/ (* b d) c) c))))
(if (<= c -2.35e+86)
t_0
(if (<= c -3.2e+47)
(/ b d)
(if (<= c -6e-79)
(+ (/ a c) (* b (/ (/ d c) c)))
(if (<= c 3e-153) (/ b d) t_0))))))
double code(double a, double b, double c, double d) {
double t_0 = (a / c) + (((b * d) / c) / c);
double tmp;
if (c <= -2.35e+86) {
tmp = t_0;
} else if (c <= -3.2e+47) {
tmp = b / d;
} else if (c <= -6e-79) {
tmp = (a / c) + (b * ((d / c) / c));
} else if (c <= 3e-153) {
tmp = b / 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 = (a / c) + (((b * d) / c) / c)
if (c <= (-2.35d+86)) then
tmp = t_0
else if (c <= (-3.2d+47)) then
tmp = b / d
else if (c <= (-6d-79)) then
tmp = (a / c) + (b * ((d / c) / c))
else if (c <= 3d-153) then
tmp = b / 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 = (a / c) + (((b * d) / c) / c);
double tmp;
if (c <= -2.35e+86) {
tmp = t_0;
} else if (c <= -3.2e+47) {
tmp = b / d;
} else if (c <= -6e-79) {
tmp = (a / c) + (b * ((d / c) / c));
} else if (c <= 3e-153) {
tmp = b / d;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, c, d): t_0 = (a / c) + (((b * d) / c) / c) tmp = 0 if c <= -2.35e+86: tmp = t_0 elif c <= -3.2e+47: tmp = b / d elif c <= -6e-79: tmp = (a / c) + (b * ((d / c) / c)) elif c <= 3e-153: tmp = b / d else: tmp = t_0 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(a / c) + Float64(Float64(Float64(b * d) / c) / c)) tmp = 0.0 if (c <= -2.35e+86) tmp = t_0; elseif (c <= -3.2e+47) tmp = Float64(b / d); elseif (c <= -6e-79) tmp = Float64(Float64(a / c) + Float64(b * Float64(Float64(d / c) / c))); elseif (c <= 3e-153) tmp = Float64(b / d); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (a / c) + (((b * d) / c) / c); tmp = 0.0; if (c <= -2.35e+86) tmp = t_0; elseif (c <= -3.2e+47) tmp = b / d; elseif (c <= -6e-79) tmp = (a / c) + (b * ((d / c) / c)); elseif (c <= 3e-153) tmp = b / d; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(a / c), $MachinePrecision] + N[(N[(N[(b * d), $MachinePrecision] / c), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.35e+86], t$95$0, If[LessEqual[c, -3.2e+47], N[(b / d), $MachinePrecision], If[LessEqual[c, -6e-79], N[(N[(a / c), $MachinePrecision] + N[(b * N[(N[(d / c), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 3e-153], N[(b / d), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{c} + \frac{\frac{b \cdot d}{c}}{c}\\
\mathbf{if}\;c \leq -2.35 \cdot 10^{+86}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq -3.2 \cdot 10^{+47}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{elif}\;c \leq -6 \cdot 10^{-79}:\\
\;\;\;\;\frac{a}{c} + b \cdot \frac{\frac{d}{c}}{c}\\
\mathbf{elif}\;c \leq 3 \cdot 10^{-153}:\\
\;\;\;\;\frac{b}{d}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if c < -2.3500000000000001e86 or 3e-153 < c Initial program 46.5%
Taylor expanded in c around inf 71.0%
associate-/l*71.9%
associate-/r/71.3%
Simplified71.3%
pow271.3%
associate-*l/71.0%
associate-/r*74.2%
Applied egg-rr74.2%
if -2.3500000000000001e86 < c < -3.2e47 or -5.99999999999999999e-79 < c < 3e-153Initial program 70.5%
Taylor expanded in c around 0 84.8%
if -3.2e47 < c < -5.99999999999999999e-79Initial program 83.0%
Taylor expanded in c around inf 64.6%
associate-/l*64.5%
associate-/r/61.5%
Simplified61.5%
expm1-log1p-u57.1%
expm1-udef53.9%
pow253.9%
div-inv53.9%
associate-*l*56.8%
pow256.8%
pow-flip56.8%
metadata-eval56.8%
Applied egg-rr56.8%
expm1-def60.0%
expm1-log1p64.6%
*-commutative64.6%
Simplified64.6%
metadata-eval64.6%
pow-flip64.6%
pow264.6%
div-inv64.6%
associate-/r*64.6%
Applied egg-rr64.6%
Final simplification77.1%
(FPCore (a b c d)
:precision binary64
(if (or (<= c -6e+99)
(and (not (<= c -5.8e-36)) (or (<= c -3.5e-78) (not (<= c 3.5e+53)))))
(/ a c)
(/ b d)))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -6e+99) || (!(c <= -5.8e-36) && ((c <= -3.5e-78) || !(c <= 3.5e+53)))) {
tmp = a / c;
} else {
tmp = b / d;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((c <= (-6d+99)) .or. (.not. (c <= (-5.8d-36))) .and. (c <= (-3.5d-78)) .or. (.not. (c <= 3.5d+53))) then
tmp = a / c
else
tmp = b / d
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -6e+99) || (!(c <= -5.8e-36) && ((c <= -3.5e-78) || !(c <= 3.5e+53)))) {
tmp = a / c;
} else {
tmp = b / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -6e+99) or (not (c <= -5.8e-36) and ((c <= -3.5e-78) or not (c <= 3.5e+53))): tmp = a / c else: tmp = b / d return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -6e+99) || (!(c <= -5.8e-36) && ((c <= -3.5e-78) || !(c <= 3.5e+53)))) tmp = Float64(a / c); else tmp = Float64(b / d); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((c <= -6e+99) || (~((c <= -5.8e-36)) && ((c <= -3.5e-78) || ~((c <= 3.5e+53))))) tmp = a / c; else tmp = b / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -6e+99], And[N[Not[LessEqual[c, -5.8e-36]], $MachinePrecision], Or[LessEqual[c, -3.5e-78], N[Not[LessEqual[c, 3.5e+53]], $MachinePrecision]]]], N[(a / c), $MachinePrecision], N[(b / d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -6 \cdot 10^{+99} \lor \neg \left(c \leq -5.8 \cdot 10^{-36}\right) \land \left(c \leq -3.5 \cdot 10^{-78} \lor \neg \left(c \leq 3.5 \cdot 10^{+53}\right)\right):\\
\;\;\;\;\frac{a}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{d}\\
\end{array}
\end{array}
if c < -6.00000000000000029e99 or -5.80000000000000026e-36 < c < -3.4999999999999999e-78 or 3.50000000000000019e53 < c Initial program 41.9%
Taylor expanded in c around inf 79.4%
if -6.00000000000000029e99 < c < -5.80000000000000026e-36 or -3.4999999999999999e-78 < c < 3.50000000000000019e53Initial program 72.3%
Taylor expanded in c around 0 69.0%
Final simplification73.3%
(FPCore (a b c d) :precision binary64 (/ a c))
double code(double a, double b, double c, double d) {
return a / c;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = a / c
end function
public static double code(double a, double b, double c, double d) {
return a / c;
}
def code(a, b, c, d): return a / c
function code(a, b, c, d) return Float64(a / c) end
function tmp = code(a, b, c, d) tmp = a / c; end
code[a_, b_, c_, d_] := N[(a / c), $MachinePrecision]
\begin{array}{l}
\\
\frac{a}{c}
\end{array}
Initial program 59.6%
Taylor expanded in c around inf 46.0%
Final simplification46.0%
(FPCore (a b c d) :precision binary64 (if (< (fabs d) (fabs c)) (/ (+ a (* b (/ d c))) (+ c (* d (/ d c)))) (/ (+ b (* a (/ c d))) (+ d (* c (/ c d))))))
double code(double a, double b, double c, double d) {
double tmp;
if (fabs(d) < fabs(c)) {
tmp = (a + (b * (d / c))) / (c + (d * (d / c)));
} else {
tmp = (b + (a * (c / d))) / (d + (c * (c / d)));
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if (abs(d) < abs(c)) then
tmp = (a + (b * (d / c))) / (c + (d * (d / c)))
else
tmp = (b + (a * (c / d))) / (d + (c * (c / d)))
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if (Math.abs(d) < Math.abs(c)) {
tmp = (a + (b * (d / c))) / (c + (d * (d / c)));
} else {
tmp = (b + (a * (c / d))) / (d + (c * (c / d)));
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if math.fabs(d) < math.fabs(c): tmp = (a + (b * (d / c))) / (c + (d * (d / c))) else: tmp = (b + (a * (c / d))) / (d + (c * (c / d))) return tmp
function code(a, b, c, d) tmp = 0.0 if (abs(d) < abs(c)) tmp = Float64(Float64(a + Float64(b * Float64(d / c))) / Float64(c + Float64(d * Float64(d / c)))); else tmp = Float64(Float64(b + Float64(a * Float64(c / d))) / Float64(d + Float64(c * Float64(c / d)))); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (abs(d) < abs(c)) tmp = (a + (b * (d / c))) / (c + (d * (d / c))); else tmp = (b + (a * (c / d))) / (d + (c * (c / d))); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Less[N[Abs[d], $MachinePrecision], N[Abs[c], $MachinePrecision]], N[(N[(a + N[(b * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c + N[(d * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b + N[(a * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d + N[(c * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|d\right| < \left|c\right|:\\
\;\;\;\;\frac{a + b \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + a \cdot \frac{c}{d}}{d + c \cdot \frac{c}{d}}\\
\end{array}
\end{array}
herbie shell --seed 2024021
(FPCore (a b c d)
:name "Complex division, real part"
:precision binary64
:herbie-target
(if (< (fabs d) (fabs c)) (/ (+ a (* b (/ d c))) (+ c (* d (/ d c)))) (/ (+ b (* a (/ c d))) (+ d (* c (/ c d)))))
(/ (+ (* a c) (* b d)) (+ (* c c) (* d d))))