
(FPCore (a b_2 c) :precision binary64 (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
double code(double a, double b_2, double c) {
return (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
code = (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a
end function
public static double code(double a, double b_2, double c) {
return (-b_2 + Math.sqrt(((b_2 * b_2) - (a * c)))) / a;
}
def code(a, b_2, c): return (-b_2 + math.sqrt(((b_2 * b_2) - (a * c)))) / a
function code(a, b_2, c) return Float64(Float64(Float64(-b_2) + sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))) / a) end
function tmp = code(a, b_2, c) tmp = (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a; end
code[a_, b$95$2_, c_] := N[(N[((-b$95$2) + N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b_2 c) :precision binary64 (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
double code(double a, double b_2, double c) {
return (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
code = (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a
end function
public static double code(double a, double b_2, double c) {
return (-b_2 + Math.sqrt(((b_2 * b_2) - (a * c)))) / a;
}
def code(a, b_2, c): return (-b_2 + math.sqrt(((b_2 * b_2) - (a * c)))) / a
function code(a, b_2, c) return Float64(Float64(Float64(-b_2) + sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))) / a) end
function tmp = code(a, b_2, c) tmp = (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a; end
code[a_, b$95$2_, c_] := N[(N[((-b$95$2) + N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\end{array}
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -2e+112)
(+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2)))
(if (<= b_2 4.9e-51)
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
(/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2e+112) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 4.9e-51) {
tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-2d+112)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 4.9d-51) then
tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2e+112) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 4.9e-51) {
tmp = (Math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2e+112: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 4.9e-51: tmp = (math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2e+112) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 4.9e-51) tmp = Float64(Float64(sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c))) - b_2) / a); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -2e+112) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 4.9e-51) tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a; else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2e+112], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 4.9e-51], N[(N[(N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b$95$2), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2 \cdot 10^{+112}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 4.9 \cdot 10^{-51}:\\
\;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < -1.9999999999999999e112Initial program 51.6%
+-commutative51.6%
unsub-neg51.6%
Simplified51.6%
Taylor expanded in b_2 around -inf 95.1%
if -1.9999999999999999e112 < b_2 < 4.89999999999999974e-51Initial program 83.0%
+-commutative83.0%
unsub-neg83.0%
Simplified83.0%
if 4.89999999999999974e-51 < b_2 Initial program 13.7%
+-commutative13.7%
unsub-neg13.7%
Simplified13.7%
pow1/213.7%
pow-to-exp11.6%
fma-neg11.6%
*-commutative11.6%
distribute-rgt-neg-in11.6%
Applied egg-rr11.6%
Taylor expanded in b_2 around inf 81.1%
associate-*r/81.1%
Simplified81.1%
Final simplification85.1%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -1.42e-18) (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))) (if (<= b_2 4.7e-49) (/ (- (sqrt (* c (- a))) b_2) a) (/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -1.42e-18) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 4.7e-49) {
tmp = (sqrt((c * -a)) - b_2) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-1.42d-18)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 4.7d-49) then
tmp = (sqrt((c * -a)) - b_2) / a
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -1.42e-18) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 4.7e-49) {
tmp = (Math.sqrt((c * -a)) - b_2) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -1.42e-18: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 4.7e-49: tmp = (math.sqrt((c * -a)) - b_2) / a else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -1.42e-18) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 4.7e-49) tmp = Float64(Float64(sqrt(Float64(c * Float64(-a))) - b_2) / a); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -1.42e-18) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 4.7e-49) tmp = (sqrt((c * -a)) - b_2) / a; else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -1.42e-18], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 4.7e-49], N[(N[(N[Sqrt[N[(c * (-a)), $MachinePrecision]], $MachinePrecision] - b$95$2), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -1.42 \cdot 10^{-18}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 4.7 \cdot 10^{-49}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(-a\right)} - b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < -1.41999999999999996e-18Initial program 64.8%
+-commutative64.8%
unsub-neg64.8%
Simplified64.8%
Taylor expanded in b_2 around -inf 90.0%
if -1.41999999999999996e-18 < b_2 < 4.70000000000000021e-49Initial program 80.2%
+-commutative80.2%
unsub-neg80.2%
Simplified80.2%
Taylor expanded in b_2 around 0 72.6%
associate-*r*72.6%
neg-mul-172.6%
*-commutative72.6%
Simplified72.6%
if 4.70000000000000021e-49 < b_2 Initial program 13.7%
+-commutative13.7%
unsub-neg13.7%
Simplified13.7%
pow1/213.7%
pow-to-exp11.6%
fma-neg11.6%
*-commutative11.6%
distribute-rgt-neg-in11.6%
Applied egg-rr11.6%
Taylor expanded in b_2 around inf 81.1%
associate-*r/81.1%
Simplified81.1%
Final simplification80.9%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -1.5e-18) (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))) (if (<= b_2 1.08e-10) (/ (sqrt (* a (/ c -1.0))) a) (/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -1.5e-18) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 1.08e-10) {
tmp = sqrt((a * (c / -1.0))) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-1.5d-18)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 1.08d-10) then
tmp = sqrt((a * (c / (-1.0d0)))) / a
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -1.5e-18) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 1.08e-10) {
tmp = Math.sqrt((a * (c / -1.0))) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -1.5e-18: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 1.08e-10: tmp = math.sqrt((a * (c / -1.0))) / a else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -1.5e-18) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 1.08e-10) tmp = Float64(sqrt(Float64(a * Float64(c / -1.0))) / a); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -1.5e-18) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 1.08e-10) tmp = sqrt((a * (c / -1.0))) / a; else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -1.5e-18], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 1.08e-10], N[(N[Sqrt[N[(a * N[(c / -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -1.5 \cdot 10^{-18}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 1.08 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sqrt{a \cdot \frac{c}{-1}}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < -1.49999999999999991e-18Initial program 64.8%
+-commutative64.8%
unsub-neg64.8%
Simplified64.8%
Taylor expanded in b_2 around -inf 90.0%
if -1.49999999999999991e-18 < b_2 < 1.08000000000000002e-10Initial program 77.8%
+-commutative77.8%
unsub-neg77.8%
Simplified77.8%
pow1/277.8%
pow-to-exp73.3%
fma-neg73.3%
*-commutative73.3%
distribute-rgt-neg-in73.3%
Applied egg-rr73.3%
Taylor expanded in a around -inf 37.7%
mul-1-neg37.7%
unsub-neg37.7%
Simplified37.7%
Taylor expanded in b_2 around 0 37.5%
log-div65.6%
*-commutative65.6%
exp-to-pow69.6%
unpow1/269.6%
associate-/r/69.7%
*-commutative69.7%
Simplified69.7%
if 1.08000000000000002e-10 < b_2 Initial program 10.7%
+-commutative10.7%
unsub-neg10.7%
Simplified10.7%
pow1/210.7%
pow-to-exp8.6%
fma-neg8.6%
*-commutative8.6%
distribute-rgt-neg-in8.6%
Applied egg-rr8.6%
Taylor expanded in b_2 around inf 84.6%
associate-*r/84.6%
Simplified84.6%
Final simplification80.5%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -5e-310) (- (- (- (* (/ c b_2) -0.5)) (/ b_2 a)) (/ b_2 a)) (/ (* c -0.5) b_2)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = (-((c / b_2) * -0.5) - (b_2 / a)) - (b_2 / a);
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-5d-310)) then
tmp = (-((c / b_2) * (-0.5d0)) - (b_2 / a)) - (b_2 / a)
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = (-((c / b_2) * -0.5) - (b_2 / a)) - (b_2 / a);
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -5e-310: tmp = (-((c / b_2) * -0.5) - (b_2 / a)) - (b_2 / a) else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -5e-310) tmp = Float64(Float64(Float64(-Float64(Float64(c / b_2) * -0.5)) - Float64(b_2 / a)) - Float64(b_2 / a)); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -5e-310) tmp = (-((c / b_2) * -0.5) - (b_2 / a)) - (b_2 / a); else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -5e-310], N[(N[((-N[(N[(c / b$95$2), $MachinePrecision] * -0.5), $MachinePrecision]) - N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] - N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(-\frac{c}{b_2} \cdot -0.5\right) - \frac{b_2}{a}\right) - \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < -4.999999999999985e-310Initial program 70.6%
+-commutative70.6%
unsub-neg70.6%
Simplified70.6%
div-sub70.5%
sub-neg70.5%
add-sqr-sqrt52.7%
hypot-def63.0%
*-commutative63.0%
distribute-rgt-neg-in63.0%
Applied egg-rr63.0%
Taylor expanded in b_2 around -inf 0.0%
neg-mul-10.0%
+-commutative0.0%
unsub-neg0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt67.6%
mul-1-neg67.6%
Simplified67.6%
if -4.999999999999985e-310 < b_2 Initial program 39.8%
+-commutative39.8%
unsub-neg39.8%
Simplified39.8%
pow1/239.8%
pow-to-exp36.5%
fma-neg36.5%
*-commutative36.5%
distribute-rgt-neg-in36.5%
Applied egg-rr36.5%
Taylor expanded in b_2 around inf 54.6%
associate-*r/54.6%
Simplified54.6%
Final simplification61.0%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -5e-310) (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))) (/ (* c -0.5) b_2)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-5d-310)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -5e-310: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -5e-310) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -5e-310) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -5e-310], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < -4.999999999999985e-310Initial program 70.6%
+-commutative70.6%
unsub-neg70.6%
Simplified70.6%
Taylor expanded in b_2 around -inf 67.6%
if -4.999999999999985e-310 < b_2 Initial program 39.8%
+-commutative39.8%
unsub-neg39.8%
Simplified39.8%
pow1/239.8%
pow-to-exp36.5%
fma-neg36.5%
*-commutative36.5%
distribute-rgt-neg-in36.5%
Applied egg-rr36.5%
Taylor expanded in b_2 around inf 54.6%
associate-*r/54.6%
Simplified54.6%
Final simplification61.0%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -5e-310) (* -2.0 (/ b_2 a)) 0.0))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-5d-310)) then
tmp = (-2.0d0) * (b_2 / a)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -5e-310: tmp = -2.0 * (b_2 / a) else: tmp = 0.0 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -5e-310) tmp = Float64(-2.0 * Float64(b_2 / a)); else tmp = 0.0; end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -5e-310) tmp = -2.0 * (b_2 / a); else tmp = 0.0; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -5e-310], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b_2 < -4.999999999999985e-310Initial program 70.6%
+-commutative70.6%
unsub-neg70.6%
Simplified70.6%
Taylor expanded in b_2 around -inf 67.4%
if -4.999999999999985e-310 < b_2 Initial program 39.8%
+-commutative39.8%
unsub-neg39.8%
Simplified39.8%
add-sqr-sqrt39.5%
pow239.5%
pow1/239.5%
sqrt-pow139.6%
fma-neg39.6%
*-commutative39.6%
distribute-rgt-neg-in39.6%
metadata-eval39.6%
Applied egg-rr39.6%
Taylor expanded in b_2 around inf 12.5%
Taylor expanded in a around 0 17.6%
distribute-rgt1-in17.6%
metadata-eval17.6%
metadata-eval17.6%
associate-*r/11.1%
metadata-eval11.1%
mul0-lft17.6%
Simplified17.6%
Final simplification42.1%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -5e-310) (* -2.0 (/ b_2 a)) (* (/ c b_2) -0.5)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-5d-310)) then
tmp = (-2.0d0) * (b_2 / a)
else
tmp = (c / b_2) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -5e-310: tmp = -2.0 * (b_2 / a) else: tmp = (c / b_2) * -0.5 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -5e-310) tmp = Float64(-2.0 * Float64(b_2 / a)); else tmp = Float64(Float64(c / b_2) * -0.5); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -5e-310) tmp = -2.0 * (b_2 / a); else tmp = (c / b_2) * -0.5; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -5e-310], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b$95$2), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < -4.999999999999985e-310Initial program 70.6%
+-commutative70.6%
unsub-neg70.6%
Simplified70.6%
Taylor expanded in b_2 around -inf 67.4%
if -4.999999999999985e-310 < b_2 Initial program 39.8%
+-commutative39.8%
unsub-neg39.8%
Simplified39.8%
Taylor expanded in b_2 around inf 54.6%
Final simplification60.9%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -5e-310) (* -2.0 (/ b_2 a)) (/ (* c -0.5) b_2)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-5d-310)) then
tmp = (-2.0d0) * (b_2 / a)
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -5e-310: tmp = -2.0 * (b_2 / a) else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -5e-310) tmp = Float64(-2.0 * Float64(b_2 / a)); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -5e-310) tmp = -2.0 * (b_2 / a); else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -5e-310], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < -4.999999999999985e-310Initial program 70.6%
+-commutative70.6%
unsub-neg70.6%
Simplified70.6%
Taylor expanded in b_2 around -inf 67.4%
if -4.999999999999985e-310 < b_2 Initial program 39.8%
+-commutative39.8%
unsub-neg39.8%
Simplified39.8%
pow1/239.8%
pow-to-exp36.5%
fma-neg36.5%
*-commutative36.5%
distribute-rgt-neg-in36.5%
Applied egg-rr36.5%
Taylor expanded in b_2 around inf 54.6%
associate-*r/54.6%
Simplified54.6%
Final simplification60.9%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -5e-310) (/ (- b_2) a) 0.0))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = -b_2 / a;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-5d-310)) then
tmp = -b_2 / a
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = -b_2 / a;
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -5e-310: tmp = -b_2 / a else: tmp = 0.0 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -5e-310) tmp = Float64(Float64(-b_2) / a); else tmp = 0.0; end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -5e-310) tmp = -b_2 / a; else tmp = 0.0; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -5e-310], N[((-b$95$2) / a), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b_2 < -4.999999999999985e-310Initial program 70.6%
+-commutative70.6%
unsub-neg70.6%
Simplified70.6%
pow1/270.6%
pow-to-exp67.7%
fma-neg67.7%
*-commutative67.7%
distribute-rgt-neg-in67.7%
Applied egg-rr67.7%
Taylor expanded in a around -inf 22.2%
mul-1-neg22.2%
unsub-neg22.2%
Simplified22.2%
Taylor expanded in b_2 around inf 28.5%
neg-mul-128.5%
distribute-neg-frac28.5%
Simplified28.5%
if -4.999999999999985e-310 < b_2 Initial program 39.8%
+-commutative39.8%
unsub-neg39.8%
Simplified39.8%
add-sqr-sqrt39.5%
pow239.5%
pow1/239.5%
sqrt-pow139.6%
fma-neg39.6%
*-commutative39.6%
distribute-rgt-neg-in39.6%
metadata-eval39.6%
Applied egg-rr39.6%
Taylor expanded in b_2 around inf 12.5%
Taylor expanded in a around 0 17.6%
distribute-rgt1-in17.6%
metadata-eval17.6%
metadata-eval17.6%
associate-*r/11.1%
metadata-eval11.1%
mul0-lft17.6%
Simplified17.6%
Final simplification23.0%
(FPCore (a b_2 c) :precision binary64 0.0)
double code(double a, double b_2, double c) {
return 0.0;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
code = 0.0d0
end function
public static double code(double a, double b_2, double c) {
return 0.0;
}
def code(a, b_2, c): return 0.0
function code(a, b_2, c) return 0.0 end
function tmp = code(a, b_2, c) tmp = 0.0; end
code[a_, b$95$2_, c_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 54.9%
+-commutative54.9%
unsub-neg54.9%
Simplified54.9%
add-sqr-sqrt54.7%
pow254.7%
pow1/254.7%
sqrt-pow154.7%
fma-neg54.7%
*-commutative54.7%
distribute-rgt-neg-in54.7%
metadata-eval54.7%
Applied egg-rr54.7%
Taylor expanded in b_2 around inf 7.2%
Taylor expanded in a around 0 10.3%
distribute-rgt1-in10.3%
metadata-eval10.3%
metadata-eval10.3%
associate-*r/6.8%
metadata-eval6.8%
mul0-lft10.3%
Simplified10.3%
Final simplification10.3%
herbie shell --seed 2023271
(FPCore (a b_2 c)
:name "quad2p (problem 3.2.1, positive)"
:precision binary64
(/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))