
(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 14 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 (* (/ 1.0 (hypot c d)) (- (/ b (/ (hypot c d) c)) (/ a (/ (hypot c d) d)))))
double code(double a, double b, double c, double d) {
return (1.0 / hypot(c, d)) * ((b / (hypot(c, d) / c)) - (a / (hypot(c, d) / d)));
}
public static double code(double a, double b, double c, double d) {
return (1.0 / Math.hypot(c, d)) * ((b / (Math.hypot(c, d) / c)) - (a / (Math.hypot(c, d) / d)));
}
def code(a, b, c, d): return (1.0 / math.hypot(c, d)) * ((b / (math.hypot(c, d) / c)) - (a / (math.hypot(c, d) / d)))
function code(a, b, c, d) return Float64(Float64(1.0 / hypot(c, d)) * Float64(Float64(b / Float64(hypot(c, d) / c)) - Float64(a / Float64(hypot(c, d) / d)))) end
function tmp = code(a, b, c, d) tmp = (1.0 / hypot(c, d)) * ((b / (hypot(c, d) / c)) - (a / (hypot(c, d) / d))); end
code[a_, b_, c_, d_] := N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(b / N[(N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] - N[(a / N[(N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\frac{b}{\frac{\mathsf{hypot}\left(c, d\right)}{c}} - \frac{a}{\frac{\mathsf{hypot}\left(c, d\right)}{d}}\right)
\end{array}
Initial program 61.1%
*-un-lft-identity61.1%
add-sqr-sqrt61.1%
times-frac61.1%
hypot-def61.1%
hypot-def75.8%
Applied egg-rr75.8%
div-sub75.8%
Applied egg-rr75.8%
associate-/l*85.3%
associate-/l*99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ 1.0 (hypot c d))) (t_1 (- (* c b) (* d a))))
(if (<= (/ t_1 (+ (* c c) (* d d))) 2e+307)
(* t_0 (/ t_1 (hypot c d)))
(* t_0 (- b (/ a (/ (hypot c d) d)))))))
double code(double a, double b, double c, double d) {
double t_0 = 1.0 / hypot(c, d);
double t_1 = (c * b) - (d * a);
double tmp;
if ((t_1 / ((c * c) + (d * d))) <= 2e+307) {
tmp = t_0 * (t_1 / hypot(c, d));
} else {
tmp = t_0 * (b - (a / (hypot(c, d) / d)));
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = 1.0 / Math.hypot(c, d);
double t_1 = (c * b) - (d * a);
double tmp;
if ((t_1 / ((c * c) + (d * d))) <= 2e+307) {
tmp = t_0 * (t_1 / Math.hypot(c, d));
} else {
tmp = t_0 * (b - (a / (Math.hypot(c, d) / d)));
}
return tmp;
}
def code(a, b, c, d): t_0 = 1.0 / math.hypot(c, d) t_1 = (c * b) - (d * a) tmp = 0 if (t_1 / ((c * c) + (d * d))) <= 2e+307: tmp = t_0 * (t_1 / math.hypot(c, d)) else: tmp = t_0 * (b - (a / (math.hypot(c, d) / d))) return tmp
function code(a, b, c, d) t_0 = Float64(1.0 / hypot(c, d)) t_1 = Float64(Float64(c * b) - Float64(d * a)) tmp = 0.0 if (Float64(t_1 / Float64(Float64(c * c) + Float64(d * d))) <= 2e+307) tmp = Float64(t_0 * Float64(t_1 / hypot(c, d))); else tmp = Float64(t_0 * Float64(b - Float64(a / Float64(hypot(c, d) / d)))); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = 1.0 / hypot(c, d); t_1 = (c * b) - (d * a); tmp = 0.0; if ((t_1 / ((c * c) + (d * d))) <= 2e+307) tmp = t_0 * (t_1 / hypot(c, d)); else tmp = t_0 * (b - (a / (hypot(c, d) / d))); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+307], N[(t$95$0 * N[(t$95$1 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(b - N[(a / N[(N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := c \cdot b - d \cdot a\\
\mathbf{if}\;\frac{t_1}{c \cdot c + d \cdot d} \leq 2 \cdot 10^{+307}:\\
\;\;\;\;t_0 \cdot \frac{t_1}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(b - \frac{a}{\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))) < 1.99999999999999997e307Initial program 77.4%
*-un-lft-identity77.4%
add-sqr-sqrt77.4%
times-frac77.4%
hypot-def77.4%
hypot-def95.6%
Applied egg-rr95.6%
if 1.99999999999999997e307 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) Initial program 10.1%
*-un-lft-identity10.1%
add-sqr-sqrt10.1%
times-frac10.1%
hypot-def10.1%
hypot-def13.9%
Applied egg-rr13.9%
div-sub13.9%
Applied egg-rr13.9%
associate-/l*48.3%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in c around inf 75.1%
Final simplification90.6%
(FPCore (a b c d)
:precision binary64
(if (<= c -2.4e+83)
(/ (- b (* d (/ a c))) c)
(if (<= c -1.15e-151)
(/ (fma c b (* d (- a))) (+ (* c c) (* d d)))
(if (<= c 1.6e-144)
(/ (- (/ (* c b) d) a) d)
(* (/ 1.0 (hypot c d)) (- b (/ a (/ (hypot c d) d))))))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -2.4e+83) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= -1.15e-151) {
tmp = fma(c, b, (d * -a)) / ((c * c) + (d * d));
} else if (c <= 1.6e-144) {
tmp = (((c * b) / d) - a) / d;
} else {
tmp = (1.0 / hypot(c, d)) * (b - (a / (hypot(c, d) / d)));
}
return tmp;
}
function code(a, b, c, d) tmp = 0.0 if (c <= -2.4e+83) tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); elseif (c <= -1.15e-151) tmp = Float64(fma(c, b, Float64(d * Float64(-a))) / Float64(Float64(c * c) + Float64(d * d))); elseif (c <= 1.6e-144) tmp = Float64(Float64(Float64(Float64(c * b) / d) - a) / d); else tmp = Float64(Float64(1.0 / hypot(c, d)) * Float64(b - Float64(a / Float64(hypot(c, d) / d)))); end return tmp end
code[a_, b_, c_, d_] := If[LessEqual[c, -2.4e+83], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, -1.15e-151], N[(N[(c * b + N[(d * (-a)), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.6e-144], N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(b - N[(a / N[(N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.4 \cdot 10^{+83}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{elif}\;c \leq -1.15 \cdot 10^{-151}:\\
\;\;\;\;\frac{\mathsf{fma}\left(c, b, d \cdot \left(-a\right)\right)}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;c \leq 1.6 \cdot 10^{-144}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(b - \frac{a}{\frac{\mathsf{hypot}\left(c, d\right)}{d}}\right)\\
\end{array}
\end{array}
if c < -2.39999999999999991e83Initial program 44.7%
Taylor expanded in c around inf 77.9%
+-commutative77.9%
mul-1-neg77.9%
unsub-neg77.9%
unpow277.9%
times-frac90.5%
Simplified90.5%
associate-*r/91.2%
sub-div91.2%
Applied egg-rr91.2%
if -2.39999999999999991e83 < c < -1.14999999999999998e-151Initial program 81.6%
*-commutative81.6%
fma-neg81.6%
distribute-rgt-neg-in81.6%
Applied egg-rr81.6%
if -1.14999999999999998e-151 < c < 1.59999999999999986e-144Initial program 64.4%
Taylor expanded in c around 0 83.3%
+-commutative83.3%
mul-1-neg83.3%
unsub-neg83.3%
unpow283.3%
times-frac85.3%
Simplified85.3%
associate-*l/85.9%
Applied egg-rr85.9%
*-un-lft-identity85.9%
sub-div87.4%
Applied egg-rr87.4%
*-lft-identity87.4%
associate-*r/93.0%
Simplified93.0%
if 1.59999999999999986e-144 < c Initial program 55.5%
*-un-lft-identity55.5%
add-sqr-sqrt55.5%
times-frac55.4%
hypot-def55.4%
hypot-def71.1%
Applied egg-rr71.1%
div-sub71.1%
Applied egg-rr71.1%
associate-/l*84.4%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in c around inf 89.7%
Final simplification89.2%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (+ (* c c) (* d d))))
(if (<= c -2.2e+83)
(/ (- b (* d (/ a c))) c)
(if (<= c -7.6e-152)
(/ (fma c b (* d (- a))) t_0)
(if (<= c 1.6e-55)
(/ (- (/ (* c b) d) a) d)
(if (<= c 2.6e+92)
(/ (- (* c b) (* d a)) t_0)
(- (/ b c) (* (/ a c) (/ d c)))))))))
double code(double a, double b, double c, double d) {
double t_0 = (c * c) + (d * d);
double tmp;
if (c <= -2.2e+83) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= -7.6e-152) {
tmp = fma(c, b, (d * -a)) / t_0;
} else if (c <= 1.6e-55) {
tmp = (((c * b) / d) - a) / d;
} else if (c <= 2.6e+92) {
tmp = ((c * b) - (d * a)) / t_0;
} else {
tmp = (b / c) - ((a / c) * (d / c));
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(Float64(c * c) + Float64(d * d)) tmp = 0.0 if (c <= -2.2e+83) tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); elseif (c <= -7.6e-152) tmp = Float64(fma(c, b, Float64(d * Float64(-a))) / t_0); elseif (c <= 1.6e-55) tmp = Float64(Float64(Float64(Float64(c * b) / d) - a) / d); elseif (c <= 2.6e+92) tmp = Float64(Float64(Float64(c * b) - Float64(d * a)) / t_0); else tmp = Float64(Float64(b / c) - Float64(Float64(a / c) * Float64(d / c))); end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.2e+83], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, -7.6e-152], N[(N[(c * b + N[(d * (-a)), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[c, 1.6e-55], N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 2.6e+92], N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(b / c), $MachinePrecision] - N[(N[(a / c), $MachinePrecision] * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot c + d \cdot d\\
\mathbf{if}\;c \leq -2.2 \cdot 10^{+83}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{elif}\;c \leq -7.6 \cdot 10^{-152}:\\
\;\;\;\;\frac{\mathsf{fma}\left(c, b, d \cdot \left(-a\right)\right)}{t_0}\\
\mathbf{elif}\;c \leq 1.6 \cdot 10^{-55}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{elif}\;c \leq 2.6 \cdot 10^{+92}:\\
\;\;\;\;\frac{c \cdot b - d \cdot a}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\
\end{array}
\end{array}
if c < -2.19999999999999999e83Initial program 44.7%
Taylor expanded in c around inf 77.9%
+-commutative77.9%
mul-1-neg77.9%
unsub-neg77.9%
unpow277.9%
times-frac90.5%
Simplified90.5%
associate-*r/91.2%
sub-div91.2%
Applied egg-rr91.2%
if -2.19999999999999999e83 < c < -7.60000000000000024e-152Initial program 81.6%
*-commutative81.6%
fma-neg81.6%
distribute-rgt-neg-in81.6%
Applied egg-rr81.6%
if -7.60000000000000024e-152 < c < 1.6000000000000001e-55Initial program 63.9%
Taylor expanded in c around 0 84.5%
+-commutative84.5%
mul-1-neg84.5%
unsub-neg84.5%
unpow284.5%
times-frac86.1%
Simplified86.1%
associate-*l/86.6%
Applied egg-rr86.6%
*-un-lft-identity86.6%
sub-div87.8%
Applied egg-rr87.8%
*-lft-identity87.8%
associate-*r/92.2%
Simplified92.2%
if 1.6000000000000001e-55 < c < 2.5999999999999999e92Initial program 80.4%
if 2.5999999999999999e92 < c Initial program 35.3%
Taylor expanded in c around inf 80.1%
+-commutative80.1%
mul-1-neg80.1%
unsub-neg80.1%
unpow280.1%
times-frac91.7%
Simplified91.7%
Final simplification88.4%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (+ (* c c) (* d d)))))
(if (<= c -2.45e+83)
(/ (- b (* d (/ a c))) c)
(if (<= c -1.32e-152)
t_0
(if (<= c 1.65e-55)
(/ (- (/ (* c b) d) a) d)
(if (<= c 8.2e+80) t_0 (- (/ b c) (* (/ a c) (/ d c)))))))))
double code(double a, double b, double c, double d) {
double t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d));
double tmp;
if (c <= -2.45e+83) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= -1.32e-152) {
tmp = t_0;
} else if (c <= 1.65e-55) {
tmp = (((c * b) / d) - a) / d;
} else if (c <= 8.2e+80) {
tmp = t_0;
} else {
tmp = (b / c) - ((a / c) * (d / c));
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d))
if (c <= (-2.45d+83)) then
tmp = (b - (d * (a / c))) / c
else if (c <= (-1.32d-152)) then
tmp = t_0
else if (c <= 1.65d-55) then
tmp = (((c * b) / d) - a) / d
else if (c <= 8.2d+80) then
tmp = t_0
else
tmp = (b / c) - ((a / c) * (d / c))
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d));
double tmp;
if (c <= -2.45e+83) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= -1.32e-152) {
tmp = t_0;
} else if (c <= 1.65e-55) {
tmp = (((c * b) / d) - a) / d;
} else if (c <= 8.2e+80) {
tmp = t_0;
} else {
tmp = (b / c) - ((a / c) * (d / c));
}
return tmp;
}
def code(a, b, c, d): t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d)) tmp = 0 if c <= -2.45e+83: tmp = (b - (d * (a / c))) / c elif c <= -1.32e-152: tmp = t_0 elif c <= 1.65e-55: tmp = (((c * b) / d) - a) / d elif c <= 8.2e+80: tmp = t_0 else: tmp = (b / c) - ((a / c) * (d / c)) return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(Float64(c * c) + Float64(d * d))) tmp = 0.0 if (c <= -2.45e+83) tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); elseif (c <= -1.32e-152) tmp = t_0; elseif (c <= 1.65e-55) tmp = Float64(Float64(Float64(Float64(c * b) / d) - a) / d); elseif (c <= 8.2e+80) tmp = t_0; else tmp = Float64(Float64(b / c) - Float64(Float64(a / c) * Float64(d / c))); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((c * b) - (d * a)) / ((c * c) + (d * d)); tmp = 0.0; if (c <= -2.45e+83) tmp = (b - (d * (a / c))) / c; elseif (c <= -1.32e-152) tmp = t_0; elseif (c <= 1.65e-55) tmp = (((c * b) / d) - a) / d; elseif (c <= 8.2e+80) tmp = t_0; else tmp = (b / c) - ((a / c) * (d / c)); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.45e+83], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, -1.32e-152], t$95$0, If[LessEqual[c, 1.65e-55], N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 8.2e+80], t$95$0, N[(N[(b / c), $MachinePrecision] - N[(N[(a / c), $MachinePrecision] * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -2.45 \cdot 10^{+83}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{elif}\;c \leq -1.32 \cdot 10^{-152}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 1.65 \cdot 10^{-55}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{elif}\;c \leq 8.2 \cdot 10^{+80}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\
\end{array}
\end{array}
if c < -2.44999999999999989e83Initial program 44.7%
Taylor expanded in c around inf 77.9%
+-commutative77.9%
mul-1-neg77.9%
unsub-neg77.9%
unpow277.9%
times-frac90.5%
Simplified90.5%
associate-*r/91.2%
sub-div91.2%
Applied egg-rr91.2%
if -2.44999999999999989e83 < c < -1.31999999999999995e-152 or 1.65e-55 < c < 8.20000000000000003e80Initial program 81.1%
if -1.31999999999999995e-152 < c < 1.65e-55Initial program 63.9%
Taylor expanded in c around 0 84.5%
+-commutative84.5%
mul-1-neg84.5%
unsub-neg84.5%
unpow284.5%
times-frac86.1%
Simplified86.1%
associate-*l/86.6%
Applied egg-rr86.6%
*-un-lft-identity86.6%
sub-div87.8%
Applied egg-rr87.8%
*-lft-identity87.8%
associate-*r/92.2%
Simplified92.2%
if 8.20000000000000003e80 < c Initial program 35.3%
Taylor expanded in c around inf 80.1%
+-commutative80.1%
mul-1-neg80.1%
unsub-neg80.1%
unpow280.1%
times-frac91.7%
Simplified91.7%
Final simplification88.4%
(FPCore (a b c d)
:precision binary64
(if (<= c -4.3e+80)
(/ (- b (* d (/ a c))) c)
(if (<= c -1.1e-21)
(/ c (/ (+ (* c c) (* d d)) b))
(if (<= c 2.7e+44)
(/ (- (/ (* c b) d) a) d)
(- (/ b c) (* (/ a c) (/ d c)))))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -4.3e+80) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= -1.1e-21) {
tmp = c / (((c * c) + (d * d)) / b);
} else if (c <= 2.7e+44) {
tmp = (((c * b) / d) - a) / d;
} else {
tmp = (b / c) - ((a / c) * (d / c));
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if (c <= (-4.3d+80)) then
tmp = (b - (d * (a / c))) / c
else if (c <= (-1.1d-21)) then
tmp = c / (((c * c) + (d * d)) / b)
else if (c <= 2.7d+44) then
tmp = (((c * b) / d) - a) / d
else
tmp = (b / c) - ((a / c) * (d / c))
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if (c <= -4.3e+80) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= -1.1e-21) {
tmp = c / (((c * c) + (d * d)) / b);
} else if (c <= 2.7e+44) {
tmp = (((c * b) / d) - a) / d;
} else {
tmp = (b / c) - ((a / c) * (d / c));
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -4.3e+80: tmp = (b - (d * (a / c))) / c elif c <= -1.1e-21: tmp = c / (((c * c) + (d * d)) / b) elif c <= 2.7e+44: tmp = (((c * b) / d) - a) / d else: tmp = (b / c) - ((a / c) * (d / c)) return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -4.3e+80) tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); elseif (c <= -1.1e-21) tmp = Float64(c / Float64(Float64(Float64(c * c) + Float64(d * d)) / b)); elseif (c <= 2.7e+44) tmp = Float64(Float64(Float64(Float64(c * b) / d) - a) / d); else tmp = Float64(Float64(b / c) - Float64(Float64(a / c) * Float64(d / c))); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (c <= -4.3e+80) tmp = (b - (d * (a / c))) / c; elseif (c <= -1.1e-21) tmp = c / (((c * c) + (d * d)) / b); elseif (c <= 2.7e+44) tmp = (((c * b) / d) - a) / d; else tmp = (b / c) - ((a / c) * (d / c)); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -4.3e+80], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, -1.1e-21], N[(c / N[(N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.7e+44], N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], N[(N[(b / c), $MachinePrecision] - N[(N[(a / c), $MachinePrecision] * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -4.3 \cdot 10^{+80}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{elif}\;c \leq -1.1 \cdot 10^{-21}:\\
\;\;\;\;\frac{c}{\frac{c \cdot c + d \cdot d}{b}}\\
\mathbf{elif}\;c \leq 2.7 \cdot 10^{+44}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\
\end{array}
\end{array}
if c < -4.30000000000000004e80Initial program 45.9%
Taylor expanded in c around inf 76.3%
+-commutative76.3%
mul-1-neg76.3%
unsub-neg76.3%
unpow276.3%
times-frac88.6%
Simplified88.6%
associate-*r/89.2%
sub-div89.2%
Applied egg-rr89.2%
if -4.30000000000000004e80 < c < -1.1e-21Initial program 83.9%
*-un-lft-identity83.9%
add-sqr-sqrt83.9%
times-frac83.9%
hypot-def83.9%
hypot-def84.2%
Applied egg-rr84.2%
Taylor expanded in b around inf 81.2%
associate-/l*81.4%
unpow281.4%
unpow281.4%
Simplified81.4%
if -1.1e-21 < c < 2.7e44Initial program 69.1%
Taylor expanded in c around 0 73.7%
+-commutative73.7%
mul-1-neg73.7%
unsub-neg73.7%
unpow273.7%
times-frac76.6%
Simplified76.6%
associate-*l/76.9%
Applied egg-rr76.9%
*-un-lft-identity76.9%
sub-div77.7%
Applied egg-rr77.7%
*-lft-identity77.7%
associate-*r/80.6%
Simplified80.6%
if 2.7e44 < c Initial program 44.5%
Taylor expanded in c around inf 75.5%
+-commutative75.5%
mul-1-neg75.5%
unsub-neg75.5%
unpow275.5%
times-frac84.9%
Simplified84.9%
Final simplification83.1%
(FPCore (a b c d)
:precision binary64
(if (<= c -1e+52)
(/ (- b (* d (/ a c))) c)
(if (<= c 3.1e+44)
(/ (- (/ (* c b) d) a) d)
(- (/ b c) (* (/ a c) (/ d c))))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -1e+52) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 3.1e+44) {
tmp = (((c * b) / d) - a) / d;
} else {
tmp = (b / c) - ((a / c) * (d / c));
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if (c <= (-1d+52)) then
tmp = (b - (d * (a / c))) / c
else if (c <= 3.1d+44) then
tmp = (((c * b) / d) - a) / d
else
tmp = (b / c) - ((a / c) * (d / c))
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if (c <= -1e+52) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 3.1e+44) {
tmp = (((c * b) / d) - a) / d;
} else {
tmp = (b / c) - ((a / c) * (d / c));
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -1e+52: tmp = (b - (d * (a / c))) / c elif c <= 3.1e+44: tmp = (((c * b) / d) - a) / d else: tmp = (b / c) - ((a / c) * (d / c)) return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -1e+52) tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); elseif (c <= 3.1e+44) tmp = Float64(Float64(Float64(Float64(c * b) / d) - a) / d); else tmp = Float64(Float64(b / c) - Float64(Float64(a / c) * Float64(d / c))); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (c <= -1e+52) tmp = (b - (d * (a / c))) / c; elseif (c <= 3.1e+44) tmp = (((c * b) / d) - a) / d; else tmp = (b / c) - ((a / c) * (d / c)); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -1e+52], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 3.1e+44], N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], N[(N[(b / c), $MachinePrecision] - N[(N[(a / c), $MachinePrecision] * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1 \cdot 10^{+52}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{elif}\;c \leq 3.1 \cdot 10^{+44}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\
\end{array}
\end{array}
if c < -9.9999999999999999e51Initial program 50.2%
Taylor expanded in c around inf 75.3%
+-commutative75.3%
mul-1-neg75.3%
unsub-neg75.3%
unpow275.3%
times-frac86.2%
Simplified86.2%
associate-*r/86.8%
sub-div86.8%
Applied egg-rr86.8%
if -9.9999999999999999e51 < c < 3.09999999999999996e44Initial program 71.0%
Taylor expanded in c around 0 70.9%
+-commutative70.9%
mul-1-neg70.9%
unsub-neg70.9%
unpow270.9%
times-frac73.5%
Simplified73.5%
associate-*l/73.8%
Applied egg-rr73.8%
*-un-lft-identity73.8%
sub-div74.4%
Applied egg-rr74.4%
*-lft-identity74.4%
associate-*r/76.9%
Simplified76.9%
if 3.09999999999999996e44 < c Initial program 44.5%
Taylor expanded in c around inf 75.5%
+-commutative75.5%
mul-1-neg75.5%
unsub-neg75.5%
unpow275.5%
times-frac84.9%
Simplified84.9%
Final simplification80.6%
(FPCore (a b c d) :precision binary64 (if (or (<= d -1300000000.0) (not (<= d 1.05e+32))) (- (/ a d)) (/ (- b (* a (/ d c))) c)))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -1300000000.0) || !(d <= 1.05e+32)) {
tmp = -(a / d);
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((d <= (-1300000000.0d0)) .or. (.not. (d <= 1.05d+32))) then
tmp = -(a / d)
else
tmp = (b - (a * (d / c))) / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -1300000000.0) || !(d <= 1.05e+32)) {
tmp = -(a / d);
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -1300000000.0) or not (d <= 1.05e+32): tmp = -(a / d) else: tmp = (b - (a * (d / c))) / c return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -1300000000.0) || !(d <= 1.05e+32)) tmp = Float64(-Float64(a / d)); else tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((d <= -1300000000.0) || ~((d <= 1.05e+32))) tmp = -(a / d); else tmp = (b - (a * (d / c))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -1300000000.0], N[Not[LessEqual[d, 1.05e+32]], $MachinePrecision]], (-N[(a / d), $MachinePrecision]), N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1300000000 \lor \neg \left(d \leq 1.05 \cdot 10^{+32}\right):\\
\;\;\;\;-\frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if d < -1.3e9 or 1.05e32 < d Initial program 46.3%
Taylor expanded in c around 0 68.5%
associate-*r/68.5%
neg-mul-168.5%
Simplified68.5%
if -1.3e9 < d < 1.05e32Initial program 72.7%
*-un-lft-identity72.7%
add-sqr-sqrt72.7%
times-frac72.7%
hypot-def72.7%
hypot-def84.6%
Applied egg-rr84.6%
Taylor expanded in c around inf 71.6%
+-commutative71.6%
metadata-eval71.6%
unpow271.6%
cancel-sign-sub-inv71.6%
*-lft-identity71.6%
associate-/r*76.0%
div-sub77.5%
associate-*r/78.3%
Simplified78.3%
Final simplification74.0%
(FPCore (a b c d) :precision binary64 (if (or (<= d -3.7e-73) (not (<= d 3.6e+30))) (/ (- (* c (/ b d)) a) d) (/ (- b (* a (/ d c))) c)))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -3.7e-73) || !(d <= 3.6e+30)) {
tmp = ((c * (b / d)) - a) / d;
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((d <= (-3.7d-73)) .or. (.not. (d <= 3.6d+30))) then
tmp = ((c * (b / d)) - a) / d
else
tmp = (b - (a * (d / c))) / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -3.7e-73) || !(d <= 3.6e+30)) {
tmp = ((c * (b / d)) - a) / d;
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -3.7e-73) or not (d <= 3.6e+30): tmp = ((c * (b / d)) - a) / d else: tmp = (b - (a * (d / c))) / c return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -3.7e-73) || !(d <= 3.6e+30)) tmp = Float64(Float64(Float64(c * Float64(b / d)) - a) / d); else tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((d <= -3.7e-73) || ~((d <= 3.6e+30))) tmp = ((c * (b / d)) - a) / d; else tmp = (b - (a * (d / c))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -3.7e-73], N[Not[LessEqual[d, 3.6e+30]], $MachinePrecision]], N[(N[(N[(c * N[(b / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3.7 \cdot 10^{-73} \lor \neg \left(d \leq 3.6 \cdot 10^{+30}\right):\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if d < -3.7000000000000001e-73 or 3.6000000000000002e30 < d Initial program 53.6%
Taylor expanded in c around 0 71.1%
+-commutative71.1%
mul-1-neg71.1%
unsub-neg71.1%
unpow271.1%
times-frac75.4%
Simplified75.4%
associate-*l/75.7%
Applied egg-rr75.7%
sub-div75.7%
Applied egg-rr75.7%
if -3.7000000000000001e-73 < d < 3.6000000000000002e30Initial program 69.2%
*-un-lft-identity69.2%
add-sqr-sqrt69.2%
times-frac69.2%
hypot-def69.2%
hypot-def82.9%
Applied egg-rr82.9%
Taylor expanded in c around inf 77.3%
+-commutative77.3%
metadata-eval77.3%
unpow277.3%
cancel-sign-sub-inv77.3%
*-lft-identity77.3%
associate-/r*82.4%
div-sub84.1%
associate-*r/85.0%
Simplified85.0%
Final simplification80.2%
(FPCore (a b c d) :precision binary64 (if (<= c -3.45e+52) (/ (- b (* d (/ a c))) c) (if (<= c 2.7e+44) (/ (- (/ (* c b) d) a) d) (/ (- b (* a (/ d c))) c))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -3.45e+52) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 2.7e+44) {
tmp = (((c * b) / d) - a) / d;
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if (c <= (-3.45d+52)) then
tmp = (b - (d * (a / c))) / c
else if (c <= 2.7d+44) then
tmp = (((c * b) / d) - a) / d
else
tmp = (b - (a * (d / c))) / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if (c <= -3.45e+52) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 2.7e+44) {
tmp = (((c * b) / d) - a) / d;
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -3.45e+52: tmp = (b - (d * (a / c))) / c elif c <= 2.7e+44: tmp = (((c * b) / d) - a) / d else: tmp = (b - (a * (d / c))) / c return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -3.45e+52) tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); elseif (c <= 2.7e+44) tmp = Float64(Float64(Float64(Float64(c * b) / d) - a) / d); else tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (c <= -3.45e+52) tmp = (b - (d * (a / c))) / c; elseif (c <= 2.7e+44) tmp = (((c * b) / d) - a) / d; else tmp = (b - (a * (d / c))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -3.45e+52], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 2.7e+44], N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -3.45 \cdot 10^{+52}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{elif}\;c \leq 2.7 \cdot 10^{+44}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if c < -3.44999999999999998e52Initial program 50.2%
Taylor expanded in c around inf 75.3%
+-commutative75.3%
mul-1-neg75.3%
unsub-neg75.3%
unpow275.3%
times-frac86.2%
Simplified86.2%
associate-*r/86.8%
sub-div86.8%
Applied egg-rr86.8%
if -3.44999999999999998e52 < c < 2.7e44Initial program 71.0%
Taylor expanded in c around 0 70.9%
+-commutative70.9%
mul-1-neg70.9%
unsub-neg70.9%
unpow270.9%
times-frac73.5%
Simplified73.5%
associate-*l/73.8%
Applied egg-rr73.8%
*-un-lft-identity73.8%
sub-div74.4%
Applied egg-rr74.4%
*-lft-identity74.4%
associate-*r/76.9%
Simplified76.9%
if 2.7e44 < c Initial program 44.5%
*-un-lft-identity44.5%
add-sqr-sqrt44.5%
times-frac44.5%
hypot-def44.5%
hypot-def63.3%
Applied egg-rr63.3%
Taylor expanded in c around inf 75.5%
+-commutative75.5%
metadata-eval75.5%
unpow275.5%
cancel-sign-sub-inv75.5%
*-lft-identity75.5%
associate-/r*77.7%
div-sub77.7%
associate-*r/84.9%
Simplified84.9%
Final simplification80.6%
(FPCore (a b c d) :precision binary64 (if (or (<= c -9.5e-21) (not (<= c 2.5e+48))) (/ b c) (- (/ a d))))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -9.5e-21) || !(c <= 2.5e+48)) {
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 <= (-9.5d-21)) .or. (.not. (c <= 2.5d+48))) 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 <= -9.5e-21) || !(c <= 2.5e+48)) {
tmp = b / c;
} else {
tmp = -(a / d);
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -9.5e-21) or not (c <= 2.5e+48): tmp = b / c else: tmp = -(a / d) return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -9.5e-21) || !(c <= 2.5e+48)) 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 <= -9.5e-21) || ~((c <= 2.5e+48))) tmp = b / c; else tmp = -(a / d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -9.5e-21], N[Not[LessEqual[c, 2.5e+48]], $MachinePrecision]], N[(b / c), $MachinePrecision], (-N[(a / d), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -9.5 \cdot 10^{-21} \lor \neg \left(c \leq 2.5 \cdot 10^{+48}\right):\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;-\frac{a}{d}\\
\end{array}
\end{array}
if c < -9.4999999999999994e-21 or 2.49999999999999987e48 < c Initial program 52.5%
Taylor expanded in c around inf 68.4%
if -9.4999999999999994e-21 < c < 2.49999999999999987e48Initial program 69.0%
Taylor expanded in c around 0 63.1%
associate-*r/63.1%
neg-mul-163.1%
Simplified63.1%
Final simplification65.6%
(FPCore (a b c d) :precision binary64 (if (<= d -5.2e+58) (/ a d) (if (<= d 1.9e+145) (/ a c) (/ a d))))
double code(double a, double b, double c, double d) {
double tmp;
if (d <= -5.2e+58) {
tmp = a / d;
} else if (d <= 1.9e+145) {
tmp = a / c;
} else {
tmp = a / d;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if (d <= (-5.2d+58)) then
tmp = a / d
else if (d <= 1.9d+145) then
tmp = a / c
else
tmp = a / d
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if (d <= -5.2e+58) {
tmp = a / d;
} else if (d <= 1.9e+145) {
tmp = a / c;
} else {
tmp = a / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if d <= -5.2e+58: tmp = a / d elif d <= 1.9e+145: tmp = a / c else: tmp = a / d return tmp
function code(a, b, c, d) tmp = 0.0 if (d <= -5.2e+58) tmp = Float64(a / d); elseif (d <= 1.9e+145) tmp = Float64(a / c); else tmp = Float64(a / d); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (d <= -5.2e+58) tmp = a / d; elseif (d <= 1.9e+145) tmp = a / c; else tmp = a / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[d, -5.2e+58], N[(a / d), $MachinePrecision], If[LessEqual[d, 1.9e+145], N[(a / c), $MachinePrecision], N[(a / d), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5.2 \cdot 10^{+58}:\\
\;\;\;\;\frac{a}{d}\\
\mathbf{elif}\;d \leq 1.9 \cdot 10^{+145}:\\
\;\;\;\;\frac{a}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{d}\\
\end{array}
\end{array}
if d < -5.19999999999999976e58 or 1.90000000000000006e145 < d Initial program 36.8%
*-un-lft-identity36.8%
add-sqr-sqrt36.8%
times-frac36.8%
hypot-def36.8%
hypot-def59.3%
Applied egg-rr59.3%
Taylor expanded in c around 0 46.1%
mul-1-neg46.1%
Simplified46.1%
Taylor expanded in d around -inf 26.3%
if -5.19999999999999976e58 < d < 1.90000000000000006e145Initial program 71.9%
*-un-lft-identity71.9%
add-sqr-sqrt71.9%
times-frac71.9%
hypot-def71.9%
hypot-def83.1%
Applied egg-rr83.1%
Taylor expanded in c around 0 19.7%
mul-1-neg19.7%
Simplified19.7%
Taylor expanded in c around -inf 10.0%
Final simplification15.0%
(FPCore (a b c d) :precision binary64 (if (<= d -5.5e+188) (/ a d) (if (<= d 2.05e+245) (/ b c) (/ a d))))
double code(double a, double b, double c, double d) {
double tmp;
if (d <= -5.5e+188) {
tmp = a / d;
} else if (d <= 2.05e+245) {
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 (d <= (-5.5d+188)) then
tmp = a / d
else if (d <= 2.05d+245) 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 (d <= -5.5e+188) {
tmp = a / d;
} else if (d <= 2.05e+245) {
tmp = b / c;
} else {
tmp = a / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if d <= -5.5e+188: tmp = a / d elif d <= 2.05e+245: tmp = b / c else: tmp = a / d return tmp
function code(a, b, c, d) tmp = 0.0 if (d <= -5.5e+188) tmp = Float64(a / d); elseif (d <= 2.05e+245) tmp = Float64(b / c); else tmp = Float64(a / d); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (d <= -5.5e+188) tmp = a / d; elseif (d <= 2.05e+245) tmp = b / c; else tmp = a / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[d, -5.5e+188], N[(a / d), $MachinePrecision], If[LessEqual[d, 2.05e+245], N[(b / c), $MachinePrecision], N[(a / d), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5.5 \cdot 10^{+188}:\\
\;\;\;\;\frac{a}{d}\\
\mathbf{elif}\;d \leq 2.05 \cdot 10^{+245}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{d}\\
\end{array}
\end{array}
if d < -5.50000000000000013e188 or 2.05000000000000002e245 < d Initial program 44.6%
*-un-lft-identity44.6%
add-sqr-sqrt44.6%
times-frac44.6%
hypot-def44.6%
hypot-def57.5%
Applied egg-rr57.5%
Taylor expanded in c around 0 56.8%
mul-1-neg56.8%
Simplified56.8%
Taylor expanded in d around -inf 42.6%
if -5.50000000000000013e188 < d < 2.05000000000000002e245Initial program 63.4%
Taylor expanded in c around inf 45.9%
Final simplification45.5%
(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 61.1%
*-un-lft-identity61.1%
add-sqr-sqrt61.1%
times-frac61.1%
hypot-def61.1%
hypot-def75.8%
Applied egg-rr75.8%
Taylor expanded in c around 0 27.8%
mul-1-neg27.8%
Simplified27.8%
Taylor expanded in c around -inf 9.5%
Final simplification9.5%
(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 2023216
(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))))