
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c d) :precision binary64 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = ((b * c) - (a * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d): return ((b * c) - (a * d)) / ((c * c) + (d * d))
function code(a, b, c, d) return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))) end
function tmp = code(a, b, c, d) tmp = ((b * c) - (a * d)) / ((c * c) + (d * d)); end
code[a_, b_, c_, d_] := N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\end{array}
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* b c) (* a d))))
(if (<= (/ t_0 (+ (* c c) (* d d))) 1e+280)
(/ (* t_0 (/ 1.0 (hypot c d))) (hypot c d))
(/ (- (* c (/ b d)) a) d))))
double code(double a, double b, double c, double d) {
double t_0 = (b * c) - (a * d);
double tmp;
if ((t_0 / ((c * c) + (d * d))) <= 1e+280) {
tmp = (t_0 * (1.0 / hypot(c, d))) / hypot(c, d);
} else {
tmp = ((c * (b / d)) - a) / d;
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = (b * c) - (a * d);
double tmp;
if ((t_0 / ((c * c) + (d * d))) <= 1e+280) {
tmp = (t_0 * (1.0 / Math.hypot(c, d))) / Math.hypot(c, d);
} else {
tmp = ((c * (b / d)) - a) / d;
}
return tmp;
}
def code(a, b, c, d): t_0 = (b * c) - (a * d) tmp = 0 if (t_0 / ((c * c) + (d * d))) <= 1e+280: tmp = (t_0 * (1.0 / math.hypot(c, d))) / math.hypot(c, d) else: tmp = ((c * (b / d)) - a) / d return tmp
function code(a, b, c, d) t_0 = Float64(Float64(b * c) - Float64(a * d)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(c * c) + Float64(d * d))) <= 1e+280) tmp = Float64(Float64(t_0 * Float64(1.0 / hypot(c, d))) / hypot(c, d)); else tmp = Float64(Float64(Float64(c * Float64(b / d)) - a) / d); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (b * c) - (a * d); tmp = 0.0; if ((t_0 / ((c * c) + (d * d))) <= 1e+280) tmp = (t_0 * (1.0 / hypot(c, d))) / hypot(c, d); else tmp = ((c * (b / d)) - a) / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+280], N[(N[(t$95$0 * N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[(N[(c * N[(b / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot c - a \cdot d\\
\mathbf{if}\;\frac{t_0}{c \cdot c + d \cdot d} \leq 10^{+280}:\\
\;\;\;\;\frac{t_0 \cdot \frac{1}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < 1e280Initial program 72.9%
*-un-lft-identity72.9%
add-sqr-sqrt72.9%
times-frac72.8%
hypot-def72.8%
hypot-def97.0%
Applied egg-rr97.0%
associate-*r/97.1%
Applied egg-rr97.1%
if 1e280 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) Initial program 13.2%
Taylor expanded in c around 0 42.6%
+-commutative42.6%
mul-1-neg42.6%
unsub-neg42.6%
unpow242.6%
times-frac57.0%
Simplified57.0%
associate-*l/57.0%
sub-div57.5%
Applied egg-rr57.5%
Final simplification87.0%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* b c) (* a d))))
(if (<= (/ t_0 (+ (* c c) (* d d))) INFINITY)
(* (/ 1.0 (hypot c d)) (/ t_0 (hypot c d)))
(/ (- b (* a (/ d c))) c))))
double code(double a, double b, double c, double d) {
double t_0 = (b * c) - (a * d);
double tmp;
if ((t_0 / ((c * c) + (d * d))) <= ((double) INFINITY)) {
tmp = (1.0 / hypot(c, d)) * (t_0 / hypot(c, d));
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = (b * c) - (a * d);
double tmp;
if ((t_0 / ((c * c) + (d * d))) <= Double.POSITIVE_INFINITY) {
tmp = (1.0 / Math.hypot(c, d)) * (t_0 / Math.hypot(c, d));
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
def code(a, b, c, d): t_0 = (b * c) - (a * d) tmp = 0 if (t_0 / ((c * c) + (d * d))) <= math.inf: tmp = (1.0 / math.hypot(c, d)) * (t_0 / math.hypot(c, d)) else: tmp = (b - (a * (d / c))) / c return tmp
function code(a, b, c, d) t_0 = Float64(Float64(b * c) - Float64(a * d)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(c * c) + Float64(d * d))) <= Inf) tmp = Float64(Float64(1.0 / hypot(c, d)) * Float64(t_0 / hypot(c, d))); else tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / c); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = (b * c) - (a * d); tmp = 0.0; if ((t_0 / ((c * c) + (d * d))) <= Inf) tmp = (1.0 / hypot(c, d)) * (t_0 / hypot(c, d)); else tmp = (b - (a * (d / c))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot c - a \cdot d\\
\mathbf{if}\;\frac{t_0}{c \cdot c + d \cdot d} \leq \infty:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t_0}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < +inf.0Initial program 70.7%
*-un-lft-identity70.7%
add-sqr-sqrt70.7%
times-frac70.6%
hypot-def70.6%
hypot-def95.0%
Applied egg-rr95.0%
if +inf.0 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) Initial program 0.0%
*-un-lft-identity0.0%
add-sqr-sqrt0.0%
times-frac0.0%
hypot-def0.0%
hypot-def2.6%
Applied egg-rr2.6%
associate-*r/2.6%
Applied egg-rr2.6%
Taylor expanded in c around inf 34.8%
mul-1-neg34.8%
unpow234.8%
associate-/l*39.9%
associate-*l/47.2%
+-commutative47.2%
unsub-neg47.2%
associate-/r*51.2%
associate-/l*35.5%
associate-*r/51.2%
div-sub51.3%
Simplified51.3%
Final simplification87.0%
(FPCore (a b c d)
:precision binary64
(if (<= c -4.7e+35)
(- (/ b c) (/ d (* c (/ c a))))
(if (<= c 1.5e-60)
(/ (- (* b (/ c d)) a) d)
(if (<= c 18000000000.0)
(/ (- (* b c) (* a d)) (+ (* c c) (* d d)))
(if (<= c 2.05e+29)
(/ (- (* c (/ b d)) a) d)
(/ (- b (* a (/ d c))) (hypot c d)))))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -4.7e+35) {
tmp = (b / c) - (d / (c * (c / a)));
} else if (c <= 1.5e-60) {
tmp = ((b * (c / d)) - a) / d;
} else if (c <= 18000000000.0) {
tmp = ((b * c) - (a * d)) / ((c * c) + (d * d));
} else if (c <= 2.05e+29) {
tmp = ((c * (b / d)) - a) / d;
} else {
tmp = (b - (a * (d / c))) / hypot(c, d);
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double tmp;
if (c <= -4.7e+35) {
tmp = (b / c) - (d / (c * (c / a)));
} else if (c <= 1.5e-60) {
tmp = ((b * (c / d)) - a) / d;
} else if (c <= 18000000000.0) {
tmp = ((b * c) - (a * d)) / ((c * c) + (d * d));
} else if (c <= 2.05e+29) {
tmp = ((c * (b / d)) - a) / d;
} else {
tmp = (b - (a * (d / c))) / Math.hypot(c, d);
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -4.7e+35: tmp = (b / c) - (d / (c * (c / a))) elif c <= 1.5e-60: tmp = ((b * (c / d)) - a) / d elif c <= 18000000000.0: tmp = ((b * c) - (a * d)) / ((c * c) + (d * d)) elif c <= 2.05e+29: tmp = ((c * (b / d)) - a) / d else: tmp = (b - (a * (d / c))) / math.hypot(c, d) return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -4.7e+35) tmp = Float64(Float64(b / c) - Float64(d / Float64(c * Float64(c / a)))); elseif (c <= 1.5e-60) tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d); elseif (c <= 18000000000.0) tmp = Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))); elseif (c <= 2.05e+29) tmp = Float64(Float64(Float64(c * Float64(b / d)) - a) / d); else tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / hypot(c, d)); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (c <= -4.7e+35) tmp = (b / c) - (d / (c * (c / a))); elseif (c <= 1.5e-60) tmp = ((b * (c / d)) - a) / d; elseif (c <= 18000000000.0) tmp = ((b * c) - (a * d)) / ((c * c) + (d * d)); elseif (c <= 2.05e+29) tmp = ((c * (b / d)) - a) / d; else tmp = (b - (a * (d / c))) / hypot(c, d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -4.7e+35], N[(N[(b / c), $MachinePrecision] - N[(d / N[(c * N[(c / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.5e-60], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 18000000000.0], N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.05e+29], N[(N[(N[(c * N[(b / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -4.7 \cdot 10^{+35}:\\
\;\;\;\;\frac{b}{c} - \frac{d}{c \cdot \frac{c}{a}}\\
\mathbf{elif}\;c \leq 1.5 \cdot 10^{-60}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{elif}\;c \leq 18000000000:\\
\;\;\;\;\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;c \leq 2.05 \cdot 10^{+29}:\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if c < -4.70000000000000033e35Initial program 45.2%
Taylor expanded in c around inf 77.3%
+-commutative77.3%
mul-1-neg77.3%
unsub-neg77.3%
unpow277.3%
times-frac81.4%
Simplified81.4%
clear-num81.4%
frac-times83.2%
*-un-lft-identity83.2%
Applied egg-rr83.2%
if -4.70000000000000033e35 < c < 1.50000000000000009e-60Initial program 65.5%
Taylor expanded in c around 0 78.2%
+-commutative78.2%
mul-1-neg78.2%
unsub-neg78.2%
unpow278.2%
times-frac84.6%
Simplified84.6%
associate-*r/86.6%
sub-div86.9%
Applied egg-rr86.9%
if 1.50000000000000009e-60 < c < 1.8e10Initial program 84.8%
if 1.8e10 < c < 2.0500000000000002e29Initial program 48.4%
Taylor expanded in c around 0 56.8%
+-commutative56.8%
mul-1-neg56.8%
unsub-neg56.8%
unpow256.8%
times-frac75.4%
Simplified75.4%
associate-*l/75.7%
sub-div76.4%
Applied egg-rr76.4%
if 2.0500000000000002e29 < c Initial program 41.6%
*-un-lft-identity41.6%
add-sqr-sqrt41.6%
times-frac41.6%
hypot-def41.6%
hypot-def67.2%
Applied egg-rr67.2%
associate-*r/67.2%
Applied egg-rr67.2%
Taylor expanded in c around inf 81.5%
+-commutative81.5%
associate-*r/87.6%
neg-mul-187.6%
sub-neg87.6%
Simplified87.6%
Final simplification85.7%
(FPCore (a b c d)
:precision binary64
(if (<= c -4e+35)
(- (/ b c) (/ d (* c (/ c a))))
(if (<= c 2.6e-61)
(/ (- (* b (/ c d)) a) d)
(if (<= c 660000000.0)
(/ (- (* b c) (* a d)) (+ (* c c) (* d d)))
(if (<= c 2.6e+29)
(/ (- (* c (/ b d)) a) d)
(/ (- b (* a (/ d c))) c))))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -4e+35) {
tmp = (b / c) - (d / (c * (c / a)));
} else if (c <= 2.6e-61) {
tmp = ((b * (c / d)) - a) / d;
} else if (c <= 660000000.0) {
tmp = ((b * c) - (a * d)) / ((c * c) + (d * d));
} else if (c <= 2.6e+29) {
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 <= (-4d+35)) then
tmp = (b / c) - (d / (c * (c / a)))
else if (c <= 2.6d-61) then
tmp = ((b * (c / d)) - a) / d
else if (c <= 660000000.0d0) then
tmp = ((b * c) - (a * d)) / ((c * c) + (d * d))
else if (c <= 2.6d+29) 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 <= -4e+35) {
tmp = (b / c) - (d / (c * (c / a)));
} else if (c <= 2.6e-61) {
tmp = ((b * (c / d)) - a) / d;
} else if (c <= 660000000.0) {
tmp = ((b * c) - (a * d)) / ((c * c) + (d * d));
} else if (c <= 2.6e+29) {
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 <= -4e+35: tmp = (b / c) - (d / (c * (c / a))) elif c <= 2.6e-61: tmp = ((b * (c / d)) - a) / d elif c <= 660000000.0: tmp = ((b * c) - (a * d)) / ((c * c) + (d * d)) elif c <= 2.6e+29: 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 <= -4e+35) tmp = Float64(Float64(b / c) - Float64(d / Float64(c * Float64(c / a)))); elseif (c <= 2.6e-61) tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d); elseif (c <= 660000000.0) tmp = Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))); elseif (c <= 2.6e+29) 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 (c <= -4e+35) tmp = (b / c) - (d / (c * (c / a))); elseif (c <= 2.6e-61) tmp = ((b * (c / d)) - a) / d; elseif (c <= 660000000.0) tmp = ((b * c) - (a * d)) / ((c * c) + (d * d)); elseif (c <= 2.6e+29) 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, -4e+35], N[(N[(b / c), $MachinePrecision] - N[(d / N[(c * N[(c / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.6e-61], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 660000000.0], N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.6e+29], 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}\;c \leq -4 \cdot 10^{+35}:\\
\;\;\;\;\frac{b}{c} - \frac{d}{c \cdot \frac{c}{a}}\\
\mathbf{elif}\;c \leq 2.6 \cdot 10^{-61}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{elif}\;c \leq 660000000:\\
\;\;\;\;\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;c \leq 2.6 \cdot 10^{+29}:\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if c < -3.9999999999999999e35Initial program 45.2%
Taylor expanded in c around inf 77.3%
+-commutative77.3%
mul-1-neg77.3%
unsub-neg77.3%
unpow277.3%
times-frac81.4%
Simplified81.4%
clear-num81.4%
frac-times83.2%
*-un-lft-identity83.2%
Applied egg-rr83.2%
if -3.9999999999999999e35 < c < 2.6000000000000001e-61Initial program 65.5%
Taylor expanded in c around 0 78.2%
+-commutative78.2%
mul-1-neg78.2%
unsub-neg78.2%
unpow278.2%
times-frac84.6%
Simplified84.6%
associate-*r/86.6%
sub-div86.9%
Applied egg-rr86.9%
if 2.6000000000000001e-61 < c < 6.6e8Initial program 84.8%
if 6.6e8 < c < 2.6e29Initial program 48.4%
Taylor expanded in c around 0 56.8%
+-commutative56.8%
mul-1-neg56.8%
unsub-neg56.8%
unpow256.8%
times-frac75.4%
Simplified75.4%
associate-*l/75.7%
sub-div76.4%
Applied egg-rr76.4%
if 2.6e29 < c Initial program 41.6%
*-un-lft-identity41.6%
add-sqr-sqrt41.6%
times-frac41.6%
hypot-def41.6%
hypot-def67.2%
Applied egg-rr67.2%
associate-*r/67.2%
Applied egg-rr67.2%
Taylor expanded in c around inf 69.3%
mul-1-neg69.3%
unpow269.3%
associate-/l*67.6%
associate-*l/73.3%
+-commutative73.3%
unsub-neg73.3%
associate-/r*87.4%
associate-/l*81.4%
associate-*r/87.4%
div-sub87.4%
Simplified87.4%
Final simplification85.7%
(FPCore (a b c d) :precision binary64 (if (or (<= c -3.9e+15) (not (<= c 4.2e+26))) (/ (- b (* a (/ d c))) c) (/ (- a) d)))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -3.9e+15) || !(c <= 4.2e+26)) {
tmp = (b - (a * (d / c))) / c;
} else {
tmp = -a / d;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((c <= (-3.9d+15)) .or. (.not. (c <= 4.2d+26))) then
tmp = (b - (a * (d / c))) / c
else
tmp = -a / d
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -3.9e+15) || !(c <= 4.2e+26)) {
tmp = (b - (a * (d / c))) / c;
} else {
tmp = -a / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -3.9e+15) or not (c <= 4.2e+26): tmp = (b - (a * (d / c))) / c else: tmp = -a / d return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -3.9e+15) || !(c <= 4.2e+26)) tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / c); else tmp = Float64(Float64(-a) / d); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((c <= -3.9e+15) || ~((c <= 4.2e+26))) tmp = (b - (a * (d / c))) / c; else tmp = -a / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -3.9e+15], N[Not[LessEqual[c, 4.2e+26]], $MachinePrecision]], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[((-a) / d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -3.9 \cdot 10^{+15} \lor \neg \left(c \leq 4.2 \cdot 10^{+26}\right):\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\
\end{array}
\end{array}
if c < -3.9e15 or 4.2000000000000002e26 < c Initial program 43.8%
*-un-lft-identity43.8%
add-sqr-sqrt43.8%
times-frac43.7%
hypot-def43.7%
hypot-def66.0%
Applied egg-rr66.0%
associate-*r/66.0%
Applied egg-rr66.0%
Taylor expanded in c around inf 70.8%
mul-1-neg70.8%
unpow270.8%
associate-/l*70.3%
associate-*l/72.7%
+-commutative72.7%
unsub-neg72.7%
associate-/r*80.5%
associate-/l*75.9%
associate-*r/80.5%
div-sub80.5%
Simplified80.5%
if -3.9e15 < c < 4.2000000000000002e26Initial program 66.8%
Taylor expanded in c around 0 70.0%
associate-*r/70.0%
neg-mul-170.0%
Simplified70.0%
Final simplification74.1%
(FPCore (a b c d) :precision binary64 (if (<= c -17000000000000.0) (/ (- b (* d (/ a c))) c) (if (<= c 3.2e+29) (/ (- a) d) (/ (- b (* a (/ d c))) c))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -17000000000000.0) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 3.2e+29) {
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 (c <= (-17000000000000.0d0)) then
tmp = (b - (d * (a / c))) / c
else if (c <= 3.2d+29) 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 (c <= -17000000000000.0) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 3.2e+29) {
tmp = -a / d;
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -17000000000000.0: tmp = (b - (d * (a / c))) / c elif c <= 3.2e+29: tmp = -a / d else: tmp = (b - (a * (d / c))) / c return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -17000000000000.0) tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); elseif (c <= 3.2e+29) 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 (c <= -17000000000000.0) tmp = (b - (d * (a / c))) / c; elseif (c <= 3.2e+29) tmp = -a / d; else tmp = (b - (a * (d / c))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -17000000000000.0], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 3.2e+29], 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}\;c \leq -17000000000000:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{elif}\;c \leq 3.2 \cdot 10^{+29}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if c < -1.7e13Initial program 45.3%
Taylor expanded in c around inf 71.9%
+-commutative71.9%
mul-1-neg71.9%
unsub-neg71.9%
unpow271.9%
times-frac75.5%
Simplified75.5%
associate-*r/77.1%
sub-div77.1%
Applied egg-rr77.1%
if -1.7e13 < c < 3.19999999999999987e29Initial program 66.8%
Taylor expanded in c around 0 70.0%
associate-*r/70.0%
neg-mul-170.0%
Simplified70.0%
if 3.19999999999999987e29 < c Initial program 41.6%
*-un-lft-identity41.6%
add-sqr-sqrt41.6%
times-frac41.6%
hypot-def41.6%
hypot-def67.2%
Applied egg-rr67.2%
associate-*r/67.2%
Applied egg-rr67.2%
Taylor expanded in c around inf 69.3%
mul-1-neg69.3%
unpow269.3%
associate-/l*67.6%
associate-*l/73.3%
+-commutative73.3%
unsub-neg73.3%
associate-/r*87.4%
associate-/l*81.4%
associate-*r/87.4%
div-sub87.4%
Simplified87.4%
Final simplification74.5%
(FPCore (a b c d) :precision binary64 (if (<= c -3.2e+35) (/ (- b (* d (/ a c))) c) (if (<= c 3e+29) (/ (- (* 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.2e+35) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 3e+29) {
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.2d+35)) then
tmp = (b - (d * (a / c))) / c
else if (c <= 3d+29) 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.2e+35) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 3e+29) {
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.2e+35: tmp = (b - (d * (a / c))) / c elif c <= 3e+29: 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.2e+35) tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); elseif (c <= 3e+29) 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 (c <= -3.2e+35) tmp = (b - (d * (a / c))) / c; elseif (c <= 3e+29) 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.2e+35], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 3e+29], 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}\;c \leq -3.2 \cdot 10^{+35}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{elif}\;c \leq 3 \cdot 10^{+29}:\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if c < -3.19999999999999983e35Initial program 45.2%
Taylor expanded in c around inf 77.3%
+-commutative77.3%
mul-1-neg77.3%
unsub-neg77.3%
unpow277.3%
times-frac81.4%
Simplified81.4%
associate-*r/83.2%
sub-div83.2%
Applied egg-rr83.2%
if -3.19999999999999983e35 < c < 2.9999999999999999e29Initial program 65.9%
Taylor expanded in c around 0 74.5%
+-commutative74.5%
mul-1-neg74.5%
unsub-neg74.5%
unpow274.5%
times-frac81.2%
Simplified81.2%
associate-*l/81.5%
sub-div81.8%
Applied egg-rr81.8%
if 2.9999999999999999e29 < c Initial program 41.6%
*-un-lft-identity41.6%
add-sqr-sqrt41.6%
times-frac41.6%
hypot-def41.6%
hypot-def67.2%
Applied egg-rr67.2%
associate-*r/67.2%
Applied egg-rr67.2%
Taylor expanded in c around inf 69.3%
mul-1-neg69.3%
unpow269.3%
associate-/l*67.6%
associate-*l/73.3%
+-commutative73.3%
unsub-neg73.3%
associate-/r*87.4%
associate-/l*81.4%
associate-*r/87.4%
div-sub87.4%
Simplified87.4%
Final simplification83.0%
(FPCore (a b c d) :precision binary64 (if (<= c -1.62e+35) (/ (- b (* d (/ a c))) c) (if (<= c 2.65e+26) (/ (- (* b (/ c d)) a) d) (/ (- b (* a (/ d c))) c))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -1.62e+35) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 2.65e+26) {
tmp = ((b * (c / 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 <= (-1.62d+35)) then
tmp = (b - (d * (a / c))) / c
else if (c <= 2.65d+26) then
tmp = ((b * (c / 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 <= -1.62e+35) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 2.65e+26) {
tmp = ((b * (c / d)) - a) / d;
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -1.62e+35: tmp = (b - (d * (a / c))) / c elif c <= 2.65e+26: tmp = ((b * (c / d)) - a) / d else: tmp = (b - (a * (d / c))) / c return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -1.62e+35) tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); elseif (c <= 2.65e+26) tmp = Float64(Float64(Float64(b * Float64(c / 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 <= -1.62e+35) tmp = (b - (d * (a / c))) / c; elseif (c <= 2.65e+26) tmp = ((b * (c / d)) - a) / d; else tmp = (b - (a * (d / c))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -1.62e+35], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 2.65e+26], N[(N[(N[(b * N[(c / 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}\;c \leq -1.62 \cdot 10^{+35}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{elif}\;c \leq 2.65 \cdot 10^{+26}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if c < -1.62e35Initial program 45.2%
Taylor expanded in c around inf 77.3%
+-commutative77.3%
mul-1-neg77.3%
unsub-neg77.3%
unpow277.3%
times-frac81.4%
Simplified81.4%
associate-*r/83.2%
sub-div83.2%
Applied egg-rr83.2%
if -1.62e35 < c < 2.64999999999999984e26Initial program 65.9%
Taylor expanded in c around 0 74.5%
+-commutative74.5%
mul-1-neg74.5%
unsub-neg74.5%
unpow274.5%
times-frac81.2%
Simplified81.2%
associate-*r/82.9%
sub-div83.2%
Applied egg-rr83.2%
if 2.64999999999999984e26 < c Initial program 41.6%
*-un-lft-identity41.6%
add-sqr-sqrt41.6%
times-frac41.6%
hypot-def41.6%
hypot-def67.2%
Applied egg-rr67.2%
associate-*r/67.2%
Applied egg-rr67.2%
Taylor expanded in c around inf 69.3%
mul-1-neg69.3%
unpow269.3%
associate-/l*67.6%
associate-*l/73.3%
+-commutative73.3%
unsub-neg73.3%
associate-/r*87.4%
associate-/l*81.4%
associate-*r/87.4%
div-sub87.4%
Simplified87.4%
Final simplification83.9%
(FPCore (a b c d) :precision binary64 (if (<= c -2.05e+35) (- (/ b c) (/ d (* c (/ c a)))) (if (<= c 6.4e+29) (/ (- (* b (/ c d)) a) d) (/ (- b (* a (/ d c))) c))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -2.05e+35) {
tmp = (b / c) - (d / (c * (c / a)));
} else if (c <= 6.4e+29) {
tmp = ((b * (c / 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 <= (-2.05d+35)) then
tmp = (b / c) - (d / (c * (c / a)))
else if (c <= 6.4d+29) then
tmp = ((b * (c / 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 <= -2.05e+35) {
tmp = (b / c) - (d / (c * (c / a)));
} else if (c <= 6.4e+29) {
tmp = ((b * (c / d)) - a) / d;
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -2.05e+35: tmp = (b / c) - (d / (c * (c / a))) elif c <= 6.4e+29: tmp = ((b * (c / d)) - a) / d else: tmp = (b - (a * (d / c))) / c return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -2.05e+35) tmp = Float64(Float64(b / c) - Float64(d / Float64(c * Float64(c / a)))); elseif (c <= 6.4e+29) tmp = Float64(Float64(Float64(b * Float64(c / 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 <= -2.05e+35) tmp = (b / c) - (d / (c * (c / a))); elseif (c <= 6.4e+29) tmp = ((b * (c / d)) - a) / d; else tmp = (b - (a * (d / c))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -2.05e+35], N[(N[(b / c), $MachinePrecision] - N[(d / N[(c * N[(c / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 6.4e+29], N[(N[(N[(b * N[(c / 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}\;c \leq -2.05 \cdot 10^{+35}:\\
\;\;\;\;\frac{b}{c} - \frac{d}{c \cdot \frac{c}{a}}\\
\mathbf{elif}\;c \leq 6.4 \cdot 10^{+29}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if c < -2.0499999999999999e35Initial program 45.2%
Taylor expanded in c around inf 77.3%
+-commutative77.3%
mul-1-neg77.3%
unsub-neg77.3%
unpow277.3%
times-frac81.4%
Simplified81.4%
clear-num81.4%
frac-times83.2%
*-un-lft-identity83.2%
Applied egg-rr83.2%
if -2.0499999999999999e35 < c < 6.39999999999999973e29Initial program 65.9%
Taylor expanded in c around 0 74.5%
+-commutative74.5%
mul-1-neg74.5%
unsub-neg74.5%
unpow274.5%
times-frac81.2%
Simplified81.2%
associate-*r/82.9%
sub-div83.2%
Applied egg-rr83.2%
if 6.39999999999999973e29 < c Initial program 41.6%
*-un-lft-identity41.6%
add-sqr-sqrt41.6%
times-frac41.6%
hypot-def41.6%
hypot-def67.2%
Applied egg-rr67.2%
associate-*r/67.2%
Applied egg-rr67.2%
Taylor expanded in c around inf 69.3%
mul-1-neg69.3%
unpow269.3%
associate-/l*67.6%
associate-*l/73.3%
+-commutative73.3%
unsub-neg73.3%
associate-/r*87.4%
associate-/l*81.4%
associate-*r/87.4%
div-sub87.4%
Simplified87.4%
Final simplification83.9%
(FPCore (a b c d) :precision binary64 (if (<= c -4.6e+35) (/ b c) (if (<= c 1.5e+29) (/ (- a) d) (/ b c))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -4.6e+35) {
tmp = b / c;
} else if (c <= 1.5e+29) {
tmp = -a / d;
} else {
tmp = b / 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.6d+35)) then
tmp = b / c
else if (c <= 1.5d+29) then
tmp = -a / d
else
tmp = b / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if (c <= -4.6e+35) {
tmp = b / c;
} else if (c <= 1.5e+29) {
tmp = -a / d;
} else {
tmp = b / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -4.6e+35: tmp = b / c elif c <= 1.5e+29: tmp = -a / d else: tmp = b / c return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -4.6e+35) tmp = Float64(b / c); elseif (c <= 1.5e+29) tmp = Float64(Float64(-a) / d); else tmp = Float64(b / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (c <= -4.6e+35) tmp = b / c; elseif (c <= 1.5e+29) tmp = -a / d; else tmp = b / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -4.6e+35], N[(b / c), $MachinePrecision], If[LessEqual[c, 1.5e+29], N[((-a) / d), $MachinePrecision], N[(b / c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -4.6 \cdot 10^{+35}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 1.5 \cdot 10^{+29}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\end{array}
if c < -4.5999999999999996e35 or 1.5e29 < c Initial program 43.6%
Taylor expanded in c around inf 67.0%
if -4.5999999999999996e35 < c < 1.5e29Initial program 65.9%
Taylor expanded in c around 0 68.2%
associate-*r/68.2%
neg-mul-168.2%
Simplified68.2%
Final simplification67.8%
(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 57.7%
*-un-lft-identity57.7%
add-sqr-sqrt57.7%
times-frac57.7%
hypot-def57.7%
hypot-def78.0%
Applied egg-rr78.0%
Taylor expanded in c around inf 27.0%
Taylor expanded in d around -inf 7.5%
Final simplification7.5%
(FPCore (a b c d) :precision binary64 (/ b c))
double code(double a, double b, double c, double d) {
return b / c;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = b / c
end function
public static double code(double a, double b, double c, double d) {
return b / c;
}
def code(a, b, c, d): return b / c
function code(a, b, c, d) return Float64(b / c) end
function tmp = code(a, b, c, d) tmp = b / c; end
code[a_, b_, c_, d_] := N[(b / c), $MachinePrecision]
\begin{array}{l}
\\
\frac{b}{c}
\end{array}
Initial program 57.7%
Taylor expanded in c around inf 34.4%
Final simplification34.4%
(FPCore (a b c d) :precision binary64 (if (< (fabs d) (fabs c)) (/ (- b (* a (/ d c))) (+ c (* d (/ d c)))) (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d))))))
double code(double a, double b, double c, double d) {
double tmp;
if (fabs(d) < fabs(c)) {
tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
} else {
tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if (abs(d) < abs(c)) then
tmp = (b - (a * (d / c))) / (c + (d * (d / c)))
else
tmp = (-a + (b * (c / d))) / (d + (c * (c / d)))
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if (Math.abs(d) < Math.abs(c)) {
tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
} else {
tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if math.fabs(d) < math.fabs(c): tmp = (b - (a * (d / c))) / (c + (d * (d / c))) else: tmp = (-a + (b * (c / d))) / (d + (c * (c / d))) return tmp
function code(a, b, c, d) tmp = 0.0 if (abs(d) < abs(c)) tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / Float64(c + Float64(d * Float64(d / c)))); else tmp = Float64(Float64(Float64(-a) + Float64(b * Float64(c / d))) / Float64(d + Float64(c * Float64(c / d)))); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if (abs(d) < abs(c)) tmp = (b - (a * (d / c))) / (c + (d * (d / c))); else tmp = (-a + (b * (c / d))) / (d + (c * (c / d))); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Less[N[Abs[d], $MachinePrecision], N[Abs[c], $MachinePrecision]], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c + N[(d * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-a) + N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d + N[(c * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|d\right| < \left|c\right|:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-a\right) + b \cdot \frac{c}{d}}{d + c \cdot \frac{c}{d}}\\
\end{array}
\end{array}
herbie shell --seed 2023199
(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))))