
(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 15 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 (- (/ (* c (/ b (hypot c d))) (hypot c d)) (/ (* d (/ a (hypot c d))) (hypot c d))))
double code(double a, double b, double c, double d) {
return ((c * (b / hypot(c, d))) / hypot(c, d)) - ((d * (a / hypot(c, d))) / hypot(c, d));
}
public static double code(double a, double b, double c, double d) {
return ((c * (b / Math.hypot(c, d))) / Math.hypot(c, d)) - ((d * (a / Math.hypot(c, d))) / Math.hypot(c, d));
}
def code(a, b, c, d): return ((c * (b / math.hypot(c, d))) / math.hypot(c, d)) - ((d * (a / math.hypot(c, d))) / math.hypot(c, d))
function code(a, b, c, d) return Float64(Float64(Float64(c * Float64(b / hypot(c, d))) / hypot(c, d)) - Float64(Float64(d * Float64(a / hypot(c, d))) / hypot(c, d))) end
function tmp = code(a, b, c, d) tmp = ((c * (b / hypot(c, d))) / hypot(c, d)) - ((d * (a / hypot(c, d))) / hypot(c, d)); end
code[a_, b_, c_, d_] := N[(N[(N[(c * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] - N[(N[(d * N[(a / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{c \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)} - \frac{d \cdot \frac{a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}
\end{array}
Initial program 63.0%
*-un-lft-identity63.0%
add-sqr-sqrt63.0%
times-frac63.0%
hypot-def63.0%
hypot-def77.4%
Applied egg-rr77.4%
div-sub77.4%
sub-neg77.4%
Applied egg-rr77.4%
sub-neg77.4%
associate-/l*88.9%
associate-/r/87.4%
*-commutative87.4%
associate-*r/96.7%
Simplified96.7%
associate-*l/96.9%
*-un-lft-identity96.9%
div-sub96.9%
*-commutative96.9%
Applied egg-rr96.9%
Final simplification96.9%
(FPCore (a b c d) :precision binary64 (* (/ 1.0 (hypot c d)) (- (* c (/ b (hypot c d))) (* d (/ a (hypot c d))))))
double code(double a, double b, double c, double d) {
return (1.0 / hypot(c, d)) * ((c * (b / hypot(c, d))) - (d * (a / hypot(c, d))));
}
public static double code(double a, double b, double c, double d) {
return (1.0 / Math.hypot(c, d)) * ((c * (b / Math.hypot(c, d))) - (d * (a / Math.hypot(c, d))));
}
def code(a, b, c, d): return (1.0 / math.hypot(c, d)) * ((c * (b / math.hypot(c, d))) - (d * (a / math.hypot(c, d))))
function code(a, b, c, d) return Float64(Float64(1.0 / hypot(c, d)) * Float64(Float64(c * Float64(b / hypot(c, d))) - Float64(d * Float64(a / hypot(c, d))))) end
function tmp = code(a, b, c, d) tmp = (1.0 / hypot(c, d)) * ((c * (b / hypot(c, d))) - (d * (a / hypot(c, d)))); end
code[a_, b_, c_, d_] := N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(c * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(d * N[(a / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(c \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)} - d \cdot \frac{a}{\mathsf{hypot}\left(c, d\right)}\right)
\end{array}
Initial program 63.0%
*-un-lft-identity63.0%
add-sqr-sqrt63.0%
times-frac63.0%
hypot-def63.0%
hypot-def77.4%
Applied egg-rr77.4%
div-sub77.4%
sub-neg77.4%
Applied egg-rr77.4%
sub-neg77.4%
associate-/l*88.9%
associate-/r/87.4%
*-commutative87.4%
associate-*r/96.7%
Simplified96.7%
Final simplification96.7%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ 1.0 (hypot c d)))
(t_1 (* t_0 (/ (- (* c b) (* d a)) (hypot c d)))))
(if (<= c -2.15e+71)
(+ (/ b c) (/ -1.0 (/ c (* d (/ a c)))))
(if (<= c -5.5e-101)
t_1
(if (<= c 1.1e-227)
(/ (- (* b (/ c d)) a) d)
(if (<= c 1.68e+80)
t_1
(* t_0 (- (* c (/ b (hypot c d))) (* a (/ d c))))))))))
double code(double a, double b, double c, double d) {
double t_0 = 1.0 / hypot(c, d);
double t_1 = t_0 * (((c * b) - (d * a)) / hypot(c, d));
double tmp;
if (c <= -2.15e+71) {
tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
} else if (c <= -5.5e-101) {
tmp = t_1;
} else if (c <= 1.1e-227) {
tmp = ((b * (c / d)) - a) / d;
} else if (c <= 1.68e+80) {
tmp = t_1;
} else {
tmp = t_0 * ((c * (b / hypot(c, d))) - (a * (d / c)));
}
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 = t_0 * (((c * b) - (d * a)) / Math.hypot(c, d));
double tmp;
if (c <= -2.15e+71) {
tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
} else if (c <= -5.5e-101) {
tmp = t_1;
} else if (c <= 1.1e-227) {
tmp = ((b * (c / d)) - a) / d;
} else if (c <= 1.68e+80) {
tmp = t_1;
} else {
tmp = t_0 * ((c * (b / Math.hypot(c, d))) - (a * (d / c)));
}
return tmp;
}
def code(a, b, c, d): t_0 = 1.0 / math.hypot(c, d) t_1 = t_0 * (((c * b) - (d * a)) / math.hypot(c, d)) tmp = 0 if c <= -2.15e+71: tmp = (b / c) + (-1.0 / (c / (d * (a / c)))) elif c <= -5.5e-101: tmp = t_1 elif c <= 1.1e-227: tmp = ((b * (c / d)) - a) / d elif c <= 1.68e+80: tmp = t_1 else: tmp = t_0 * ((c * (b / math.hypot(c, d))) - (a * (d / c))) return tmp
function code(a, b, c, d) t_0 = Float64(1.0 / hypot(c, d)) t_1 = Float64(t_0 * Float64(Float64(Float64(c * b) - Float64(d * a)) / hypot(c, d))) tmp = 0.0 if (c <= -2.15e+71) tmp = Float64(Float64(b / c) + Float64(-1.0 / Float64(c / Float64(d * Float64(a / c))))); elseif (c <= -5.5e-101) tmp = t_1; elseif (c <= 1.1e-227) tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d); elseif (c <= 1.68e+80) tmp = t_1; else tmp = Float64(t_0 * Float64(Float64(c * Float64(b / hypot(c, d))) - Float64(a * Float64(d / c)))); end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = 1.0 / hypot(c, d); t_1 = t_0 * (((c * b) - (d * a)) / hypot(c, d)); tmp = 0.0; if (c <= -2.15e+71) tmp = (b / c) + (-1.0 / (c / (d * (a / c)))); elseif (c <= -5.5e-101) tmp = t_1; elseif (c <= 1.1e-227) tmp = ((b * (c / d)) - a) / d; elseif (c <= 1.68e+80) tmp = t_1; else tmp = t_0 * ((c * (b / hypot(c, d))) - (a * (d / c))); 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[(t$95$0 * N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.15e+71], N[(N[(b / c), $MachinePrecision] + N[(-1.0 / N[(c / N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -5.5e-101], t$95$1, If[LessEqual[c, 1.1e-227], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 1.68e+80], t$95$1, N[(t$95$0 * N[(N[(c * N[(b / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\mathsf{hypot}\left(c, d\right)}\\
t_1 := t_0 \cdot \frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;c \leq -2.15 \cdot 10^{+71}:\\
\;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\
\mathbf{elif}\;c \leq -5.5 \cdot 10^{-101}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 1.1 \cdot 10^{-227}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{elif}\;c \leq 1.68 \cdot 10^{+80}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(c \cdot \frac{b}{\mathsf{hypot}\left(c, d\right)} - a \cdot \frac{d}{c}\right)\\
\end{array}
\end{array}
if c < -2.14999999999999992e71Initial program 40.2%
Taylor expanded in c around inf 71.9%
+-commutative71.9%
mul-1-neg71.9%
unsub-neg71.9%
unpow271.9%
times-frac82.2%
Simplified82.2%
associate-*r/82.2%
clear-num82.3%
Applied egg-rr82.3%
if -2.14999999999999992e71 < c < -5.49999999999999973e-101 or 1.0999999999999999e-227 < c < 1.68000000000000006e80Initial program 85.8%
*-un-lft-identity85.8%
add-sqr-sqrt85.7%
times-frac85.7%
hypot-def85.7%
hypot-def95.4%
Applied egg-rr95.4%
if -5.49999999999999973e-101 < c < 1.0999999999999999e-227Initial program 66.9%
Taylor expanded in c around 0 87.8%
+-commutative87.8%
mul-1-neg87.8%
unsub-neg87.8%
*-commutative87.8%
unpow287.8%
times-frac91.2%
Simplified91.2%
associate-*r/95.6%
sub-div97.1%
Applied egg-rr97.1%
if 1.68000000000000006e80 < c Initial program 36.4%
*-un-lft-identity36.4%
add-sqr-sqrt36.4%
times-frac36.4%
hypot-def36.4%
hypot-def58.3%
Applied egg-rr58.3%
div-sub58.3%
sub-neg58.3%
Applied egg-rr58.3%
sub-neg58.3%
associate-/l*91.7%
associate-/r/91.7%
*-commutative91.7%
associate-*r/99.6%
Simplified99.6%
Taylor expanded in d around 0 89.9%
*-commutative89.9%
associate-/l*94.0%
associate-/r/94.0%
Simplified94.0%
Final simplification93.1%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (* (/ 1.0 (hypot c d)) (/ (- (* c b) (* d a)) (hypot c d)))))
(if (<= c -1.65e+69)
(+ (/ b c) (/ -1.0 (/ c (* d (/ a c)))))
(if (<= c -5.6e-107)
t_0
(if (<= c 1.05e-227)
(/ (- (* b (/ c d)) a) d)
(if (<= c 1.75e+81) t_0 (/ (- b (* a (/ d c))) (hypot c d))))))))
double code(double a, double b, double c, double d) {
double t_0 = (1.0 / hypot(c, d)) * (((c * b) - (d * a)) / hypot(c, d));
double tmp;
if (c <= -1.65e+69) {
tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
} else if (c <= -5.6e-107) {
tmp = t_0;
} else if (c <= 1.05e-227) {
tmp = ((b * (c / d)) - a) / d;
} else if (c <= 1.75e+81) {
tmp = t_0;
} else {
tmp = (b - (a * (d / c))) / hypot(c, d);
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = (1.0 / Math.hypot(c, d)) * (((c * b) - (d * a)) / Math.hypot(c, d));
double tmp;
if (c <= -1.65e+69) {
tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
} else if (c <= -5.6e-107) {
tmp = t_0;
} else if (c <= 1.05e-227) {
tmp = ((b * (c / d)) - a) / d;
} else if (c <= 1.75e+81) {
tmp = t_0;
} else {
tmp = (b - (a * (d / c))) / Math.hypot(c, d);
}
return tmp;
}
def code(a, b, c, d): t_0 = (1.0 / math.hypot(c, d)) * (((c * b) - (d * a)) / math.hypot(c, d)) tmp = 0 if c <= -1.65e+69: tmp = (b / c) + (-1.0 / (c / (d * (a / c)))) elif c <= -5.6e-107: tmp = t_0 elif c <= 1.05e-227: tmp = ((b * (c / d)) - a) / d elif c <= 1.75e+81: tmp = t_0 else: tmp = (b - (a * (d / c))) / math.hypot(c, d) return tmp
function code(a, b, c, d) t_0 = Float64(Float64(1.0 / hypot(c, d)) * Float64(Float64(Float64(c * b) - Float64(d * a)) / hypot(c, d))) tmp = 0.0 if (c <= -1.65e+69) tmp = Float64(Float64(b / c) + Float64(-1.0 / Float64(c / Float64(d * Float64(a / c))))); elseif (c <= -5.6e-107) tmp = t_0; elseif (c <= 1.05e-227) tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d); elseif (c <= 1.75e+81) tmp = t_0; 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) t_0 = (1.0 / hypot(c, d)) * (((c * b) - (d * a)) / hypot(c, d)); tmp = 0.0; if (c <= -1.65e+69) tmp = (b / c) + (-1.0 / (c / (d * (a / c)))); elseif (c <= -5.6e-107) tmp = t_0; elseif (c <= 1.05e-227) tmp = ((b * (c / d)) - a) / d; elseif (c <= 1.75e+81) tmp = t_0; else tmp = (b - (a * (d / c))) / hypot(c, d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1.65e+69], N[(N[(b / c), $MachinePrecision] + N[(-1.0 / N[(c / N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -5.6e-107], t$95$0, If[LessEqual[c, 1.05e-227], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 1.75e+81], t$95$0, 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}
t_0 := \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;c \leq -1.65 \cdot 10^{+69}:\\
\;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\
\mathbf{elif}\;c \leq -5.6 \cdot 10^{-107}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 1.05 \cdot 10^{-227}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{elif}\;c \leq 1.75 \cdot 10^{+81}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if c < -1.6499999999999999e69Initial program 40.2%
Taylor expanded in c around inf 71.9%
+-commutative71.9%
mul-1-neg71.9%
unsub-neg71.9%
unpow271.9%
times-frac82.2%
Simplified82.2%
associate-*r/82.2%
clear-num82.3%
Applied egg-rr82.3%
if -1.6499999999999999e69 < c < -5.5999999999999998e-107 or 1.05e-227 < c < 1.75e81Initial program 85.8%
*-un-lft-identity85.8%
add-sqr-sqrt85.7%
times-frac85.7%
hypot-def85.7%
hypot-def95.4%
Applied egg-rr95.4%
if -5.5999999999999998e-107 < c < 1.05e-227Initial program 66.9%
Taylor expanded in c around 0 87.8%
+-commutative87.8%
mul-1-neg87.8%
unsub-neg87.8%
*-commutative87.8%
unpow287.8%
times-frac91.2%
Simplified91.2%
associate-*r/95.6%
sub-div97.1%
Applied egg-rr97.1%
if 1.75e81 < c Initial program 36.4%
*-un-lft-identity36.4%
add-sqr-sqrt36.4%
times-frac36.4%
hypot-def36.4%
hypot-def58.3%
Applied egg-rr58.3%
Taylor expanded in c around inf 89.9%
mul-1-neg89.9%
associate-*l/92.1%
sub-neg92.1%
*-commutative92.1%
Simplified92.1%
associate-*l/92.4%
*-un-lft-identity92.4%
div-sub92.4%
associate-*r/90.1%
Applied egg-rr90.1%
div-sub90.1%
associate-/l*92.4%
associate-/r/92.4%
Simplified92.4%
Final simplification92.8%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (+ (* d d) (* c c)))))
(if (<= c -6.5e+56)
(+ (/ b c) (/ -1.0 (/ c (* d (/ a c)))))
(if (<= c -3.8e-107)
t_0
(if (<= c 9e-161)
(/ (- (* b (/ c d)) a) d)
(if (<= c 4e+79) t_0 (/ (- b (* a (/ d c))) (hypot c d))))))))
double code(double a, double b, double c, double d) {
double t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c));
double tmp;
if (c <= -6.5e+56) {
tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
} else if (c <= -3.8e-107) {
tmp = t_0;
} else if (c <= 9e-161) {
tmp = ((b * (c / d)) - a) / d;
} else if (c <= 4e+79) {
tmp = t_0;
} else {
tmp = (b - (a * (d / c))) / hypot(c, d);
}
return tmp;
}
public static double code(double a, double b, double c, double d) {
double t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c));
double tmp;
if (c <= -6.5e+56) {
tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
} else if (c <= -3.8e-107) {
tmp = t_0;
} else if (c <= 9e-161) {
tmp = ((b * (c / d)) - a) / d;
} else if (c <= 4e+79) {
tmp = t_0;
} else {
tmp = (b - (a * (d / c))) / Math.hypot(c, d);
}
return tmp;
}
def code(a, b, c, d): t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c)) tmp = 0 if c <= -6.5e+56: tmp = (b / c) + (-1.0 / (c / (d * (a / c)))) elif c <= -3.8e-107: tmp = t_0 elif c <= 9e-161: tmp = ((b * (c / d)) - a) / d elif c <= 4e+79: tmp = t_0 else: tmp = (b - (a * (d / c))) / math.hypot(c, d) return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(Float64(d * d) + Float64(c * c))) tmp = 0.0 if (c <= -6.5e+56) tmp = Float64(Float64(b / c) + Float64(-1.0 / Float64(c / Float64(d * Float64(a / c))))); elseif (c <= -3.8e-107) tmp = t_0; elseif (c <= 9e-161) tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d); elseif (c <= 4e+79) tmp = t_0; 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) t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c)); tmp = 0.0; if (c <= -6.5e+56) tmp = (b / c) + (-1.0 / (c / (d * (a / c)))); elseif (c <= -3.8e-107) tmp = t_0; elseif (c <= 9e-161) tmp = ((b * (c / d)) - a) / d; elseif (c <= 4e+79) tmp = t_0; else tmp = (b - (a * (d / c))) / hypot(c, d); 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[(d * d), $MachinePrecision] + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -6.5e+56], N[(N[(b / c), $MachinePrecision] + N[(-1.0 / N[(c / N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -3.8e-107], t$95$0, If[LessEqual[c, 9e-161], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 4e+79], t$95$0, 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}
t_0 := \frac{c \cdot b - d \cdot a}{d \cdot d + c \cdot c}\\
\mathbf{if}\;c \leq -6.5 \cdot 10^{+56}:\\
\;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\
\mathbf{elif}\;c \leq -3.8 \cdot 10^{-107}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 9 \cdot 10^{-161}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{elif}\;c \leq 4 \cdot 10^{+79}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if c < -6.5000000000000001e56Initial program 43.6%
Taylor expanded in c around inf 73.5%
+-commutative73.5%
mul-1-neg73.5%
unsub-neg73.5%
unpow273.5%
times-frac83.2%
Simplified83.2%
associate-*r/83.2%
clear-num83.3%
Applied egg-rr83.3%
if -6.5000000000000001e56 < c < -3.8000000000000002e-107 or 8.9999999999999993e-161 < c < 3.99999999999999987e79Initial program 87.5%
if -3.8000000000000002e-107 < c < 8.9999999999999993e-161Initial program 68.4%
Taylor expanded in c around 0 86.4%
+-commutative86.4%
mul-1-neg86.4%
unsub-neg86.4%
*-commutative86.4%
unpow286.4%
times-frac89.4%
Simplified89.4%
associate-*r/93.0%
sub-div94.2%
Applied egg-rr94.2%
if 3.99999999999999987e79 < c Initial program 36.4%
*-un-lft-identity36.4%
add-sqr-sqrt36.4%
times-frac36.4%
hypot-def36.4%
hypot-def58.3%
Applied egg-rr58.3%
Taylor expanded in c around inf 89.9%
mul-1-neg89.9%
associate-*l/92.1%
sub-neg92.1%
*-commutative92.1%
Simplified92.1%
associate-*l/92.4%
*-un-lft-identity92.4%
div-sub92.4%
associate-*r/90.1%
Applied egg-rr90.1%
div-sub90.1%
associate-/l*92.4%
associate-/r/92.4%
Simplified92.4%
Final simplification89.7%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* c b) (* d a))))
(if (<= c -1.45e+57)
(+ (/ b c) (/ -1.0 (/ c (* d (/ a c)))))
(if (<= c -1.5e-108)
(/ t_0 (fma c c (* d d)))
(if (<= c 2.45e-160)
(/ (- (* b (/ c d)) a) d)
(if (<= c 4.4e+80)
(/ t_0 (+ (* d d) (* c c)))
(/ (- b (* a (/ d c))) (hypot c d))))))))
double code(double a, double b, double c, double d) {
double t_0 = (c * b) - (d * a);
double tmp;
if (c <= -1.45e+57) {
tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
} else if (c <= -1.5e-108) {
tmp = t_0 / fma(c, c, (d * d));
} else if (c <= 2.45e-160) {
tmp = ((b * (c / d)) - a) / d;
} else if (c <= 4.4e+80) {
tmp = t_0 / ((d * d) + (c * c));
} else {
tmp = (b - (a * (d / c))) / hypot(c, d);
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(Float64(c * b) - Float64(d * a)) tmp = 0.0 if (c <= -1.45e+57) tmp = Float64(Float64(b / c) + Float64(-1.0 / Float64(c / Float64(d * Float64(a / c))))); elseif (c <= -1.5e-108) tmp = Float64(t_0 / fma(c, c, Float64(d * d))); elseif (c <= 2.45e-160) tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d); elseif (c <= 4.4e+80) tmp = Float64(t_0 / Float64(Float64(d * d) + Float64(c * c))); else tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / hypot(c, d)); end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1.45e+57], N[(N[(b / c), $MachinePrecision] + N[(-1.0 / N[(c / N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -1.5e-108], N[(t$95$0 / N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.45e-160], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 4.4e+80], N[(t$95$0 / N[(N[(d * d), $MachinePrecision] + N[(c * c), $MachinePrecision]), $MachinePrecision]), $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}
t_0 := c \cdot b - d \cdot a\\
\mathbf{if}\;c \leq -1.45 \cdot 10^{+57}:\\
\;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\
\mathbf{elif}\;c \leq -1.5 \cdot 10^{-108}:\\
\;\;\;\;\frac{t_0}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\
\mathbf{elif}\;c \leq 2.45 \cdot 10^{-160}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{elif}\;c \leq 4.4 \cdot 10^{+80}:\\
\;\;\;\;\frac{t_0}{d \cdot d + c \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{\mathsf{hypot}\left(c, d\right)}\\
\end{array}
\end{array}
if c < -1.4500000000000001e57Initial program 43.6%
Taylor expanded in c around inf 73.5%
+-commutative73.5%
mul-1-neg73.5%
unsub-neg73.5%
unpow273.5%
times-frac83.2%
Simplified83.2%
associate-*r/83.2%
clear-num83.3%
Applied egg-rr83.3%
if -1.4500000000000001e57 < c < -1.49999999999999996e-108Initial program 89.0%
fma-def89.0%
Simplified89.0%
if -1.49999999999999996e-108 < c < 2.4499999999999999e-160Initial program 68.4%
Taylor expanded in c around 0 86.4%
+-commutative86.4%
mul-1-neg86.4%
unsub-neg86.4%
*-commutative86.4%
unpow286.4%
times-frac89.4%
Simplified89.4%
associate-*r/93.0%
sub-div94.2%
Applied egg-rr94.2%
if 2.4499999999999999e-160 < c < 4.40000000000000005e80Initial program 86.6%
if 4.40000000000000005e80 < c Initial program 36.4%
*-un-lft-identity36.4%
add-sqr-sqrt36.4%
times-frac36.4%
hypot-def36.4%
hypot-def58.3%
Applied egg-rr58.3%
Taylor expanded in c around inf 89.9%
mul-1-neg89.9%
associate-*l/92.1%
sub-neg92.1%
*-commutative92.1%
Simplified92.1%
associate-*l/92.4%
*-un-lft-identity92.4%
div-sub92.4%
associate-*r/90.1%
Applied egg-rr90.1%
div-sub90.1%
associate-/l*92.4%
associate-/r/92.4%
Simplified92.4%
Final simplification89.7%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (+ (* d d) (* c c)))))
(if (<= c -4.3e+57)
(+ (/ b c) (/ -1.0 (/ c (* d (/ a c)))))
(if (<= c -3.3e-106)
t_0
(if (<= c 2.2e-160)
(/ (- (* b (/ c d)) a) d)
(if (<= c 1.16e+77) t_0 (/ (- b (* a (/ d c))) c)))))))
double code(double a, double b, double c, double d) {
double t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c));
double tmp;
if (c <= -4.3e+57) {
tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
} else if (c <= -3.3e-106) {
tmp = t_0;
} else if (c <= 2.2e-160) {
tmp = ((b * (c / d)) - a) / d;
} else if (c <= 1.16e+77) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c))
if (c <= (-4.3d+57)) then
tmp = (b / c) + ((-1.0d0) / (c / (d * (a / c))))
else if (c <= (-3.3d-106)) then
tmp = t_0
else if (c <= 2.2d-160) then
tmp = ((b * (c / d)) - a) / d
else if (c <= 1.16d+77) then
tmp = t_0
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 t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c));
double tmp;
if (c <= -4.3e+57) {
tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
} else if (c <= -3.3e-106) {
tmp = t_0;
} else if (c <= 2.2e-160) {
tmp = ((b * (c / d)) - a) / d;
} else if (c <= 1.16e+77) {
tmp = t_0;
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((c * b) - (d * a)) / ((d * d) + (c * c)) tmp = 0 if c <= -4.3e+57: tmp = (b / c) + (-1.0 / (c / (d * (a / c)))) elif c <= -3.3e-106: tmp = t_0 elif c <= 2.2e-160: tmp = ((b * (c / d)) - a) / d elif c <= 1.16e+77: tmp = t_0 else: tmp = (b - (a * (d / c))) / c return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(Float64(d * d) + Float64(c * c))) tmp = 0.0 if (c <= -4.3e+57) tmp = Float64(Float64(b / c) + Float64(-1.0 / Float64(c / Float64(d * Float64(a / c))))); elseif (c <= -3.3e-106) tmp = t_0; elseif (c <= 2.2e-160) tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d); elseif (c <= 1.16e+77) tmp = t_0; 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 = ((c * b) - (d * a)) / ((d * d) + (c * c)); tmp = 0.0; if (c <= -4.3e+57) tmp = (b / c) + (-1.0 / (c / (d * (a / c)))); elseif (c <= -3.3e-106) tmp = t_0; elseif (c <= 2.2e-160) tmp = ((b * (c / d)) - a) / d; elseif (c <= 1.16e+77) tmp = t_0; else tmp = (b - (a * (d / c))) / 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[(d * d), $MachinePrecision] + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -4.3e+57], N[(N[(b / c), $MachinePrecision] + N[(-1.0 / N[(c / N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -3.3e-106], t$95$0, If[LessEqual[c, 2.2e-160], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 1.16e+77], t$95$0, N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{d \cdot d + c \cdot c}\\
\mathbf{if}\;c \leq -4.3 \cdot 10^{+57}:\\
\;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\
\mathbf{elif}\;c \leq -3.3 \cdot 10^{-106}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c \leq 2.2 \cdot 10^{-160}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{elif}\;c \leq 1.16 \cdot 10^{+77}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if c < -4.30000000000000033e57Initial program 43.6%
Taylor expanded in c around inf 73.5%
+-commutative73.5%
mul-1-neg73.5%
unsub-neg73.5%
unpow273.5%
times-frac83.2%
Simplified83.2%
associate-*r/83.2%
clear-num83.3%
Applied egg-rr83.3%
if -4.30000000000000033e57 < c < -3.30000000000000016e-106 or 2.2e-160 < c < 1.1600000000000001e77Initial program 87.5%
if -3.30000000000000016e-106 < c < 2.2e-160Initial program 68.4%
Taylor expanded in c around 0 86.4%
+-commutative86.4%
mul-1-neg86.4%
unsub-neg86.4%
*-commutative86.4%
unpow286.4%
times-frac89.4%
Simplified89.4%
associate-*r/93.0%
sub-div94.2%
Applied egg-rr94.2%
if 1.1600000000000001e77 < c Initial program 36.4%
*-un-lft-identity36.4%
add-sqr-sqrt36.4%
times-frac36.4%
hypot-def36.4%
hypot-def58.3%
Applied egg-rr58.3%
Taylor expanded in c around inf 81.7%
+-commutative81.7%
metadata-eval81.7%
unpow281.7%
cancel-sign-sub-inv81.7%
*-lft-identity81.7%
associate-/r*90.0%
associate-*r/92.1%
div-sub92.1%
Simplified92.1%
Final simplification89.6%
(FPCore (a b c d) :precision binary64 (if (<= c -3.8e-31) (+ (/ b c) (/ -1.0 (/ c (* d (/ a c))))) (if (<= c 1.6e-11) (/ (- (* b (/ c d)) a) d) (/ (- b (* a (/ d c))) c))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -3.8e-31) {
tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
} else if (c <= 1.6e-11) {
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 <= (-3.8d-31)) then
tmp = (b / c) + ((-1.0d0) / (c / (d * (a / c))))
else if (c <= 1.6d-11) 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 <= -3.8e-31) {
tmp = (b / c) + (-1.0 / (c / (d * (a / c))));
} else if (c <= 1.6e-11) {
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 <= -3.8e-31: tmp = (b / c) + (-1.0 / (c / (d * (a / c)))) elif c <= 1.6e-11: 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 <= -3.8e-31) tmp = Float64(Float64(b / c) + Float64(-1.0 / Float64(c / Float64(d * Float64(a / c))))); elseif (c <= 1.6e-11) 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 <= -3.8e-31) tmp = (b / c) + (-1.0 / (c / (d * (a / c)))); elseif (c <= 1.6e-11) 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, -3.8e-31], N[(N[(b / c), $MachinePrecision] + N[(-1.0 / N[(c / N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.6e-11], 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 -3.8 \cdot 10^{-31}:\\
\;\;\;\;\frac{b}{c} + \frac{-1}{\frac{c}{d \cdot \frac{a}{c}}}\\
\mathbf{elif}\;c \leq 1.6 \cdot 10^{-11}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if c < -3.8e-31Initial program 53.6%
Taylor expanded in c around inf 74.3%
+-commutative74.3%
mul-1-neg74.3%
unsub-neg74.3%
unpow274.3%
times-frac82.4%
Simplified82.4%
associate-*r/83.7%
clear-num83.7%
Applied egg-rr83.7%
if -3.8e-31 < c < 1.59999999999999997e-11Initial program 75.2%
Taylor expanded in c around 0 75.1%
+-commutative75.1%
mul-1-neg75.1%
unsub-neg75.1%
*-commutative75.1%
unpow275.1%
times-frac76.9%
Simplified76.9%
associate-*r/80.5%
sub-div82.8%
Applied egg-rr82.8%
if 1.59999999999999997e-11 < c Initial program 46.5%
*-un-lft-identity46.5%
add-sqr-sqrt46.5%
times-frac46.5%
hypot-def46.5%
hypot-def65.4%
Applied egg-rr65.4%
Taylor expanded in c around inf 80.9%
+-commutative80.9%
metadata-eval80.9%
unpow280.9%
cancel-sign-sub-inv80.9%
*-lft-identity80.9%
associate-/r*87.4%
associate-*r/89.1%
div-sub89.1%
Simplified89.1%
Final simplification84.5%
(FPCore (a b c d) :precision binary64 (if (or (<= c -4.1e-26) (not (<= c 8.5e-151))) (/ (- b (* a (/ d c))) c) (/ (- a) d)))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -4.1e-26) || !(c <= 8.5e-151)) {
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 <= (-4.1d-26)) .or. (.not. (c <= 8.5d-151))) 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 <= -4.1e-26) || !(c <= 8.5e-151)) {
tmp = (b - (a * (d / c))) / c;
} else {
tmp = -a / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -4.1e-26) or not (c <= 8.5e-151): tmp = (b - (a * (d / c))) / c else: tmp = -a / d return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -4.1e-26) || !(c <= 8.5e-151)) 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 <= -4.1e-26) || ~((c <= 8.5e-151))) tmp = (b - (a * (d / c))) / c; else tmp = -a / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -4.1e-26], N[Not[LessEqual[c, 8.5e-151]], $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 -4.1 \cdot 10^{-26} \lor \neg \left(c \leq 8.5 \cdot 10^{-151}\right):\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\
\end{array}
\end{array}
if c < -4.0999999999999999e-26 or 8.49999999999999999e-151 < c Initial program 58.0%
*-un-lft-identity58.0%
add-sqr-sqrt58.0%
times-frac58.0%
hypot-def58.0%
hypot-def72.6%
Applied egg-rr72.6%
Taylor expanded in c around inf 71.4%
+-commutative71.4%
metadata-eval71.4%
unpow271.4%
cancel-sign-sub-inv71.4%
*-lft-identity71.4%
associate-/r*75.2%
associate-*r/77.2%
div-sub77.2%
Simplified77.2%
if -4.0999999999999999e-26 < c < 8.49999999999999999e-151Initial program 70.9%
Taylor expanded in c around 0 65.5%
associate-*r/65.5%
neg-mul-165.5%
Simplified65.5%
Final simplification72.7%
(FPCore (a b c d) :precision binary64 (if (<= c -3.75e-32) (/ (- b (* d (/ a c))) c) (if (<= c 8.5e-151) (/ (- a) d) (/ (- b (* a (/ d c))) c))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -3.75e-32) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 8.5e-151) {
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 <= (-3.75d-32)) then
tmp = (b - (d * (a / c))) / c
else if (c <= 8.5d-151) 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 <= -3.75e-32) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 8.5e-151) {
tmp = -a / d;
} else {
tmp = (b - (a * (d / c))) / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -3.75e-32: tmp = (b - (d * (a / c))) / c elif c <= 8.5e-151: tmp = -a / d else: tmp = (b - (a * (d / c))) / c return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -3.75e-32) tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); elseif (c <= 8.5e-151) 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 <= -3.75e-32) tmp = (b - (d * (a / c))) / c; elseif (c <= 8.5e-151) tmp = -a / d; else tmp = (b - (a * (d / c))) / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -3.75e-32], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 8.5e-151], 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 -3.75 \cdot 10^{-32}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{elif}\;c \leq 8.5 \cdot 10^{-151}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if c < -3.74999999999999977e-32Initial program 53.6%
Taylor expanded in c around inf 74.3%
+-commutative74.3%
mul-1-neg74.3%
unsub-neg74.3%
unpow274.3%
times-frac82.4%
Simplified82.4%
associate-*r/83.7%
sub-div83.7%
Applied egg-rr83.7%
if -3.74999999999999977e-32 < c < 8.49999999999999999e-151Initial program 70.9%
Taylor expanded in c around 0 65.5%
associate-*r/65.5%
neg-mul-165.5%
Simplified65.5%
if 8.49999999999999999e-151 < c Initial program 60.9%
*-un-lft-identity60.9%
add-sqr-sqrt60.9%
times-frac60.9%
hypot-def60.9%
hypot-def75.2%
Applied egg-rr75.2%
Taylor expanded in c around inf 69.4%
+-commutative69.4%
metadata-eval69.4%
unpow269.4%
cancel-sign-sub-inv69.4%
*-lft-identity69.4%
associate-/r*73.7%
associate-*r/74.8%
div-sub74.8%
Simplified74.8%
Final simplification73.4%
(FPCore (a b c d) :precision binary64 (if (<= c -2.1e-29) (/ (- b (* d (/ a c))) c) (if (<= c 1.42e-11) (/ (- (* c (/ b d)) a) d) (/ (- b (* a (/ d c))) c))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -2.1e-29) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 1.42e-11) {
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 <= (-2.1d-29)) then
tmp = (b - (d * (a / c))) / c
else if (c <= 1.42d-11) 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 <= -2.1e-29) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 1.42e-11) {
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 <= -2.1e-29: tmp = (b - (d * (a / c))) / c elif c <= 1.42e-11: 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 <= -2.1e-29) tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); elseif (c <= 1.42e-11) 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 <= -2.1e-29) tmp = (b - (d * (a / c))) / c; elseif (c <= 1.42e-11) 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, -2.1e-29], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 1.42e-11], 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 -2.1 \cdot 10^{-29}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{elif}\;c \leq 1.42 \cdot 10^{-11}:\\
\;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if c < -2.09999999999999989e-29Initial program 53.6%
Taylor expanded in c around inf 74.3%
+-commutative74.3%
mul-1-neg74.3%
unsub-neg74.3%
unpow274.3%
times-frac82.4%
Simplified82.4%
associate-*r/83.7%
sub-div83.7%
Applied egg-rr83.7%
if -2.09999999999999989e-29 < c < 1.42e-11Initial program 75.2%
Taylor expanded in c around 0 75.1%
+-commutative75.1%
mul-1-neg75.1%
unsub-neg75.1%
*-commutative75.1%
unpow275.1%
times-frac76.9%
Simplified76.9%
Taylor expanded in c around 0 75.1%
neg-mul-175.1%
unpow275.1%
times-frac76.9%
*-commutative76.9%
+-commutative76.9%
unsub-neg76.9%
associate-*l/77.6%
div-sub79.9%
Simplified79.9%
if 1.42e-11 < c Initial program 46.5%
*-un-lft-identity46.5%
add-sqr-sqrt46.5%
times-frac46.5%
hypot-def46.5%
hypot-def65.4%
Applied egg-rr65.4%
Taylor expanded in c around inf 80.9%
+-commutative80.9%
metadata-eval80.9%
unpow280.9%
cancel-sign-sub-inv80.9%
*-lft-identity80.9%
associate-/r*87.4%
associate-*r/89.1%
div-sub89.1%
Simplified89.1%
Final simplification83.0%
(FPCore (a b c d) :precision binary64 (if (<= c -8.2e-32) (/ (- b (* d (/ a c))) c) (if (<= c 1.18e-11) (/ (- (* b (/ c d)) a) d) (/ (- b (* a (/ d c))) c))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -8.2e-32) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 1.18e-11) {
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 <= (-8.2d-32)) then
tmp = (b - (d * (a / c))) / c
else if (c <= 1.18d-11) 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 <= -8.2e-32) {
tmp = (b - (d * (a / c))) / c;
} else if (c <= 1.18e-11) {
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 <= -8.2e-32: tmp = (b - (d * (a / c))) / c elif c <= 1.18e-11: 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 <= -8.2e-32) tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c); elseif (c <= 1.18e-11) 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 <= -8.2e-32) tmp = (b - (d * (a / c))) / c; elseif (c <= 1.18e-11) 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, -8.2e-32], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 1.18e-11], 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 -8.2 \cdot 10^{-32}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\
\mathbf{elif}\;c \leq 1.18 \cdot 10^{-11}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\
\end{array}
\end{array}
if c < -8.1999999999999995e-32Initial program 53.6%
Taylor expanded in c around inf 74.3%
+-commutative74.3%
mul-1-neg74.3%
unsub-neg74.3%
unpow274.3%
times-frac82.4%
Simplified82.4%
associate-*r/83.7%
sub-div83.7%
Applied egg-rr83.7%
if -8.1999999999999995e-32 < c < 1.18e-11Initial program 75.2%
Taylor expanded in c around 0 75.1%
+-commutative75.1%
mul-1-neg75.1%
unsub-neg75.1%
*-commutative75.1%
unpow275.1%
times-frac76.9%
Simplified76.9%
associate-*r/80.5%
sub-div82.8%
Applied egg-rr82.8%
if 1.18e-11 < c Initial program 46.5%
*-un-lft-identity46.5%
add-sqr-sqrt46.5%
times-frac46.5%
hypot-def46.5%
hypot-def65.4%
Applied egg-rr65.4%
Taylor expanded in c around inf 80.9%
+-commutative80.9%
metadata-eval80.9%
unpow280.9%
cancel-sign-sub-inv80.9%
*-lft-identity80.9%
associate-/r*87.4%
associate-*r/89.1%
div-sub89.1%
Simplified89.1%
Final simplification84.5%
(FPCore (a b c d) :precision binary64 (if (<= c -1.2e-26) (/ b c) (if (<= c 8.2e-151) (/ (- a) d) (/ b c))))
double code(double a, double b, double c, double d) {
double tmp;
if (c <= -1.2e-26) {
tmp = b / c;
} else if (c <= 8.2e-151) {
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 <= (-1.2d-26)) then
tmp = b / c
else if (c <= 8.2d-151) 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 <= -1.2e-26) {
tmp = b / c;
} else if (c <= 8.2e-151) {
tmp = -a / d;
} else {
tmp = b / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if c <= -1.2e-26: tmp = b / c elif c <= 8.2e-151: tmp = -a / d else: tmp = b / c return tmp
function code(a, b, c, d) tmp = 0.0 if (c <= -1.2e-26) tmp = Float64(b / c); elseif (c <= 8.2e-151) 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 <= -1.2e-26) tmp = b / c; elseif (c <= 8.2e-151) tmp = -a / d; else tmp = b / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[LessEqual[c, -1.2e-26], N[(b / c), $MachinePrecision], If[LessEqual[c, 8.2e-151], N[((-a) / d), $MachinePrecision], N[(b / c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.2 \cdot 10^{-26}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;c \leq 8.2 \cdot 10^{-151}:\\
\;\;\;\;\frac{-a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\end{array}
if c < -1.2e-26 or 8.2000000000000002e-151 < c Initial program 58.0%
Taylor expanded in c around inf 64.0%
if -1.2e-26 < c < 8.2000000000000002e-151Initial program 70.9%
Taylor expanded in c around 0 65.5%
associate-*r/65.5%
neg-mul-165.5%
Simplified65.5%
Final simplification64.6%
(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 63.0%
*-un-lft-identity63.0%
add-sqr-sqrt63.0%
times-frac63.0%
hypot-def63.0%
hypot-def77.4%
Applied egg-rr77.4%
Taylor expanded in c around inf 37.4%
mul-1-neg37.4%
associate-*l/37.6%
sub-neg37.6%
*-commutative37.6%
Simplified37.6%
Taylor expanded in d around -inf 9.9%
Final simplification9.9%
(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 63.0%
Taylor expanded in c around inf 45.5%
Final simplification45.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 2023279
(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))))