
(FPCore (a b c) :precision binary64 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c))))) (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ (+ (- b) t_0) (* 2.0 a)))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((b * b) - ((4.0d0 * a) * c)))
if (b >= 0.0d0) then
tmp = (2.0d0 * c) / (-b - t_0)
else
tmp = (-b + t_0) / (2.0d0 * a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - ((4.0 * a) * c))) tmp = 0 if b >= 0.0: tmp = (2.0 * c) / (-b - t_0) else: tmp = (-b + t_0) / (2.0 * a) return tmp
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0)); else tmp = Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a)); end return tmp end
function tmp_2 = code(a, b, c) t_0 = sqrt(((b * b) - ((4.0 * a) * c))); tmp = 0.0; if (b >= 0.0) tmp = (2.0 * c) / (-b - t_0); else tmp = (-b + t_0) / (2.0 * a); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + t\_0}{2 \cdot a}\\
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c))))) (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ (+ (- b) t_0) (* 2.0 a)))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((b * b) - ((4.0d0 * a) * c)))
if (b >= 0.0d0) then
tmp = (2.0d0 * c) / (-b - t_0)
else
tmp = (-b + t_0) / (2.0d0 * a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) - ((4.0 * a) * c)));
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - t_0);
} else {
tmp = (-b + t_0) / (2.0 * a);
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - ((4.0 * a) * c))) tmp = 0 if b >= 0.0: tmp = (2.0 * c) / (-b - t_0) else: tmp = (-b + t_0) / (2.0 * a) return tmp
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0)); else tmp = Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a)); end return tmp end
function tmp_2 = code(a, b, c) t_0 = sqrt(((b * b) - ((4.0 * a) * c))); tmp = 0.0; if (b >= 0.0) tmp = (2.0 * c) / (-b - t_0); else tmp = (-b + t_0) / (2.0 * a); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + t\_0}{2 \cdot a}\\
\end{array}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b -1.8e+138)
(/ (- b) a)
(if (<= b 2.3e+72)
(if (>= b 0.0)
(/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* c (* a 4.0))))))
(/ (fma b -1.0 (sqrt (fma c (* a -4.0) (* b b)))) (* a 2.0)))
(if (>= b 0.0) (/ c (- b)) (/ -1.0 (* a (+ b b)))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.8e+138) {
tmp = -b / a;
} else if (b <= 2.3e+72) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = (2.0 * c) / (-b - sqrt(((b * b) - (c * (a * 4.0)))));
} else {
tmp_1 = fma(b, -1.0, sqrt(fma(c, (a * -4.0), (b * b)))) / (a * 2.0);
}
tmp = tmp_1;
} else if (b >= 0.0) {
tmp = c / -b;
} else {
tmp = -1.0 / (a * (b + b));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -1.8e+138) tmp = Float64(Float64(-b) / a); elseif (b <= 2.3e+72) tmp_1 = 0.0 if (b >= 0.0) tmp_1 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))))); else tmp_1 = Float64(fma(b, -1.0, sqrt(fma(c, Float64(a * -4.0), Float64(b * b)))) / Float64(a * 2.0)); end tmp = tmp_1; elseif (b >= 0.0) tmp = Float64(c / Float64(-b)); else tmp = Float64(-1.0 / Float64(a * Float64(b + b))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -1.8e+138], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 2.3e+72], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * -1.0 + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(c / (-b)), $MachinePrecision], N[(-1.0 / N[(a * N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.8 \cdot 10^{+138}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{+72}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -1, \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}\right)}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c}{-b}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{a \cdot \left(b + b\right)}\\
\end{array}
\end{array}
if b < -1.8000000000000001e138Initial program 45.4%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6498.1
Simplified98.1%
Taylor expanded in b around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6498.1
Simplified98.1%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
mul-1-negN/A
/-lowering-/.f64N/A
neg-lowering-neg.f6498.1
Simplified98.1%
if -1.8000000000000001e138 < b < 2.3e72Initial program 87.2%
neg-mul-1N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
sqrt-lowering-sqrt.f64N/A
sub-negN/A
+-commutativeN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-lowering-*.f6487.2
Applied egg-rr87.2%
if 2.3e72 < b Initial program 61.1%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6461.1
Simplified61.1%
clear-numN/A
frac-2negN/A
metadata-evalN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
distribute-neg-frac2N/A
+-inversesN/A
flip-+N/A
distribute-frac-neg2N/A
distribute-neg-outN/A
remove-double-negN/A
distribute-neg-outN/A
Applied egg-rr61.1%
Taylor expanded in c around 0
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
neg-lowering-neg.f6496.5
Simplified96.5%
Final simplification91.2%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (- (* b b) (* c (* a 4.0))))))
(if (<= b -1e+139)
(/ (- b) a)
(if (<= b 4e+76)
(if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ (- t_0 b) (* a 2.0)))
(if (>= b 0.0) (/ c (- b)) (/ -1.0 (* a (+ b b))))))))
double code(double a, double b, double c) {
double t_0 = sqrt(((b * b) - (c * (a * 4.0))));
double tmp;
if (b <= -1e+139) {
tmp = -b / a;
} else if (b <= 4e+76) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = (2.0 * c) / (-b - t_0);
} else {
tmp_1 = (t_0 - b) / (a * 2.0);
}
tmp = tmp_1;
} else if (b >= 0.0) {
tmp = c / -b;
} else {
tmp = -1.0 / (a * (b + b));
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_0
real(8) :: tmp
real(8) :: tmp_1
t_0 = sqrt(((b * b) - (c * (a * 4.0d0))))
if (b <= (-1d+139)) then
tmp = -b / a
else if (b <= 4d+76) then
if (b >= 0.0d0) then
tmp_1 = (2.0d0 * c) / (-b - t_0)
else
tmp_1 = (t_0 - b) / (a * 2.0d0)
end if
tmp = tmp_1
else if (b >= 0.0d0) then
tmp = c / -b
else
tmp = (-1.0d0) / (a * (b + b))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt(((b * b) - (c * (a * 4.0))));
double tmp;
if (b <= -1e+139) {
tmp = -b / a;
} else if (b <= 4e+76) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = (2.0 * c) / (-b - t_0);
} else {
tmp_1 = (t_0 - b) / (a * 2.0);
}
tmp = tmp_1;
} else if (b >= 0.0) {
tmp = c / -b;
} else {
tmp = -1.0 / (a * (b + b));
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt(((b * b) - (c * (a * 4.0)))) tmp = 0 if b <= -1e+139: tmp = -b / a elif b <= 4e+76: tmp_1 = 0 if b >= 0.0: tmp_1 = (2.0 * c) / (-b - t_0) else: tmp_1 = (t_0 - b) / (a * 2.0) tmp = tmp_1 elif b >= 0.0: tmp = c / -b else: tmp = -1.0 / (a * (b + b)) return tmp
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) tmp = 0.0 if (b <= -1e+139) tmp = Float64(Float64(-b) / a); elseif (b <= 4e+76) tmp_1 = 0.0 if (b >= 0.0) tmp_1 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0)); else tmp_1 = Float64(Float64(t_0 - b) / Float64(a * 2.0)); end tmp = tmp_1; elseif (b >= 0.0) tmp = Float64(c / Float64(-b)); else tmp = Float64(-1.0 / Float64(a * Float64(b + b))); end return tmp end
function tmp_3 = code(a, b, c) t_0 = sqrt(((b * b) - (c * (a * 4.0)))); tmp = 0.0; if (b <= -1e+139) tmp = -b / a; elseif (b <= 4e+76) tmp_2 = 0.0; if (b >= 0.0) tmp_2 = (2.0 * c) / (-b - t_0); else tmp_2 = (t_0 - b) / (a * 2.0); end tmp = tmp_2; elseif (b >= 0.0) tmp = c / -b; else tmp = -1.0 / (a * (b + b)); end tmp_3 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -1e+139], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 4e+76], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(c / (-b)), $MachinePrecision], N[(-1.0 / N[(a * N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\
\mathbf{if}\;b \leq -1 \cdot 10^{+139}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{elif}\;b \leq 4 \cdot 10^{+76}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c}{-b}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{a \cdot \left(b + b\right)}\\
\end{array}
\end{array}
if b < -1.00000000000000003e139Initial program 45.4%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6498.1
Simplified98.1%
Taylor expanded in b around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6498.1
Simplified98.1%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
mul-1-negN/A
/-lowering-/.f64N/A
neg-lowering-neg.f6498.1
Simplified98.1%
if -1.00000000000000003e139 < b < 4.0000000000000002e76Initial program 87.2%
if 4.0000000000000002e76 < b Initial program 61.1%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6461.1
Simplified61.1%
clear-numN/A
frac-2negN/A
metadata-evalN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
distribute-neg-frac2N/A
+-inversesN/A
flip-+N/A
distribute-frac-neg2N/A
distribute-neg-outN/A
remove-double-negN/A
distribute-neg-outN/A
Applied egg-rr61.1%
Taylor expanded in c around 0
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
neg-lowering-neg.f6496.5
Simplified96.5%
Final simplification91.2%
(FPCore (a b c)
:precision binary64
(if (<= b -1e+139)
(/ (- b) a)
(if (<= b 3e+74)
(if (>= b 0.0)
(* c (/ -2.0 (+ b (sqrt (fma c (* a -4.0) (* b b))))))
(/ (- (sqrt (fma a (* c -4.0) (* b b))) b) (* a 2.0)))
(if (>= b 0.0) (/ c (- b)) (/ -1.0 (* a (+ b b)))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e+139) {
tmp = -b / a;
} else if (b <= 3e+74) {
double tmp_1;
if (b >= 0.0) {
tmp_1 = c * (-2.0 / (b + sqrt(fma(c, (a * -4.0), (b * b)))));
} else {
tmp_1 = (sqrt(fma(a, (c * -4.0), (b * b))) - b) / (a * 2.0);
}
tmp = tmp_1;
} else if (b >= 0.0) {
tmp = c / -b;
} else {
tmp = -1.0 / (a * (b + b));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -1e+139) tmp = Float64(Float64(-b) / a); elseif (b <= 3e+74) tmp_1 = 0.0 if (b >= 0.0) tmp_1 = Float64(c * Float64(-2.0 / Float64(b + sqrt(fma(c, Float64(a * -4.0), Float64(b * b)))))); else tmp_1 = Float64(Float64(sqrt(fma(a, Float64(c * -4.0), Float64(b * b))) - b) / Float64(a * 2.0)); end tmp = tmp_1; elseif (b >= 0.0) tmp = Float64(c / Float64(-b)); else tmp = Float64(-1.0 / Float64(a * Float64(b + b))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -1e+139], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 3e+74], If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(c / (-b)), $MachinePrecision], N[(-1.0 / N[(a * N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+139}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{elif}\;b \leq 3 \cdot 10^{+74}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c}{-b}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{a \cdot \left(b + b\right)}\\
\end{array}
\end{array}
if b < -1.00000000000000003e139Initial program 45.4%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6498.1
Simplified98.1%
Taylor expanded in b around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6498.1
Simplified98.1%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
mul-1-negN/A
/-lowering-/.f64N/A
neg-lowering-neg.f6498.1
Simplified98.1%
if -1.00000000000000003e139 < b < 3e74Initial program 87.2%
Applied egg-rr87.1%
sub-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6487.1
Applied egg-rr87.1%
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
unsub-negN/A
--lowering--.f64N/A
*-commutativeN/A
associate-*l*N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6487.1
Applied egg-rr87.1%
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6487.1
Applied egg-rr87.1%
if 3e74 < b Initial program 61.1%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6461.1
Simplified61.1%
clear-numN/A
frac-2negN/A
metadata-evalN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
distribute-neg-frac2N/A
+-inversesN/A
flip-+N/A
distribute-frac-neg2N/A
distribute-neg-outN/A
remove-double-negN/A
distribute-neg-outN/A
Applied egg-rr61.1%
Taylor expanded in c around 0
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
neg-lowering-neg.f6496.5
Simplified96.5%
Final simplification91.2%
(FPCore (a b c)
:precision binary64
(if (<= b 1.6e-99)
(if (>= b 0.0)
(/ (* 2.0 c) (- (- b) (sqrt (* -4.0 (* a c)))))
(/ (+ b b) (* a (- 2.0))))
(if (>= b 0.0) (/ c (- b)) (/ -1.0 (* a (+ b b))))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= 1.6e-99) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (2.0 * c) / (-b - sqrt((-4.0 * (a * c))));
} else {
tmp_2 = (b + b) / (a * -2.0);
}
tmp_1 = tmp_2;
} else if (b >= 0.0) {
tmp_1 = c / -b;
} else {
tmp_1 = -1.0 / (a * (b + b));
}
return tmp_1;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
if (b <= 1.6d-99) then
if (b >= 0.0d0) then
tmp_2 = (2.0d0 * c) / (-b - sqrt(((-4.0d0) * (a * c))))
else
tmp_2 = (b + b) / (a * -2.0d0)
end if
tmp_1 = tmp_2
else if (b >= 0.0d0) then
tmp_1 = c / -b
else
tmp_1 = (-1.0d0) / (a * (b + b))
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double tmp_1;
if (b <= 1.6e-99) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (2.0 * c) / (-b - Math.sqrt((-4.0 * (a * c))));
} else {
tmp_2 = (b + b) / (a * -2.0);
}
tmp_1 = tmp_2;
} else if (b >= 0.0) {
tmp_1 = c / -b;
} else {
tmp_1 = -1.0 / (a * (b + b));
}
return tmp_1;
}
def code(a, b, c): tmp_1 = 0 if b <= 1.6e-99: tmp_2 = 0 if b >= 0.0: tmp_2 = (2.0 * c) / (-b - math.sqrt((-4.0 * (a * c)))) else: tmp_2 = (b + b) / (a * -2.0) tmp_1 = tmp_2 elif b >= 0.0: tmp_1 = c / -b else: tmp_1 = -1.0 / (a * (b + b)) return tmp_1
function code(a, b, c) tmp_1 = 0.0 if (b <= 1.6e-99) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - sqrt(Float64(-4.0 * Float64(a * c))))); else tmp_2 = Float64(Float64(b + b) / Float64(a * Float64(-2.0))); end tmp_1 = tmp_2; elseif (b >= 0.0) tmp_1 = Float64(c / Float64(-b)); else tmp_1 = Float64(-1.0 / Float64(a * Float64(b + b))); end return tmp_1 end
function tmp_4 = code(a, b, c) tmp_2 = 0.0; if (b <= 1.6e-99) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = (2.0 * c) / (-b - sqrt((-4.0 * (a * c)))); else tmp_3 = (b + b) / (a * -2.0); end tmp_2 = tmp_3; elseif (b >= 0.0) tmp_2 = c / -b; else tmp_2 = -1.0 / (a * (b + b)); end tmp_4 = tmp_2; end
code[a_, b_, c_] := If[LessEqual[b, 1.6e-99], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - N[Sqrt[N[(-4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b + b), $MachinePrecision] / N[(a * (-2.0)), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(c / (-b)), $MachinePrecision], N[(-1.0 / N[(a * N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.6 \cdot 10^{-99}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{-4 \cdot \left(a \cdot c\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + b}{a \cdot \left(-2\right)}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c}{-b}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{a \cdot \left(b + b\right)}\\
\end{array}
\end{array}
if b < 1.6e-99Initial program 73.1%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6472.1
Simplified72.1%
Taylor expanded in b around 0
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6470.5
Simplified70.5%
if 1.6e-99 < b Initial program 74.7%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6474.7
Simplified74.7%
clear-numN/A
frac-2negN/A
metadata-evalN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
distribute-neg-frac2N/A
+-inversesN/A
flip-+N/A
distribute-frac-neg2N/A
distribute-neg-outN/A
remove-double-negN/A
distribute-neg-outN/A
Applied egg-rr74.7%
Taylor expanded in c around 0
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
neg-lowering-neg.f6486.7
Simplified86.7%
Final simplification76.2%
(FPCore (a b c)
:precision binary64
(if (<= b 1.6e-99)
(if (>= b 0.0)
(* c (/ 2.0 (- (- b) (sqrt (* a (* c -4.0))))))
(/ (+ b b) (* a (- 2.0))))
(if (>= b 0.0) (/ c (- b)) (/ -1.0 (* a (+ b b))))))
double code(double a, double b, double c) {
double tmp_1;
if (b <= 1.6e-99) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = c * (2.0 / (-b - sqrt((a * (c * -4.0)))));
} else {
tmp_2 = (b + b) / (a * -2.0);
}
tmp_1 = tmp_2;
} else if (b >= 0.0) {
tmp_1 = c / -b;
} else {
tmp_1 = -1.0 / (a * (b + b));
}
return tmp_1;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
if (b <= 1.6d-99) then
if (b >= 0.0d0) then
tmp_2 = c * (2.0d0 / (-b - sqrt((a * (c * (-4.0d0))))))
else
tmp_2 = (b + b) / (a * -2.0d0)
end if
tmp_1 = tmp_2
else if (b >= 0.0d0) then
tmp_1 = c / -b
else
tmp_1 = (-1.0d0) / (a * (b + b))
end if
code = tmp_1
end function
public static double code(double a, double b, double c) {
double tmp_1;
if (b <= 1.6e-99) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = c * (2.0 / (-b - Math.sqrt((a * (c * -4.0)))));
} else {
tmp_2 = (b + b) / (a * -2.0);
}
tmp_1 = tmp_2;
} else if (b >= 0.0) {
tmp_1 = c / -b;
} else {
tmp_1 = -1.0 / (a * (b + b));
}
return tmp_1;
}
def code(a, b, c): tmp_1 = 0 if b <= 1.6e-99: tmp_2 = 0 if b >= 0.0: tmp_2 = c * (2.0 / (-b - math.sqrt((a * (c * -4.0))))) else: tmp_2 = (b + b) / (a * -2.0) tmp_1 = tmp_2 elif b >= 0.0: tmp_1 = c / -b else: tmp_1 = -1.0 / (a * (b + b)) return tmp_1
function code(a, b, c) tmp_1 = 0.0 if (b <= 1.6e-99) tmp_2 = 0.0 if (b >= 0.0) tmp_2 = Float64(c * Float64(2.0 / Float64(Float64(-b) - sqrt(Float64(a * Float64(c * -4.0)))))); else tmp_2 = Float64(Float64(b + b) / Float64(a * Float64(-2.0))); end tmp_1 = tmp_2; elseif (b >= 0.0) tmp_1 = Float64(c / Float64(-b)); else tmp_1 = Float64(-1.0 / Float64(a * Float64(b + b))); end return tmp_1 end
function tmp_4 = code(a, b, c) tmp_2 = 0.0; if (b <= 1.6e-99) tmp_3 = 0.0; if (b >= 0.0) tmp_3 = c * (2.0 / (-b - sqrt((a * (c * -4.0))))); else tmp_3 = (b + b) / (a * -2.0); end tmp_2 = tmp_3; elseif (b >= 0.0) tmp_2 = c / -b; else tmp_2 = -1.0 / (a * (b + b)); end tmp_4 = tmp_2; end
code[a_, b_, c_] := If[LessEqual[b, 1.6e-99], If[GreaterEqual[b, 0.0], N[(c * N[(2.0 / N[((-b) - N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b + b), $MachinePrecision] / N[(a * (-2.0)), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(c / (-b)), $MachinePrecision], N[(-1.0 / N[(a * N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.6 \cdot 10^{-99}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{2}{\left(-b\right) - \sqrt{a \cdot \left(c \cdot -4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + b}{a \cdot \left(-2\right)}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c}{-b}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{a \cdot \left(b + b\right)}\\
\end{array}
\end{array}
if b < 1.6e-99Initial program 73.1%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6472.1
Simplified72.1%
Taylor expanded in b around 0
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6470.5
Simplified70.5%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
neg-lowering-neg.f64N/A
associate-*l*N/A
*-commutativeN/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6470.4
Applied egg-rr70.4%
if 1.6e-99 < b Initial program 74.7%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6474.7
Simplified74.7%
clear-numN/A
frac-2negN/A
metadata-evalN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
distribute-neg-frac2N/A
+-inversesN/A
flip-+N/A
distribute-frac-neg2N/A
distribute-neg-outN/A
remove-double-negN/A
distribute-neg-outN/A
Applied egg-rr74.7%
Taylor expanded in c around 0
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
neg-lowering-neg.f6486.7
Simplified86.7%
Final simplification76.2%
(FPCore (a b c) :precision binary64 (if (<= b -8.2e-274) (/ (- b) a) (if (>= b 0.0) (/ c (- b)) (/ -1.0 (* a (+ b b))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -8.2e-274) {
tmp = -b / a;
} else if (b >= 0.0) {
tmp = c / -b;
} else {
tmp = -1.0 / (a * (b + b));
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-8.2d-274)) then
tmp = -b / a
else if (b >= 0.0d0) then
tmp = c / -b
else
tmp = (-1.0d0) / (a * (b + b))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -8.2e-274) {
tmp = -b / a;
} else if (b >= 0.0) {
tmp = c / -b;
} else {
tmp = -1.0 / (a * (b + b));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -8.2e-274: tmp = -b / a elif b >= 0.0: tmp = c / -b else: tmp = -1.0 / (a * (b + b)) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -8.2e-274) tmp = Float64(Float64(-b) / a); elseif (b >= 0.0) tmp = Float64(c / Float64(-b)); else tmp = Float64(-1.0 / Float64(a * Float64(b + b))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -8.2e-274) tmp = -b / a; elseif (b >= 0.0) tmp = c / -b; else tmp = -1.0 / (a * (b + b)); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -8.2e-274], N[((-b) / a), $MachinePrecision], If[GreaterEqual[b, 0.0], N[(c / (-b)), $MachinePrecision], N[(-1.0 / N[(a * N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.2 \cdot 10^{-274}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c}{-b}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{a \cdot \left(b + b\right)}\\
\end{array}
\end{array}
if b < -8.19999999999999975e-274Initial program 70.6%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6471.5
Simplified71.5%
Taylor expanded in b around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6471.5
Simplified71.5%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
mul-1-negN/A
/-lowering-/.f64N/A
neg-lowering-neg.f6471.5
Simplified71.5%
if -8.19999999999999975e-274 < b Initial program 76.7%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6474.5
Simplified74.5%
clear-numN/A
frac-2negN/A
metadata-evalN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
distribute-neg-frac2N/A
+-inversesN/A
flip-+N/A
distribute-frac-neg2N/A
distribute-neg-outN/A
remove-double-negN/A
distribute-neg-outN/A
Applied egg-rr74.5%
Taylor expanded in c around 0
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
neg-lowering-neg.f6466.5
Simplified66.5%
(FPCore (a b c) :precision binary64 (if (<= b 2.3e-182) (/ (- b) a) (- (/ b a) (/ b a))))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.3e-182) {
tmp = -b / a;
} else {
tmp = (b / a) - (b / a);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 2.3d-182) then
tmp = -b / a
else
tmp = (b / a) - (b / a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 2.3e-182) {
tmp = -b / a;
} else {
tmp = (b / a) - (b / a);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.3e-182: tmp = -b / a else: tmp = (b / a) - (b / a) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.3e-182) tmp = Float64(Float64(-b) / a); else tmp = Float64(Float64(b / a) - Float64(b / a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 2.3e-182) tmp = -b / a; else tmp = (b / a) - (b / a); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.3e-182], N[((-b) / a), $MachinePrecision], N[(N[(b / a), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.3 \cdot 10^{-182}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b}{a} - \frac{b}{a}\\
\end{array}
\end{array}
if b < 2.2999999999999999e-182Initial program 70.3%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6469.1
Simplified69.1%
Taylor expanded in b around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6461.0
Simplified61.0%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
mul-1-negN/A
/-lowering-/.f64N/A
neg-lowering-neg.f6461.0
Simplified61.0%
if 2.2999999999999999e-182 < b Initial program 78.5%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6478.5
Simplified78.5%
Taylor expanded in b around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f642.5
Simplified2.5%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
mul-1-negN/A
/-lowering-/.f64N/A
neg-lowering-neg.f642.5
Simplified2.5%
Applied egg-rr19.3%
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (/ (* 2.0 c) (- (- b) b)) (/ (+ b b) (* a (- 2.0)))))
double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - b);
} else {
tmp = (b + b) / (a * -2.0);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b >= 0.0d0) then
tmp = (2.0d0 * c) / (-b - b)
else
tmp = (b + b) / (a * -2.0d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - b);
} else {
tmp = (b + b) / (a * -2.0);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b >= 0.0: tmp = (2.0 * c) / (-b - b) else: tmp = (b + b) / (a * -2.0) return tmp
function code(a, b, c) tmp = 0.0 if (b >= 0.0) tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - b)); else tmp = Float64(Float64(b + b) / Float64(a * Float64(-2.0))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b >= 0.0) tmp = (2.0 * c) / (-b - b); else tmp = (b + b) / (a * -2.0); end tmp_2 = tmp; end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - b), $MachinePrecision]), $MachinePrecision], N[(N[(b + b), $MachinePrecision] / N[(a * (-2.0)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + b}{a \cdot \left(-2\right)}\\
\end{array}
\end{array}
Initial program 73.7%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6473.0
Simplified73.0%
Taylor expanded in b around inf
Simplified68.9%
Final simplification68.9%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (/ (- b) a) (/ 1.0 (* a (+ b b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = -b / a;
} else {
tmp = 1.0 / (a * (b + b));
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-311)) then
tmp = -b / a
else
tmp = 1.0d0 / (a * (b + b))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = -b / a;
} else {
tmp = 1.0 / (a * (b + b));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = -b / a else: tmp = 1.0 / (a * (b + b)) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(Float64(-b) / a); else tmp = Float64(1.0 / Float64(a * Float64(b + b))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-311) tmp = -b / a; else tmp = 1.0 / (a * (b + b)); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[((-b) / a), $MachinePrecision], N[(1.0 / N[(a * N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \left(b + b\right)}\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 69.7%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6468.4
Simplified68.4%
Taylor expanded in b around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6468.4
Simplified68.4%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
mul-1-negN/A
/-lowering-/.f64N/A
neg-lowering-neg.f6468.4
Simplified68.4%
if -5.00000000000023e-311 < b Initial program 77.9%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6477.9
Simplified77.9%
Taylor expanded in b around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f642.7
Simplified2.7%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
mul-1-negN/A
/-lowering-/.f64N/A
neg-lowering-neg.f642.7
Simplified2.7%
Applied egg-rr10.0%
(FPCore (a b c) :precision binary64 (if (<= b 0.7) (/ (- b) a) (/ -1.0 (* a (+ b b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= 0.7) {
tmp = -b / a;
} else {
tmp = -1.0 / (a * (b + b));
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 0.7d0) then
tmp = -b / a
else
tmp = (-1.0d0) / (a * (b + b))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 0.7) {
tmp = -b / a;
} else {
tmp = -1.0 / (a * (b + b));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 0.7: tmp = -b / a else: tmp = -1.0 / (a * (b + b)) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 0.7) tmp = Float64(Float64(-b) / a); else tmp = Float64(-1.0 / Float64(a * Float64(b + b))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 0.7) tmp = -b / a; else tmp = -1.0 / (a * (b + b)); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 0.7], N[((-b) / a), $MachinePrecision], N[(-1.0 / N[(a * N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.7:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{a \cdot \left(b + b\right)}\\
\end{array}
\end{array}
if b < 0.69999999999999996Initial program 74.5%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6473.6
Simplified73.6%
Taylor expanded in b around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6450.5
Simplified50.5%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
mul-1-negN/A
/-lowering-/.f64N/A
neg-lowering-neg.f6450.5
Simplified50.5%
if 0.69999999999999996 < b Initial program 71.6%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6471.6
Simplified71.6%
Taylor expanded in b around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f642.3
Simplified2.3%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
mul-1-negN/A
/-lowering-/.f64N/A
neg-lowering-neg.f642.3
Simplified2.3%
Applied egg-rr13.2%
(FPCore (a b c) :precision binary64 (/ (- b) a))
double code(double a, double b, double c) {
return -b / a;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = -b / a
end function
public static double code(double a, double b, double c) {
return -b / a;
}
def code(a, b, c): return -b / a
function code(a, b, c) return Float64(Float64(-b) / a) end
function tmp = code(a, b, c) tmp = -b / a; end
code[a_, b_, c_] := N[((-b) / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{-b}{a}
\end{array}
Initial program 73.7%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6473.0
Simplified73.0%
Taylor expanded in b around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6436.6
Simplified36.6%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
mul-1-negN/A
/-lowering-/.f64N/A
neg-lowering-neg.f6436.6
Simplified36.6%
(FPCore (a b c) :precision binary64 (/ b a))
double code(double a, double b, double c) {
return b / a;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = b / a
end function
public static double code(double a, double b, double c) {
return b / a;
}
def code(a, b, c): return b / a
function code(a, b, c) return Float64(b / a) end
function tmp = code(a, b, c) tmp = b / a; end
code[a_, b_, c_] := N[(b / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{b}{a}
\end{array}
Initial program 73.7%
Taylor expanded in b around -inf
mul-1-negN/A
neg-lowering-neg.f6473.0
Simplified73.0%
Taylor expanded in b around -inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6436.6
Simplified36.6%
Taylor expanded in b around 0
if-sameN/A
associate-*r/N/A
mul-1-negN/A
/-lowering-/.f64N/A
neg-lowering-neg.f6436.6
Simplified36.6%
clear-numN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
clear-numN/A
times-fracN/A
count-2N/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
distribute-neg-frac2N/A
+-inversesN/A
flip-+N/A
distribute-neg-outN/A
remove-double-negN/A
associate-/r*N/A
Applied egg-rr2.5%
herbie shell --seed 2024205
(FPCore (a b c)
:name "jeff quadratic root 2"
:precision binary64
(if (>= b 0.0) (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))