
(FPCore (a b c d) :precision binary64 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = ((b * c) - (a * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d): return ((b * c) - (a * d)) / ((c * c) + (d * d))
function code(a, b, c, d) return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))) end
function tmp = code(a, b, c, d) tmp = ((b * c) - (a * d)) / ((c * c) + (d * d)); end
code[a_, b_, c_, d_] := N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c d) :precision binary64 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
code = ((b * c) - (a * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d): return ((b * c) - (a * d)) / ((c * c) + (d * d))
function code(a, b, c, d) return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))) end
function tmp = code(a, b, c, d) tmp = ((b * c) - (a * d)) / ((c * c) + (d * d)); end
code[a_, b_, c_, d_] := N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\end{array}
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (fma (- a) (/ d (fma c c (* d d))) (* b (/ c (fma d d (* c c))))))
(t_1 (/ (fma c (/ b d) (- a)) d)))
(if (<= d -7e+115)
t_1
(if (<= d -2.4e-49)
t_0
(if (<= d 1.35e-158)
(/ (fma (* d a) (/ -1.0 c) b) c)
(if (<= d 3.8e+145) t_0 t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = fma(-a, (d / fma(c, c, (d * d))), (b * (c / fma(d, d, (c * c)))));
double t_1 = fma(c, (b / d), -a) / d;
double tmp;
if (d <= -7e+115) {
tmp = t_1;
} else if (d <= -2.4e-49) {
tmp = t_0;
} else if (d <= 1.35e-158) {
tmp = fma((d * a), (-1.0 / c), b) / c;
} else if (d <= 3.8e+145) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(a, b, c, d) t_0 = fma(Float64(-a), Float64(d / fma(c, c, Float64(d * d))), Float64(b * Float64(c / fma(d, d, Float64(c * c))))) t_1 = Float64(fma(c, Float64(b / d), Float64(-a)) / d) tmp = 0.0 if (d <= -7e+115) tmp = t_1; elseif (d <= -2.4e-49) tmp = t_0; elseif (d <= 1.35e-158) tmp = Float64(fma(Float64(d * a), Float64(-1.0 / c), b) / c); elseif (d <= 3.8e+145) tmp = t_0; else tmp = t_1; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) * N[(d / N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(c / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c * N[(b / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -7e+115], t$95$1, If[LessEqual[d, -2.4e-49], t$95$0, If[LessEqual[d, 1.35e-158], N[(N[(N[(d * a), $MachinePrecision] * N[(-1.0 / c), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 3.8e+145], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-a, \frac{d}{\mathsf{fma}\left(c, c, d \cdot d\right)}, b \cdot \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}\right)\\
t_1 := \frac{\mathsf{fma}\left(c, \frac{b}{d}, -a\right)}{d}\\
\mathbf{if}\;d \leq -7 \cdot 10^{+115}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d \leq -2.4 \cdot 10^{-49}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 1.35 \cdot 10^{-158}:\\
\;\;\;\;\frac{\mathsf{fma}\left(d \cdot a, \frac{-1}{c}, b\right)}{c}\\
\mathbf{elif}\;d \leq 3.8 \cdot 10^{+145}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d < -7.00000000000000011e115 or 3.80000000000000012e145 < d Initial program 31.2%
Taylor expanded in c around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
/-lowering-/.f64N/A
sub-negN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6488.4
Simplified88.4%
if -7.00000000000000011e115 < d < -2.39999999999999992e-49 or 1.3499999999999999e-158 < d < 3.80000000000000012e145Initial program 81.1%
div-subN/A
sub-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6485.2
Applied egg-rr85.2%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6487.4
Applied egg-rr87.4%
if -2.39999999999999992e-49 < d < 1.3499999999999999e-158Initial program 69.4%
div-subN/A
sub-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6463.9
Applied egg-rr63.9%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6468.7
Applied egg-rr68.7%
Taylor expanded in d around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
unsub-negN/A
mul-1-negN/A
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f6489.7
Simplified89.7%
distribute-lft-neg-outN/A
associate-*r/N/A
distribute-frac-neg2N/A
div-invN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
frac-2negN/A
/-lowering-/.f6490.6
Applied egg-rr90.6%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (fma c (/ b d) (- a)) d)))
(if (<= d -1.8e+100)
t_0
(if (<= d -2.4e-49)
(/ (- (* c b) (* d a)) (+ (* d d) (* c c)))
(if (<= d 3.6e-155)
(/ (fma (* d a) (/ -1.0 c) b) c)
(if (<= d 4.5e+102)
(* (fma c (- b) (* d a)) (/ -1.0 (fma c c (* d d))))
t_0))))))
double code(double a, double b, double c, double d) {
double t_0 = fma(c, (b / d), -a) / d;
double tmp;
if (d <= -1.8e+100) {
tmp = t_0;
} else if (d <= -2.4e-49) {
tmp = ((c * b) - (d * a)) / ((d * d) + (c * c));
} else if (d <= 3.6e-155) {
tmp = fma((d * a), (-1.0 / c), b) / c;
} else if (d <= 4.5e+102) {
tmp = fma(c, -b, (d * a)) * (-1.0 / fma(c, c, (d * d)));
} else {
tmp = t_0;
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(fma(c, Float64(b / d), Float64(-a)) / d) tmp = 0.0 if (d <= -1.8e+100) tmp = t_0; elseif (d <= -2.4e-49) tmp = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(Float64(d * d) + Float64(c * c))); elseif (d <= 3.6e-155) tmp = Float64(fma(Float64(d * a), Float64(-1.0 / c), b) / c); elseif (d <= 4.5e+102) tmp = Float64(fma(c, Float64(-b), Float64(d * a)) * Float64(-1.0 / fma(c, c, Float64(d * d)))); else tmp = t_0; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(c * N[(b / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -1.8e+100], t$95$0, If[LessEqual[d, -2.4e-49], N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.6e-155], N[(N[(N[(d * a), $MachinePrecision] * N[(-1.0 / c), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 4.5e+102], N[(N[(c * (-b) + N[(d * a), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(c, \frac{b}{d}, -a\right)}{d}\\
\mathbf{if}\;d \leq -1.8 \cdot 10^{+100}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -2.4 \cdot 10^{-49}:\\
\;\;\;\;\frac{c \cdot b - d \cdot a}{d \cdot d + c \cdot c}\\
\mathbf{elif}\;d \leq 3.6 \cdot 10^{-155}:\\
\;\;\;\;\frac{\mathsf{fma}\left(d \cdot a, \frac{-1}{c}, b\right)}{c}\\
\mathbf{elif}\;d \leq 4.5 \cdot 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(c, -b, d \cdot a\right) \cdot \frac{-1}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d < -1.8e100 or 4.50000000000000021e102 < d Initial program 35.0%
Taylor expanded in c around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
/-lowering-/.f64N/A
sub-negN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6485.7
Simplified85.7%
if -1.8e100 < d < -2.39999999999999992e-49Initial program 88.4%
if -2.39999999999999992e-49 < d < 3.59999999999999989e-155Initial program 69.7%
div-subN/A
sub-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6464.3
Applied egg-rr64.3%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6469.1
Applied egg-rr69.1%
Taylor expanded in d around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
unsub-negN/A
mul-1-negN/A
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f6489.8
Simplified89.8%
distribute-lft-neg-outN/A
associate-*r/N/A
distribute-frac-neg2N/A
div-invN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
frac-2negN/A
/-lowering-/.f6490.7
Applied egg-rr90.7%
if 3.59999999999999989e-155 < d < 4.50000000000000021e102Initial program 83.4%
frac-2negN/A
div-invN/A
*-lowering-*.f64N/A
sub-negN/A
distribute-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
remove-double-negN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
/-lowering-/.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6483.4
Applied egg-rr83.4%
Final simplification87.3%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (- (* c b) (* d a))) (t_1 (/ (fma c (/ b d) (- a)) d)))
(if (<= d -1.8e+100)
t_1
(if (<= d -2.4e-48)
(/ t_0 (+ (* d d) (* c c)))
(if (<= d 2.4e-155)
(/ (fma (* d a) (/ -1.0 c) b) c)
(if (<= d 3e+105) (/ t_0 (fma d d (* c c))) t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = (c * b) - (d * a);
double t_1 = fma(c, (b / d), -a) / d;
double tmp;
if (d <= -1.8e+100) {
tmp = t_1;
} else if (d <= -2.4e-48) {
tmp = t_0 / ((d * d) + (c * c));
} else if (d <= 2.4e-155) {
tmp = fma((d * a), (-1.0 / c), b) / c;
} else if (d <= 3e+105) {
tmp = t_0 / fma(d, d, (c * c));
} else {
tmp = t_1;
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(Float64(c * b) - Float64(d * a)) t_1 = Float64(fma(c, Float64(b / d), Float64(-a)) / d) tmp = 0.0 if (d <= -1.8e+100) tmp = t_1; elseif (d <= -2.4e-48) tmp = Float64(t_0 / Float64(Float64(d * d) + Float64(c * c))); elseif (d <= 2.4e-155) tmp = Float64(fma(Float64(d * a), Float64(-1.0 / c), b) / c); elseif (d <= 3e+105) tmp = Float64(t_0 / fma(d, d, Float64(c * c))); else tmp = t_1; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c * N[(b / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -1.8e+100], t$95$1, If[LessEqual[d, -2.4e-48], N[(t$95$0 / N[(N[(d * d), $MachinePrecision] + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.4e-155], N[(N[(N[(d * a), $MachinePrecision] * N[(-1.0 / c), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 3e+105], N[(t$95$0 / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c \cdot b - d \cdot a\\
t_1 := \frac{\mathsf{fma}\left(c, \frac{b}{d}, -a\right)}{d}\\
\mathbf{if}\;d \leq -1.8 \cdot 10^{+100}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d \leq -2.4 \cdot 10^{-48}:\\
\;\;\;\;\frac{t\_0}{d \cdot d + c \cdot c}\\
\mathbf{elif}\;d \leq 2.4 \cdot 10^{-155}:\\
\;\;\;\;\frac{\mathsf{fma}\left(d \cdot a, \frac{-1}{c}, b\right)}{c}\\
\mathbf{elif}\;d \leq 3 \cdot 10^{+105}:\\
\;\;\;\;\frac{t\_0}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d < -1.8e100 or 3.0000000000000001e105 < d Initial program 35.0%
Taylor expanded in c around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
/-lowering-/.f64N/A
sub-negN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6485.7
Simplified85.7%
if -1.8e100 < d < -2.4e-48Initial program 88.4%
if -2.4e-48 < d < 2.4e-155Initial program 69.7%
div-subN/A
sub-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6464.3
Applied egg-rr64.3%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6469.1
Applied egg-rr69.1%
Taylor expanded in d around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
unsub-negN/A
mul-1-negN/A
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f6489.8
Simplified89.8%
distribute-lft-neg-outN/A
associate-*r/N/A
distribute-frac-neg2N/A
div-invN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
frac-2negN/A
/-lowering-/.f6490.7
Applied egg-rr90.7%
if 2.4e-155 < d < 3.0000000000000001e105Initial program 83.4%
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6483.4
Applied egg-rr83.4%
Final simplification87.3%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- (* c b) (* d a)) (fma d d (* c c))))
(t_1 (/ (fma c (/ b d) (- a)) d)))
(if (<= d -7.2e+99)
t_1
(if (<= d -7.2e-49)
t_0
(if (<= d 2.95e-155)
(/ (fma (* d a) (/ -1.0 c) b) c)
(if (<= d 1.15e+104) t_0 t_1))))))
double code(double a, double b, double c, double d) {
double t_0 = ((c * b) - (d * a)) / fma(d, d, (c * c));
double t_1 = fma(c, (b / d), -a) / d;
double tmp;
if (d <= -7.2e+99) {
tmp = t_1;
} else if (d <= -7.2e-49) {
tmp = t_0;
} else if (d <= 2.95e-155) {
tmp = fma((d * a), (-1.0 / c), b) / c;
} else if (d <= 1.15e+104) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(Float64(Float64(c * b) - Float64(d * a)) / fma(d, d, Float64(c * c))) t_1 = Float64(fma(c, Float64(b / d), Float64(-a)) / d) tmp = 0.0 if (d <= -7.2e+99) tmp = t_1; elseif (d <= -7.2e-49) tmp = t_0; elseif (d <= 2.95e-155) tmp = Float64(fma(Float64(d * a), Float64(-1.0 / c), b) / c); elseif (d <= 1.15e+104) tmp = t_0; else tmp = t_1; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c * N[(b / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -7.2e+99], t$95$1, If[LessEqual[d, -7.2e-49], t$95$0, If[LessEqual[d, 2.95e-155], N[(N[(N[(d * a), $MachinePrecision] * N[(-1.0 / c), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 1.15e+104], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c \cdot b - d \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\
t_1 := \frac{\mathsf{fma}\left(c, \frac{b}{d}, -a\right)}{d}\\
\mathbf{if}\;d \leq -7.2 \cdot 10^{+99}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d \leq -7.2 \cdot 10^{-49}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 2.95 \cdot 10^{-155}:\\
\;\;\;\;\frac{\mathsf{fma}\left(d \cdot a, \frac{-1}{c}, b\right)}{c}\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{+104}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d < -7.2000000000000003e99 or 1.14999999999999992e104 < d Initial program 35.0%
Taylor expanded in c around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
/-lowering-/.f64N/A
sub-negN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6485.7
Simplified85.7%
if -7.2000000000000003e99 < d < -7.19999999999999939e-49 or 2.95e-155 < d < 1.14999999999999992e104Initial program 85.0%
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6485.0
Applied egg-rr85.0%
if -7.19999999999999939e-49 < d < 2.95e-155Initial program 69.7%
div-subN/A
sub-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6464.3
Applied egg-rr64.3%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6469.1
Applied egg-rr69.1%
Taylor expanded in d around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
unsub-negN/A
mul-1-negN/A
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f6489.8
Simplified89.8%
distribute-lft-neg-outN/A
associate-*r/N/A
distribute-frac-neg2N/A
div-invN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
frac-2negN/A
/-lowering-/.f6490.7
Applied egg-rr90.7%
Final simplification87.3%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- a) d)) (t_1 (/ (- (* c b) (* d a)) (* d d))))
(if (<= d -9.2e+80)
t_0
(if (<= d -1.55e-26)
t_1
(if (<= d 1.45e-70)
(/ (- b (/ (* d a) c)) c)
(if (<= d 1.26e+137) t_1 t_0))))))
double code(double a, double b, double c, double d) {
double t_0 = -a / d;
double t_1 = ((c * b) - (d * a)) / (d * d);
double tmp;
if (d <= -9.2e+80) {
tmp = t_0;
} else if (d <= -1.55e-26) {
tmp = t_1;
} else if (d <= 1.45e-70) {
tmp = (b - ((d * a) / c)) / c;
} else if (d <= 1.26e+137) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = -a / d
t_1 = ((c * b) - (d * a)) / (d * d)
if (d <= (-9.2d+80)) then
tmp = t_0
else if (d <= (-1.55d-26)) then
tmp = t_1
else if (d <= 1.45d-70) then
tmp = (b - ((d * a) / c)) / c
else if (d <= 1.26d+137) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double t_0 = -a / d;
double t_1 = ((c * b) - (d * a)) / (d * d);
double tmp;
if (d <= -9.2e+80) {
tmp = t_0;
} else if (d <= -1.55e-26) {
tmp = t_1;
} else if (d <= 1.45e-70) {
tmp = (b - ((d * a) / c)) / c;
} else if (d <= 1.26e+137) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, c, d): t_0 = -a / d t_1 = ((c * b) - (d * a)) / (d * d) tmp = 0 if d <= -9.2e+80: tmp = t_0 elif d <= -1.55e-26: tmp = t_1 elif d <= 1.45e-70: tmp = (b - ((d * a) / c)) / c elif d <= 1.26e+137: tmp = t_1 else: tmp = t_0 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(-a) / d) t_1 = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(d * d)) tmp = 0.0 if (d <= -9.2e+80) tmp = t_0; elseif (d <= -1.55e-26) tmp = t_1; elseif (d <= 1.45e-70) tmp = Float64(Float64(b - Float64(Float64(d * a) / c)) / c); elseif (d <= 1.26e+137) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = -a / d; t_1 = ((c * b) - (d * a)) / (d * d); tmp = 0.0; if (d <= -9.2e+80) tmp = t_0; elseif (d <= -1.55e-26) tmp = t_1; elseif (d <= 1.45e-70) tmp = (b - ((d * a) / c)) / c; elseif (d <= 1.26e+137) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -9.2e+80], t$95$0, If[LessEqual[d, -1.55e-26], t$95$1, If[LessEqual[d, 1.45e-70], N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 1.26e+137], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-a}{d}\\
t_1 := \frac{c \cdot b - d \cdot a}{d \cdot d}\\
\mathbf{if}\;d \leq -9.2 \cdot 10^{+80}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -1.55 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d \leq 1.45 \cdot 10^{-70}:\\
\;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
\mathbf{elif}\;d \leq 1.26 \cdot 10^{+137}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d < -9.20000000000000016e80 or 1.2599999999999999e137 < d Initial program 36.5%
Taylor expanded in c around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6479.3
Simplified79.3%
if -9.20000000000000016e80 < d < -1.54999999999999992e-26 or 1.44999999999999986e-70 < d < 1.2599999999999999e137Initial program 88.4%
Taylor expanded in c around 0
unpow2N/A
*-lowering-*.f6466.8
Simplified66.8%
if -1.54999999999999992e-26 < d < 1.44999999999999986e-70Initial program 71.1%
Taylor expanded in c around inf
/-lowering-/.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6484.6
Simplified84.6%
Final simplification79.2%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- a) d)) (t_1 (/ (- (* c b) (* d a)) (* d d))))
(if (<= d -9e+80)
t_0
(if (<= d -1.9e-49)
t_1
(if (<= d 5.8e-100) (/ b c) (if (<= d 5.8e+137) t_1 t_0))))))
double code(double a, double b, double c, double d) {
double t_0 = -a / d;
double t_1 = ((c * b) - (d * a)) / (d * d);
double tmp;
if (d <= -9e+80) {
tmp = t_0;
} else if (d <= -1.9e-49) {
tmp = t_1;
} else if (d <= 5.8e-100) {
tmp = b / c;
} else if (d <= 5.8e+137) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = -a / d
t_1 = ((c * b) - (d * a)) / (d * d)
if (d <= (-9d+80)) then
tmp = t_0
else if (d <= (-1.9d-49)) then
tmp = t_1
else if (d <= 5.8d-100) then
tmp = b / c
else if (d <= 5.8d+137) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double t_0 = -a / d;
double t_1 = ((c * b) - (d * a)) / (d * d);
double tmp;
if (d <= -9e+80) {
tmp = t_0;
} else if (d <= -1.9e-49) {
tmp = t_1;
} else if (d <= 5.8e-100) {
tmp = b / c;
} else if (d <= 5.8e+137) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, c, d): t_0 = -a / d t_1 = ((c * b) - (d * a)) / (d * d) tmp = 0 if d <= -9e+80: tmp = t_0 elif d <= -1.9e-49: tmp = t_1 elif d <= 5.8e-100: tmp = b / c elif d <= 5.8e+137: tmp = t_1 else: tmp = t_0 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(-a) / d) t_1 = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(d * d)) tmp = 0.0 if (d <= -9e+80) tmp = t_0; elseif (d <= -1.9e-49) tmp = t_1; elseif (d <= 5.8e-100) tmp = Float64(b / c); elseif (d <= 5.8e+137) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = -a / d; t_1 = ((c * b) - (d * a)) / (d * d); tmp = 0.0; if (d <= -9e+80) tmp = t_0; elseif (d <= -1.9e-49) tmp = t_1; elseif (d <= 5.8e-100) tmp = b / c; elseif (d <= 5.8e+137) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -9e+80], t$95$0, If[LessEqual[d, -1.9e-49], t$95$1, If[LessEqual[d, 5.8e-100], N[(b / c), $MachinePrecision], If[LessEqual[d, 5.8e+137], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-a}{d}\\
t_1 := \frac{c \cdot b - d \cdot a}{d \cdot d}\\
\mathbf{if}\;d \leq -9 \cdot 10^{+80}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -1.9 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d \leq 5.8 \cdot 10^{-100}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;d \leq 5.8 \cdot 10^{+137}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d < -9.00000000000000013e80 or 5.79999999999999969e137 < d Initial program 36.5%
Taylor expanded in c around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6479.3
Simplified79.3%
if -9.00000000000000013e80 < d < -1.8999999999999999e-49 or 5.79999999999999951e-100 < d < 5.79999999999999969e137Initial program 85.3%
Taylor expanded in c around 0
unpow2N/A
*-lowering-*.f6463.7
Simplified63.7%
if -1.8999999999999999e-49 < d < 5.79999999999999951e-100Initial program 70.5%
Taylor expanded in c around inf
/-lowering-/.f6475.4
Simplified75.4%
Final simplification73.6%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- a) d)))
(if (<= d -8e+99)
t_0
(if (<= d -1.7e-49)
(/ (* d a) (- (fma c c (* d d))))
(if (<= d 1e-97)
(/ b c)
(if (<= d 1.05e+147) (- (* a (/ d (fma d d (* c c))))) t_0))))))
double code(double a, double b, double c, double d) {
double t_0 = -a / d;
double tmp;
if (d <= -8e+99) {
tmp = t_0;
} else if (d <= -1.7e-49) {
tmp = (d * a) / -fma(c, c, (d * d));
} else if (d <= 1e-97) {
tmp = b / c;
} else if (d <= 1.05e+147) {
tmp = -(a * (d / fma(d, d, (c * c))));
} else {
tmp = t_0;
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(Float64(-a) / d) tmp = 0.0 if (d <= -8e+99) tmp = t_0; elseif (d <= -1.7e-49) tmp = Float64(Float64(d * a) / Float64(-fma(c, c, Float64(d * d)))); elseif (d <= 1e-97) tmp = Float64(b / c); elseif (d <= 1.05e+147) tmp = Float64(-Float64(a * Float64(d / fma(d, d, Float64(c * c))))); else tmp = t_0; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, If[LessEqual[d, -8e+99], t$95$0, If[LessEqual[d, -1.7e-49], N[(N[(d * a), $MachinePrecision] / (-N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[d, 1e-97], N[(b / c), $MachinePrecision], If[LessEqual[d, 1.05e+147], (-N[(a * N[(d / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-a}{d}\\
\mathbf{if}\;d \leq -8 \cdot 10^{+99}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -1.7 \cdot 10^{-49}:\\
\;\;\;\;\frac{d \cdot a}{-\mathsf{fma}\left(c, c, d \cdot d\right)}\\
\mathbf{elif}\;d \leq 10^{-97}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;d \leq 1.05 \cdot 10^{+147}:\\
\;\;\;\;-a \cdot \frac{d}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d < -7.9999999999999997e99 or 1.05000000000000003e147 < d Initial program 32.8%
Taylor expanded in c around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6481.8
Simplified81.8%
if -7.9999999999999997e99 < d < -1.70000000000000002e-49Initial program 88.8%
Taylor expanded in b around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6457.6
Simplified57.6%
accelerator-lowering-fma.f64N/A
*-lowering-*.f6457.6
Applied egg-rr57.6%
if -1.70000000000000002e-49 < d < 1.00000000000000004e-97Initial program 70.8%
Taylor expanded in c around inf
/-lowering-/.f6475.6
Simplified75.6%
if 1.00000000000000004e-97 < d < 1.05000000000000003e147Initial program 80.0%
Taylor expanded in b around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6458.4
Simplified58.4%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6460.5
Applied egg-rr60.5%
Final simplification72.7%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (- a) d)) (t_1 (- (* a (/ d (fma d d (* c c)))))))
(if (<= d -1.4e+91)
t_0
(if (<= d -1.1e-49)
t_1
(if (<= d 8.5e-98) (/ b c) (if (<= d 4.2e+144) t_1 t_0))))))
double code(double a, double b, double c, double d) {
double t_0 = -a / d;
double t_1 = -(a * (d / fma(d, d, (c * c))));
double tmp;
if (d <= -1.4e+91) {
tmp = t_0;
} else if (d <= -1.1e-49) {
tmp = t_1;
} else if (d <= 8.5e-98) {
tmp = b / c;
} else if (d <= 4.2e+144) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(Float64(-a) / d) t_1 = Float64(-Float64(a * Float64(d / fma(d, d, Float64(c * c))))) tmp = 0.0 if (d <= -1.4e+91) tmp = t_0; elseif (d <= -1.1e-49) tmp = t_1; elseif (d <= 8.5e-98) tmp = Float64(b / c); elseif (d <= 4.2e+144) tmp = t_1; else tmp = t_0; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, Block[{t$95$1 = (-N[(a * N[(d / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[d, -1.4e+91], t$95$0, If[LessEqual[d, -1.1e-49], t$95$1, If[LessEqual[d, 8.5e-98], N[(b / c), $MachinePrecision], If[LessEqual[d, 4.2e+144], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-a}{d}\\
t_1 := -a \cdot \frac{d}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\
\mathbf{if}\;d \leq -1.4 \cdot 10^{+91}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -1.1 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d \leq 8.5 \cdot 10^{-98}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{elif}\;d \leq 4.2 \cdot 10^{+144}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d < -1.3999999999999999e91 or 4.19999999999999993e144 < d Initial program 33.4%
Taylor expanded in c around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6481.1
Simplified81.1%
if -1.3999999999999999e91 < d < -1.09999999999999995e-49 or 8.4999999999999997e-98 < d < 4.19999999999999993e144Initial program 83.9%
Taylor expanded in b around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6458.2
Simplified58.2%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6459.6
Applied egg-rr59.6%
if -1.09999999999999995e-49 < d < 8.4999999999999997e-98Initial program 70.8%
Taylor expanded in c around inf
/-lowering-/.f6475.6
Simplified75.6%
Final simplification72.7%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (fma c (/ b d) (- a)) d)))
(if (<= d -6.2e-27)
t_0
(if (<= d 4.6e-72) (/ (fma (* d a) (/ -1.0 c) b) c) t_0))))
double code(double a, double b, double c, double d) {
double t_0 = fma(c, (b / d), -a) / d;
double tmp;
if (d <= -6.2e-27) {
tmp = t_0;
} else if (d <= 4.6e-72) {
tmp = fma((d * a), (-1.0 / c), b) / c;
} else {
tmp = t_0;
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(fma(c, Float64(b / d), Float64(-a)) / d) tmp = 0.0 if (d <= -6.2e-27) tmp = t_0; elseif (d <= 4.6e-72) tmp = Float64(fma(Float64(d * a), Float64(-1.0 / c), b) / c); else tmp = t_0; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(c * N[(b / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -6.2e-27], t$95$0, If[LessEqual[d, 4.6e-72], N[(N[(N[(d * a), $MachinePrecision] * N[(-1.0 / c), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(c, \frac{b}{d}, -a\right)}{d}\\
\mathbf{if}\;d \leq -6.2 \cdot 10^{-27}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 4.6 \cdot 10^{-72}:\\
\;\;\;\;\frac{\mathsf{fma}\left(d \cdot a, \frac{-1}{c}, b\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d < -6.1999999999999997e-27 or 4.59999999999999989e-72 < d Initial program 55.9%
Taylor expanded in c around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
/-lowering-/.f64N/A
sub-negN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6478.2
Simplified78.2%
if -6.1999999999999997e-27 < d < 4.59999999999999989e-72Initial program 71.1%
div-subN/A
sub-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6466.9
Applied egg-rr66.9%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6472.4
Applied egg-rr72.4%
Taylor expanded in d around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
unsub-negN/A
mul-1-negN/A
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f6484.3
Simplified84.3%
distribute-lft-neg-outN/A
associate-*r/N/A
distribute-frac-neg2N/A
div-invN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
frac-2negN/A
/-lowering-/.f6484.7
Applied egg-rr84.7%
(FPCore (a b c d)
:precision binary64
(let* ((t_0 (/ (fma c (/ b d) (- a)) d)))
(if (<= d -1.75e-26)
t_0
(if (<= d 1.45e-70) (/ (- b (/ (* d a) c)) c) t_0))))
double code(double a, double b, double c, double d) {
double t_0 = fma(c, (b / d), -a) / d;
double tmp;
if (d <= -1.75e-26) {
tmp = t_0;
} else if (d <= 1.45e-70) {
tmp = (b - ((d * a) / c)) / c;
} else {
tmp = t_0;
}
return tmp;
}
function code(a, b, c, d) t_0 = Float64(fma(c, Float64(b / d), Float64(-a)) / d) tmp = 0.0 if (d <= -1.75e-26) tmp = t_0; elseif (d <= 1.45e-70) tmp = Float64(Float64(b - Float64(Float64(d * a) / c)) / c); else tmp = t_0; end return tmp end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(c * N[(b / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -1.75e-26], t$95$0, If[LessEqual[d, 1.45e-70], N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(c, \frac{b}{d}, -a\right)}{d}\\
\mathbf{if}\;d \leq -1.75 \cdot 10^{-26}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 1.45 \cdot 10^{-70}:\\
\;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d < -1.74999999999999992e-26 or 1.44999999999999986e-70 < d Initial program 55.9%
Taylor expanded in c around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
unpow2N/A
associate-/r*N/A
div-subN/A
/-lowering-/.f64N/A
sub-negN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6478.2
Simplified78.2%
if -1.74999999999999992e-26 < d < 1.44999999999999986e-70Initial program 71.1%
Taylor expanded in c around inf
/-lowering-/.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6484.6
Simplified84.6%
(FPCore (a b c d) :precision binary64 (let* ((t_0 (/ (- a) d))) (if (<= d -2.3e-49) t_0 (if (<= d 1e-97) (/ b c) t_0))))
double code(double a, double b, double c, double d) {
double t_0 = -a / d;
double tmp;
if (d <= -2.3e-49) {
tmp = t_0;
} else if (d <= 1e-97) {
tmp = b / c;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, b, c, d)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = -a / d
if (d <= (-2.3d-49)) then
tmp = t_0
else if (d <= 1d-97) then
tmp = b / c
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b, double c, double d) {
double t_0 = -a / d;
double tmp;
if (d <= -2.3e-49) {
tmp = t_0;
} else if (d <= 1e-97) {
tmp = b / c;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, c, d): t_0 = -a / d tmp = 0 if d <= -2.3e-49: tmp = t_0 elif d <= 1e-97: tmp = b / c else: tmp = t_0 return tmp
function code(a, b, c, d) t_0 = Float64(Float64(-a) / d) tmp = 0.0 if (d <= -2.3e-49) tmp = t_0; elseif (d <= 1e-97) tmp = Float64(b / c); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, c, d) t_0 = -a / d; tmp = 0.0; if (d <= -2.3e-49) tmp = t_0; elseif (d <= 1e-97) tmp = b / c; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, If[LessEqual[d, -2.3e-49], t$95$0, If[LessEqual[d, 1e-97], N[(b / c), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-a}{d}\\
\mathbf{if}\;d \leq -2.3 \cdot 10^{-49}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 10^{-97}:\\
\;\;\;\;\frac{b}{c}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d < -2.2999999999999999e-49 or 1.00000000000000004e-97 < d Initial program 57.6%
Taylor expanded in c around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6462.8
Simplified62.8%
if -2.2999999999999999e-49 < d < 1.00000000000000004e-97Initial program 70.8%
Taylor expanded in c around inf
/-lowering-/.f6475.6
Simplified75.6%
Final simplification67.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 62.9%
Taylor expanded in c around inf
/-lowering-/.f6440.8
Simplified40.8%
(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 2024198
(FPCore (a b c d)
:name "Complex division, imag part"
:precision binary64
:alt
(! :herbie-platform default (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))))