
(FPCore (a b c d) :precision binary64 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = ((b * c) - (a * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d): return ((b * c) - (a * d)) / ((c * c) + (d * d))
function code(a, b, c, d) return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))) end
function tmp = code(a, b, c, d) tmp = ((b * c) - (a * d)) / ((c * c) + (d * d)); end
code[a_, b_, c_, d_] := N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c d) :precision binary64 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = ((b * c) - (a * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d): return ((b * c) - (a * d)) / ((c * c) + (d * d))
function code(a, b, c, d) return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))) end
function tmp = code(a, b, c, d) tmp = ((b * c) - (a * d)) / ((c * c) + (d * d)); end
code[a_, b_, c_, d_] := N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\end{array}
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* b c) (* a d))))
(if (<= (/ t_0 (+ (* c c) (* d d))) INFINITY)
(* (/ 1.0 (hypot c d)) (/ t_0 (hypot c d)))
(- (/ b c) (/ (* d (/ a 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 / c) - ((d * (a / 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 / c) - ((d * (a / 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 / c) - ((d * (a / 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 / c) - Float64(Float64(d * Float64(a / 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 / c) - ((d * (a / 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 / c), $MachinePrecision] - N[(N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot c - a \cdot d\\
\mathbf{if}\;\frac{t\_0}{c \cdot c + d \cdot d} \leq \infty:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{t\_0}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{d \cdot \frac{a}{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 76.8%
*-un-lft-identity76.8%
add-sqr-sqrt76.8%
times-frac76.8%
hypot-def76.8%
hypot-def93.3%
Applied egg-rr93.3%
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.7%
Applied egg-rr2.7%
Taylor expanded in c around inf 39.2%
+-commutative39.2%
mul-1-neg39.2%
unsub-neg39.2%
*-lft-identity39.2%
times-frac46.5%
/-rgt-identity46.5%
Simplified46.5%
*-un-lft-identity46.5%
unpow246.5%
times-frac58.0%
Applied egg-rr58.0%
associate-*r*59.8%
associate-*r/59.8%
un-div-inv59.9%
Applied egg-rr59.9%
Final simplification89.5%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* b c) (* a d))) (t_1 (- (/ b c) (/ (* d (/ a c)) c))))
(if (<= c -2.5e+44)
t_1
(if (<= c -4.6e-234)
(/ (+ t_0 (* 2.0 (fma a (- d) (* a d)))) (+ (* c c) (* d d)))
(if (<= c 5.8e-140)
(- (* b (/ (/ c d) d)) (/ a d))
(if (<= c 7.6e+114) (* t_0 (pow (hypot c d) -2.0)) t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = (b * c) - (a * d);
double t_1 = (b / c) - ((d * (a / c)) / c);
double tmp;
if (c <= -2.5e+44) {
tmp = t_1;
} else if (c <= -4.6e-234) {
tmp = (t_0 + (2.0 * fma(a, -d, (a * d)))) / ((c * c) + (d * d));
} else if (c <= 5.8e-140) {
tmp = (b * ((c / d) / d)) - (a / d);
} else if (c <= 7.6e+114) {
tmp = t_0 * pow(hypot(c, d), -2.0);
} else {
tmp = t_1;
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(Float64(b * c) - Float64(a * d)) t_1 = Float64(Float64(b / c) - Float64(Float64(d * Float64(a / c)) / c)) tmp = 0.0 if (c <= -2.5e+44) tmp = t_1; elseif (c <= -4.6e-234) tmp = Float64(Float64(t_0 + Float64(2.0 * fma(a, Float64(-d), Float64(a * d)))) / Float64(Float64(c * c) + Float64(d * d))); elseif (c <= 5.8e-140) tmp = Float64(Float64(b * Float64(Float64(c / d) / d)) - Float64(a / d)); elseif (c <= 7.6e+114) tmp = Float64(t_0 * (hypot(c, d) ^ -2.0)); else tmp = t_1; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b / c), $MachinePrecision] - N[(N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.5e+44], t$95$1, If[LessEqual[c, -4.6e-234], N[(N[(t$95$0 + N[(2.0 * N[(a * (-d) + N[(a * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 5.8e-140], N[(N[(b * N[(N[(c / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 7.6e+114], N[(t$95$0 * N[Power[N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot c - a \cdot d\\
t_1 := \frac{b}{c} - \frac{d \cdot \frac{a}{c}}{c}\\
\mathbf{if}\;c \leq -2.5 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -4.6 \cdot 10^{-234}:\\
\;\;\;\;\frac{t\_0 + 2 \cdot \mathsf{fma}\left(a, -d, a \cdot d\right)}{c \cdot c + d \cdot d}\\
\mathbf{elif}\;c \leq 5.8 \cdot 10^{-140}:\\
\;\;\;\;b \cdot \frac{\frac{c}{d}}{d} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 7.6 \cdot 10^{+114}:\\
\;\;\;\;t\_0 \cdot {\left(\mathsf{hypot}\left(c, d\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -2.4999999999999998e44 or 7.6000000000000001e114 < c Initial program 48.7%
*-un-lft-identity48.7%
add-sqr-sqrt48.7%
times-frac48.7%
hypot-def48.7%
hypot-def70.0%
Applied egg-rr70.0%
Taylor expanded in c around inf 74.6%
+-commutative74.6%
mul-1-neg74.6%
unsub-neg74.6%
*-lft-identity74.6%
times-frac77.0%
/-rgt-identity77.0%
Simplified77.0%
*-un-lft-identity77.0%
unpow277.0%
times-frac77.4%
Applied egg-rr77.4%
associate-*r*82.9%
associate-*r/84.5%
un-div-inv84.6%
Applied egg-rr84.6%
if -2.4999999999999998e44 < c < -4.59999999999999981e-234Initial program 87.9%
prod-diff87.9%
*-commutative87.9%
fma-neg87.9%
prod-diff87.9%
*-commutative87.9%
fma-neg87.9%
associate-+l+87.9%
*-commutative87.9%
fma-udef87.9%
distribute-lft-neg-in87.9%
*-commutative87.9%
distribute-rgt-neg-in87.9%
fma-def87.9%
*-commutative87.9%
fma-udef87.9%
distribute-lft-neg-in87.9%
*-commutative87.9%
distribute-rgt-neg-in87.9%
fma-def87.9%
Applied egg-rr87.9%
*-commutative87.9%
count-287.9%
Simplified87.9%
if -4.59999999999999981e-234 < c < 5.79999999999999995e-140Initial program 71.2%
Taylor expanded in c around 0 81.1%
+-commutative81.1%
mul-1-neg81.1%
unsub-neg81.1%
associate-/l*81.3%
Simplified81.3%
pow281.3%
*-un-lft-identity81.3%
times-frac95.6%
Applied egg-rr95.6%
clear-num95.7%
associate-/r/95.6%
/-rgt-identity95.6%
*-commutative95.6%
associate-/r*95.6%
clear-num95.6%
Applied egg-rr95.6%
if 5.79999999999999995e-140 < c < 7.6000000000000001e114Initial program 77.9%
clear-num77.9%
associate-/r/77.8%
add-sqr-sqrt77.8%
pow277.8%
hypot-def77.8%
Applied egg-rr77.8%
expm1-log1p-u75.8%
expm1-udef38.2%
pow-flip38.2%
metadata-eval38.2%
Applied egg-rr38.2%
expm1-def76.5%
expm1-log1p78.6%
Simplified78.6%
Final simplification86.8%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* b c) (* a d)))
(t_1 (- (/ b c) (/ (* d (/ a c)) c)))
(t_2 (+ (* c c) (* d d))))
(if (<= c -2.1e+44)
t_1
(if (<= c -8.2e-234)
(/ (+ t_0 (* 2.0 (fma a (- d) (* a d)))) t_2)
(if (<= c 2.4e-77)
(- (* (/ 1.0 d) (/ b (/ d c))) (/ a d))
(if (<= c 3.3e+115) (/ t_0 t_2) t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = (b * c) - (a * d);
double t_1 = (b / c) - ((d * (a / c)) / c);
double t_2 = (c * c) + (d * d);
double tmp;
if (c <= -2.1e+44) {
tmp = t_1;
} else if (c <= -8.2e-234) {
tmp = (t_0 + (2.0 * fma(a, -d, (a * d)))) / t_2;
} else if (c <= 2.4e-77) {
tmp = ((1.0 / d) * (b / (d / c))) - (a / d);
} else if (c <= 3.3e+115) {
tmp = t_0 / t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(Float64(b * c) - Float64(a * d)) t_1 = Float64(Float64(b / c) - Float64(Float64(d * Float64(a / c)) / c)) t_2 = Float64(Float64(c * c) + Float64(d * d)) tmp = 0.0 if (c <= -2.1e+44) tmp = t_1; elseif (c <= -8.2e-234) tmp = Float64(Float64(t_0 + Float64(2.0 * fma(a, Float64(-d), Float64(a * d)))) / t_2); elseif (c <= 2.4e-77) tmp = Float64(Float64(Float64(1.0 / d) * Float64(b / Float64(d / c))) - Float64(a / d)); elseif (c <= 3.3e+115) tmp = Float64(t_0 / t_2); else tmp = t_1; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b / c), $MachinePrecision] - N[(N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.1e+44], t$95$1, If[LessEqual[c, -8.2e-234], N[(N[(t$95$0 + N[(2.0 * N[(a * (-d) + N[(a * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[c, 2.4e-77], N[(N[(N[(1.0 / d), $MachinePrecision] * N[(b / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 3.3e+115], N[(t$95$0 / t$95$2), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot c - a \cdot d\\
t_1 := \frac{b}{c} - \frac{d \cdot \frac{a}{c}}{c}\\
t_2 := c \cdot c + d \cdot d\\
\mathbf{if}\;c \leq -2.1 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -8.2 \cdot 10^{-234}:\\
\;\;\;\;\frac{t\_0 + 2 \cdot \mathsf{fma}\left(a, -d, a \cdot d\right)}{t\_2}\\
\mathbf{elif}\;c \leq 2.4 \cdot 10^{-77}:\\
\;\;\;\;\frac{1}{d} \cdot \frac{b}{\frac{d}{c}} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 3.3 \cdot 10^{+115}:\\
\;\;\;\;\frac{t\_0}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -2.09999999999999987e44 or 3.30000000000000005e115 < c Initial program 48.7%
*-un-lft-identity48.7%
add-sqr-sqrt48.7%
times-frac48.7%
hypot-def48.7%
hypot-def70.0%
Applied egg-rr70.0%
Taylor expanded in c around inf 74.6%
+-commutative74.6%
mul-1-neg74.6%
unsub-neg74.6%
*-lft-identity74.6%
times-frac77.0%
/-rgt-identity77.0%
Simplified77.0%
*-un-lft-identity77.0%
unpow277.0%
times-frac77.4%
Applied egg-rr77.4%
associate-*r*82.9%
associate-*r/84.5%
un-div-inv84.6%
Applied egg-rr84.6%
if -2.09999999999999987e44 < c < -8.20000000000000021e-234Initial program 87.9%
prod-diff87.9%
*-commutative87.9%
fma-neg87.9%
prod-diff87.9%
*-commutative87.9%
fma-neg87.9%
associate-+l+87.9%
*-commutative87.9%
fma-udef87.9%
distribute-lft-neg-in87.9%
*-commutative87.9%
distribute-rgt-neg-in87.9%
fma-def87.9%
*-commutative87.9%
fma-udef87.9%
distribute-lft-neg-in87.9%
*-commutative87.9%
distribute-rgt-neg-in87.9%
fma-def87.9%
Applied egg-rr87.9%
*-commutative87.9%
count-287.9%
Simplified87.9%
if -8.20000000000000021e-234 < c < 2.3999999999999999e-77Initial program 72.6%
Taylor expanded in c around 0 79.5%
+-commutative79.5%
mul-1-neg79.5%
unsub-neg79.5%
associate-/l*79.7%
Simplified79.7%
pow279.7%
*-un-lft-identity79.7%
times-frac90.9%
Applied egg-rr90.9%
/-rgt-identity90.9%
*-un-lft-identity90.9%
times-frac92.1%
Applied egg-rr92.1%
if 2.3999999999999999e-77 < c < 3.30000000000000005e115Initial program 77.8%
Final simplification86.7%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
(t_1 (- (/ b c) (/ (* d (/ a c)) c))))
(if (<= c -2.1e+44)
t_1
(if (<= c -8.2e-234)
t_0
(if (<= c 2.5e-77)
(- (* (/ 1.0 d) (/ b (/ d c))) (/ a d))
(if (<= c 8.7e+114) t_0 t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d));
double t_1 = (b / c) - ((d * (a / c)) / c);
double tmp;
if (c <= -2.1e+44) {
tmp = t_1;
} else if (c <= -8.2e-234) {
tmp = t_0;
} else if (c <= 2.5e-77) {
tmp = ((1.0 / d) * (b / (d / c))) - (a / d);
} else if (c <= 8.7e+114) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d))
t_1 = (b / c) - ((d * (a / c)) / c)
if (c <= (-2.1d+44)) then
tmp = t_1
else if (c <= (-8.2d-234)) then
tmp = t_0
else if (c <= 2.5d-77) then
tmp = ((1.0d0 / d) * (b / (d / c))) - (a / d)
else if (c <= 8.7d+114) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d));
double t_1 = (b / c) - ((d * (a / c)) / c);
double tmp;
if (c <= -2.1e+44) {
tmp = t_1;
} else if (c <= -8.2e-234) {
tmp = t_0;
} else if (c <= 2.5e-77) {
tmp = ((1.0 / d) * (b / (d / c))) - (a / d);
} else if (c <= 8.7e+114) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(a, b, c, d): t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d)) t_1 = (b / c) - ((d * (a / c)) / c) tmp = 0 if c <= -2.1e+44: tmp = t_1 elif c <= -8.2e-234: tmp = t_0 elif c <= 2.5e-77: tmp = ((1.0 / d) * (b / (d / c))) - (a / d) elif c <= 8.7e+114: tmp = t_0 else: tmp = t_1 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))) t_1 = Float64(Float64(b / c) - Float64(Float64(d * Float64(a / c)) / c)) tmp = 0.0 if (c <= -2.1e+44) tmp = t_1; elseif (c <= -8.2e-234) tmp = t_0; elseif (c <= 2.5e-77) tmp = Float64(Float64(Float64(1.0 / d) * Float64(b / Float64(d / c))) - Float64(a / d)); elseif (c <= 8.7e+114) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d)); t_1 = (b / c) - ((d * (a / c)) / c); tmp = 0.0; if (c <= -2.1e+44) tmp = t_1; elseif (c <= -8.2e-234) tmp = t_0; elseif (c <= 2.5e-77) tmp = ((1.0 / d) * (b / (d / c))) - (a / d); elseif (c <= 8.7e+114) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b / c), $MachinePrecision] - N[(N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.1e+44], t$95$1, If[LessEqual[c, -8.2e-234], t$95$0, If[LessEqual[c, 2.5e-77], N[(N[(N[(1.0 / d), $MachinePrecision] * N[(b / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 8.7e+114], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\
t_1 := \frac{b}{c} - \frac{d \cdot \frac{a}{c}}{c}\\
\mathbf{if}\;c \leq -2.1 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -8.2 \cdot 10^{-234}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;c \leq 2.5 \cdot 10^{-77}:\\
\;\;\;\;\frac{1}{d} \cdot \frac{b}{\frac{d}{c}} - \frac{a}{d}\\
\mathbf{elif}\;c \leq 8.7 \cdot 10^{+114}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if c < -2.09999999999999987e44 or 8.7000000000000001e114 < c Initial program 48.7%
*-un-lft-identity48.7%
add-sqr-sqrt48.7%
times-frac48.7%
hypot-def48.7%
hypot-def70.0%
Applied egg-rr70.0%
Taylor expanded in c around inf 74.6%
+-commutative74.6%
mul-1-neg74.6%
unsub-neg74.6%
*-lft-identity74.6%
times-frac77.0%
/-rgt-identity77.0%
Simplified77.0%
*-un-lft-identity77.0%
unpow277.0%
times-frac77.4%
Applied egg-rr77.4%
associate-*r*82.9%
associate-*r/84.5%
un-div-inv84.6%
Applied egg-rr84.6%
if -2.09999999999999987e44 < c < -8.20000000000000021e-234 or 2.49999999999999982e-77 < c < 8.7000000000000001e114Initial program 83.7%
if -8.20000000000000021e-234 < c < 2.49999999999999982e-77Initial program 72.6%
Taylor expanded in c around 0 79.5%
+-commutative79.5%
mul-1-neg79.5%
unsub-neg79.5%
associate-/l*79.7%
Simplified79.7%
pow279.7%
*-un-lft-identity79.7%
times-frac90.9%
Applied egg-rr90.9%
/-rgt-identity90.9%
*-un-lft-identity90.9%
times-frac92.1%
Applied egg-rr92.1%
Final simplification86.7%
(FPCore (a b c d) :precision binary64 (if (or (<= c -6.5e+48) (not (<= c 7.2e-72))) (- (/ b c) (/ (* d (/ a c)) c)) (- (* (/ 1.0 d) (/ b (/ d c))) (/ a d))))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -6.5e+48) || !(c <= 7.2e-72)) {
tmp = (b / c) - ((d * (a / c)) / c);
} else {
tmp = ((1.0 / d) * (b / (d / c))) - (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 <= (-6.5d+48)) .or. (.not. (c <= 7.2d-72))) then
tmp = (b / c) - ((d * (a / c)) / c)
else
tmp = ((1.0d0 / d) * (b / (d / c))) - (a / d)
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -6.5e+48) || !(c <= 7.2e-72)) {
tmp = (b / c) - ((d * (a / c)) / c);
} else {
tmp = ((1.0 / d) * (b / (d / c))) - (a / d);
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -6.5e+48) or not (c <= 7.2e-72): tmp = (b / c) - ((d * (a / c)) / c) else: tmp = ((1.0 / d) * (b / (d / c))) - (a / d) return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -6.5e+48) || !(c <= 7.2e-72)) tmp = Float64(Float64(b / c) - Float64(Float64(d * Float64(a / c)) / c)); else tmp = Float64(Float64(Float64(1.0 / d) * Float64(b / Float64(d / c))) - Float64(a / d)); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((c <= -6.5e+48) || ~((c <= 7.2e-72))) tmp = (b / c) - ((d * (a / c)) / c); else tmp = ((1.0 / d) * (b / (d / c))) - (a / d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -6.5e+48], N[Not[LessEqual[c, 7.2e-72]], $MachinePrecision]], N[(N[(b / c), $MachinePrecision] - N[(N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / d), $MachinePrecision] * N[(b / N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -6.5 \cdot 10^{+48} \lor \neg \left(c \leq 7.2 \cdot 10^{-72}\right):\\
\;\;\;\;\frac{b}{c} - \frac{d \cdot \frac{a}{c}}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{d} \cdot \frac{b}{\frac{d}{c}} - \frac{a}{d}\\
\end{array}
\end{array}
if c < -6.49999999999999972e48 or 7.2e-72 < c Initial program 57.9%
*-un-lft-identity57.9%
add-sqr-sqrt57.9%
times-frac57.8%
hypot-def57.8%
hypot-def74.9%
Applied egg-rr74.9%
Taylor expanded in c around inf 71.3%
+-commutative71.3%
mul-1-neg71.3%
unsub-neg71.3%
*-lft-identity71.3%
times-frac72.3%
/-rgt-identity72.3%
Simplified72.3%
*-un-lft-identity72.3%
unpow272.3%
times-frac72.6%
Applied egg-rr72.6%
associate-*r*77.4%
associate-*r/78.5%
un-div-inv78.5%
Applied egg-rr78.5%
if -6.49999999999999972e48 < c < 7.2e-72Initial program 77.2%
Taylor expanded in c around 0 76.6%
+-commutative76.6%
mul-1-neg76.6%
unsub-neg76.6%
associate-/l*74.9%
Simplified74.9%
pow274.9%
*-un-lft-identity74.9%
times-frac81.8%
Applied egg-rr81.8%
/-rgt-identity81.8%
*-un-lft-identity81.8%
times-frac83.7%
Applied egg-rr83.7%
Final simplification81.2%
(FPCore (a b c d) :precision binary64 (if (or (<= c -1.05e+51) (not (<= c 1.1e+62))) (/ b c) (- (* (/ c d) (/ b d)) (/ a d))))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -1.05e+51) || !(c <= 1.1e+62)) {
tmp = b / c;
} else {
tmp = ((c / d) * (b / d)) - (a / d);
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((c <= (-1.05d+51)) .or. (.not. (c <= 1.1d+62))) then
tmp = b / c
else
tmp = ((c / d) * (b / d)) - (a / d)
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -1.05e+51) || !(c <= 1.1e+62)) {
tmp = b / c;
} else {
tmp = ((c / d) * (b / d)) - (a / d);
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -1.05e+51) or not (c <= 1.1e+62): tmp = b / c else: tmp = ((c / d) * (b / d)) - (a / d) return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -1.05e+51) || !(c <= 1.1e+62)) tmp = Float64(b / c); else tmp = Float64(Float64(Float64(c / d) * Float64(b / d)) - Float64(a / d)); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((c <= -1.05e+51) || ~((c <= 1.1e+62))) tmp = b / c; else tmp = ((c / d) * (b / d)) - (a / d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -1.05e+51], N[Not[LessEqual[c, 1.1e+62]], $MachinePrecision]], N[(b / c), $MachinePrecision], N[(N[(N[(c / d), $MachinePrecision] * N[(b / d), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.05 \cdot 10^{+51} \lor \neg \left(c \leq 1.1 \cdot 10^{+62}\right):\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\
\end{array}
\end{array}
if c < -1.0500000000000001e51 or 1.10000000000000007e62 < c Initial program 52.0%
Taylor expanded in c around inf 67.3%
if -1.0500000000000001e51 < c < 1.10000000000000007e62Initial program 77.1%
Taylor expanded in c around 0 71.7%
+-commutative71.7%
mul-1-neg71.7%
unsub-neg71.7%
associate-/l*70.4%
Simplified70.4%
pow270.4%
*-un-lft-identity70.4%
times-frac76.0%
Applied egg-rr76.0%
/-rgt-identity76.0%
*-un-lft-identity76.0%
*-commutative76.0%
times-frac74.1%
clear-num74.1%
Applied egg-rr74.1%
Final simplification71.6%
(FPCore (a b c d) :precision binary64 (if (or (<= c -4.5e+51) (not (<= c 2.3e+63))) (/ b c) (- (* b (/ (/ c d) d)) (/ a d))))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -4.5e+51) || !(c <= 2.3e+63)) {
tmp = b / c;
} else {
tmp = (b * ((c / d) / d)) - (a / d);
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((c <= (-4.5d+51)) .or. (.not. (c <= 2.3d+63))) then
tmp = b / c
else
tmp = (b * ((c / d) / d)) - (a / d)
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -4.5e+51) || !(c <= 2.3e+63)) {
tmp = b / c;
} else {
tmp = (b * ((c / d) / d)) - (a / d);
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -4.5e+51) or not (c <= 2.3e+63): tmp = b / c else: tmp = (b * ((c / d) / d)) - (a / d) return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -4.5e+51) || !(c <= 2.3e+63)) tmp = Float64(b / c); else tmp = Float64(Float64(b * Float64(Float64(c / d) / d)) - Float64(a / d)); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((c <= -4.5e+51) || ~((c <= 2.3e+63))) tmp = b / c; else tmp = (b * ((c / d) / d)) - (a / d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -4.5e+51], N[Not[LessEqual[c, 2.3e+63]], $MachinePrecision]], N[(b / c), $MachinePrecision], N[(N[(b * N[(N[(c / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -4.5 \cdot 10^{+51} \lor \neg \left(c \leq 2.3 \cdot 10^{+63}\right):\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;b \cdot \frac{\frac{c}{d}}{d} - \frac{a}{d}\\
\end{array}
\end{array}
if c < -4.5e51 or 2.29999999999999993e63 < c Initial program 52.0%
Taylor expanded in c around inf 67.3%
if -4.5e51 < c < 2.29999999999999993e63Initial program 77.1%
Taylor expanded in c around 0 71.7%
+-commutative71.7%
mul-1-neg71.7%
unsub-neg71.7%
associate-/l*70.4%
Simplified70.4%
pow270.4%
*-un-lft-identity70.4%
times-frac76.0%
Applied egg-rr76.0%
clear-num76.1%
associate-/r/76.0%
/-rgt-identity76.0%
*-commutative76.0%
associate-/r*76.6%
clear-num76.6%
Applied egg-rr76.6%
Final simplification73.2%
(FPCore (a b c d) :precision binary64 (if (or (<= c -8e+48) (not (<= c 5.4e-72))) (- (/ b c) (* a (/ (/ d c) c))) (- (* b (/ (/ c d) d)) (/ a d))))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -8e+48) || !(c <= 5.4e-72)) {
tmp = (b / c) - (a * ((d / c) / c));
} else {
tmp = (b * ((c / d) / d)) - (a / d);
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((c <= (-8d+48)) .or. (.not. (c <= 5.4d-72))) then
tmp = (b / c) - (a * ((d / c) / c))
else
tmp = (b * ((c / d) / d)) - (a / d)
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -8e+48) || !(c <= 5.4e-72)) {
tmp = (b / c) - (a * ((d / c) / c));
} else {
tmp = (b * ((c / d) / d)) - (a / d);
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -8e+48) or not (c <= 5.4e-72): tmp = (b / c) - (a * ((d / c) / c)) else: tmp = (b * ((c / d) / d)) - (a / d) return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -8e+48) || !(c <= 5.4e-72)) tmp = Float64(Float64(b / c) - Float64(a * Float64(Float64(d / c) / c))); else tmp = Float64(Float64(b * Float64(Float64(c / d) / d)) - Float64(a / d)); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((c <= -8e+48) || ~((c <= 5.4e-72))) tmp = (b / c) - (a * ((d / c) / c)); else tmp = (b * ((c / d) / d)) - (a / d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -8e+48], N[Not[LessEqual[c, 5.4e-72]], $MachinePrecision]], N[(N[(b / c), $MachinePrecision] - N[(a * N[(N[(d / c), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(N[(c / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -8 \cdot 10^{+48} \lor \neg \left(c \leq 5.4 \cdot 10^{-72}\right):\\
\;\;\;\;\frac{b}{c} - a \cdot \frac{\frac{d}{c}}{c}\\
\mathbf{else}:\\
\;\;\;\;b \cdot \frac{\frac{c}{d}}{d} - \frac{a}{d}\\
\end{array}
\end{array}
if c < -8.00000000000000035e48 or 5.4e-72 < c Initial program 57.9%
*-un-lft-identity57.9%
add-sqr-sqrt57.9%
times-frac57.8%
hypot-def57.8%
hypot-def74.9%
Applied egg-rr74.9%
Taylor expanded in c around inf 71.3%
+-commutative71.3%
mul-1-neg71.3%
unsub-neg71.3%
*-lft-identity71.3%
times-frac72.3%
/-rgt-identity72.3%
Simplified72.3%
*-un-lft-identity72.3%
unpow272.3%
times-frac72.6%
Applied egg-rr72.6%
associate-*l/72.6%
*-lft-identity72.6%
Simplified72.6%
if -8.00000000000000035e48 < c < 5.4e-72Initial program 77.2%
Taylor expanded in c around 0 76.6%
+-commutative76.6%
mul-1-neg76.6%
unsub-neg76.6%
associate-/l*74.9%
Simplified74.9%
pow274.9%
*-un-lft-identity74.9%
times-frac81.8%
Applied egg-rr81.8%
clear-num81.9%
associate-/r/81.8%
/-rgt-identity81.8%
*-commutative81.8%
associate-/r*82.5%
clear-num82.5%
Applied egg-rr82.5%
Final simplification77.8%
(FPCore (a b c d) :precision binary64 (if (or (<= c -6.5e+48) (not (<= c 1.2e-72))) (- (/ b c) (/ (* d (/ a c)) c)) (- (* b (/ (/ c d) d)) (/ a d))))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -6.5e+48) || !(c <= 1.2e-72)) {
tmp = (b / c) - ((d * (a / c)) / c);
} else {
tmp = (b * ((c / d) / d)) - (a / d);
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: tmp
if ((c <= (-6.5d+48)) .or. (.not. (c <= 1.2d-72))) then
tmp = (b / c) - ((d * (a / c)) / c)
else
tmp = (b * ((c / d) / d)) - (a / d)
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -6.5e+48) || !(c <= 1.2e-72)) {
tmp = (b / c) - ((d * (a / c)) / c);
} else {
tmp = (b * ((c / d) / d)) - (a / d);
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -6.5e+48) or not (c <= 1.2e-72): tmp = (b / c) - ((d * (a / c)) / c) else: tmp = (b * ((c / d) / d)) - (a / d) return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -6.5e+48) || !(c <= 1.2e-72)) tmp = Float64(Float64(b / c) - Float64(Float64(d * Float64(a / c)) / c)); else tmp = Float64(Float64(b * Float64(Float64(c / d) / d)) - Float64(a / d)); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((c <= -6.5e+48) || ~((c <= 1.2e-72))) tmp = (b / c) - ((d * (a / c)) / c); else tmp = (b * ((c / d) / d)) - (a / d); end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -6.5e+48], N[Not[LessEqual[c, 1.2e-72]], $MachinePrecision]], N[(N[(b / c), $MachinePrecision] - N[(N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(N[(c / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] - N[(a / d), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -6.5 \cdot 10^{+48} \lor \neg \left(c \leq 1.2 \cdot 10^{-72}\right):\\
\;\;\;\;\frac{b}{c} - \frac{d \cdot \frac{a}{c}}{c}\\
\mathbf{else}:\\
\;\;\;\;b \cdot \frac{\frac{c}{d}}{d} - \frac{a}{d}\\
\end{array}
\end{array}
if c < -6.49999999999999972e48 or 1.2e-72 < c Initial program 57.9%
*-un-lft-identity57.9%
add-sqr-sqrt57.9%
times-frac57.8%
hypot-def57.8%
hypot-def74.9%
Applied egg-rr74.9%
Taylor expanded in c around inf 71.3%
+-commutative71.3%
mul-1-neg71.3%
unsub-neg71.3%
*-lft-identity71.3%
times-frac72.3%
/-rgt-identity72.3%
Simplified72.3%
*-un-lft-identity72.3%
unpow272.3%
times-frac72.6%
Applied egg-rr72.6%
associate-*r*77.4%
associate-*r/78.5%
un-div-inv78.5%
Applied egg-rr78.5%
if -6.49999999999999972e48 < c < 1.2e-72Initial program 77.2%
Taylor expanded in c around 0 76.6%
+-commutative76.6%
mul-1-neg76.6%
unsub-neg76.6%
associate-/l*74.9%
Simplified74.9%
pow274.9%
*-un-lft-identity74.9%
times-frac81.8%
Applied egg-rr81.8%
clear-num81.9%
associate-/r/81.8%
/-rgt-identity81.8%
*-commutative81.8%
associate-/r*82.5%
clear-num82.5%
Applied egg-rr82.5%
Final simplification80.6%
(FPCore (a b c d) :precision binary64 (if (or (<= c -0.0132) (not (<= c 2e+46))) (/ b c) (/ (- a) d)))
double code(double a, double b, double c, double d) {
double tmp;
if ((c <= -0.0132) || !(c <= 2e+46)) {
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 <= (-0.0132d0)) .or. (.not. (c <= 2d+46))) 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 <= -0.0132) || !(c <= 2e+46)) {
tmp = b / c;
} else {
tmp = -a / d;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (c <= -0.0132) or not (c <= 2e+46): tmp = b / c else: tmp = -a / d return tmp
function code(a, b, c, d) tmp = 0.0 if ((c <= -0.0132) || !(c <= 2e+46)) 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 <= -0.0132) || ~((c <= 2e+46))) tmp = b / c; else tmp = -a / d; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[c, -0.0132], N[Not[LessEqual[c, 2e+46]], $MachinePrecision]], N[(b / c), $MachinePrecision], N[((-a) / d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -0.0132 \lor \neg \left(c \leq 2 \cdot 10^{+46}\right):\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\
\end{array}
\end{array}
if c < -0.0132 or 2e46 < c Initial program 54.2%
Taylor expanded in c around inf 63.8%
if -0.0132 < c < 2e46Initial program 78.0%
Taylor expanded in c around 0 63.2%
associate-*r/63.2%
neg-mul-163.2%
Simplified63.2%
Final simplification63.5%
(FPCore (a b c d) :precision binary64 (if (or (<= d -3.8e+129) (not (<= d 7.8e+105))) (/ a d) (/ a c)))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -3.8e+129) || !(d <= 7.8e+105)) {
tmp = a / d;
} else {
tmp = a / 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.8d+129)) .or. (.not. (d <= 7.8d+105))) then
tmp = a / d
else
tmp = a / c
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -3.8e+129) || !(d <= 7.8e+105)) {
tmp = a / d;
} else {
tmp = a / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -3.8e+129) or not (d <= 7.8e+105): tmp = a / d else: tmp = a / c return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -3.8e+129) || !(d <= 7.8e+105)) tmp = Float64(a / d); else tmp = Float64(a / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((d <= -3.8e+129) || ~((d <= 7.8e+105))) tmp = a / d; else tmp = a / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -3.8e+129], N[Not[LessEqual[d, 7.8e+105]], $MachinePrecision]], N[(a / d), $MachinePrecision], N[(a / c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3.8 \cdot 10^{+129} \lor \neg \left(d \leq 7.8 \cdot 10^{+105}\right):\\
\;\;\;\;\frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{c}\\
\end{array}
\end{array}
if d < -3.80000000000000005e129 or 7.79999999999999957e105 < d Initial program 43.6%
*-un-lft-identity43.6%
add-sqr-sqrt43.6%
times-frac43.5%
hypot-def43.5%
hypot-def68.8%
Applied egg-rr68.8%
Taylor expanded in c around 0 52.0%
mul-1-neg52.0%
Simplified52.0%
Taylor expanded in d around -inf 33.3%
if -3.80000000000000005e129 < d < 7.79999999999999957e105Initial program 77.7%
*-un-lft-identity77.7%
add-sqr-sqrt77.7%
times-frac77.7%
hypot-def77.7%
hypot-def88.6%
Applied egg-rr88.6%
Taylor expanded in c around 0 19.2%
mul-1-neg19.2%
Simplified19.2%
Taylor expanded in c around -inf 10.3%
Final simplification16.8%
(FPCore (a b c d) :precision binary64 (if (or (<= d -5.7e+166) (not (<= d 5.2e+144))) (/ a d) (/ b c)))
double code(double a, double b, double c, double d) {
double tmp;
if ((d <= -5.7e+166) || !(d <= 5.2e+144)) {
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 ((d <= (-5.7d+166)) .or. (.not. (d <= 5.2d+144))) 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 ((d <= -5.7e+166) || !(d <= 5.2e+144)) {
tmp = a / d;
} else {
tmp = b / c;
}
return tmp;
}
def code(a, b, c, d): tmp = 0 if (d <= -5.7e+166) or not (d <= 5.2e+144): tmp = a / d else: tmp = b / c return tmp
function code(a, b, c, d) tmp = 0.0 if ((d <= -5.7e+166) || !(d <= 5.2e+144)) tmp = Float64(a / d); else tmp = Float64(b / c); end return tmp end
function tmp_2 = code(a, b, c, d) tmp = 0.0; if ((d <= -5.7e+166) || ~((d <= 5.2e+144))) tmp = a / d; else tmp = b / c; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := If[Or[LessEqual[d, -5.7e+166], N[Not[LessEqual[d, 5.2e+144]], $MachinePrecision]], N[(a / d), $MachinePrecision], N[(b / c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5.7 \cdot 10^{+166} \lor \neg \left(d \leq 5.2 \cdot 10^{+144}\right):\\
\;\;\;\;\frac{a}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\
\end{array}
\end{array}
if d < -5.69999999999999977e166 or 5.1999999999999998e144 < d Initial program 40.5%
*-un-lft-identity40.5%
add-sqr-sqrt40.5%
times-frac40.5%
hypot-def40.5%
hypot-def68.1%
Applied egg-rr68.1%
Taylor expanded in c around 0 59.2%
mul-1-neg59.2%
Simplified59.2%
Taylor expanded in d around -inf 40.8%
if -5.69999999999999977e166 < d < 5.1999999999999998e144Initial program 75.1%
Taylor expanded in c around inf 45.4%
Final simplification44.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 68.1%
*-un-lft-identity68.1%
add-sqr-sqrt68.1%
times-frac68.1%
hypot-def68.1%
hypot-def83.0%
Applied egg-rr83.0%
Taylor expanded in c around 0 28.4%
mul-1-neg28.4%
Simplified28.4%
Taylor expanded in c around -inf 10.1%
Final simplification10.1%
(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 2024040
(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))))