
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * 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 + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * 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 + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b -1.66e+180)
(* (/ 0.5 a) (- (fabs (fma a (* -2.0 (/ c b)) b)) b))
(if (<= b 3.4e-79)
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))
(- (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.66e+180) {
tmp = (0.5 / a) * (fabs(fma(a, (-2.0 * (c / b)), b)) - b);
} else if (b <= 3.4e-79) {
tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
} else {
tmp = -(c / b);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -1.66e+180) tmp = Float64(Float64(0.5 / a) * Float64(abs(fma(a, Float64(-2.0 * Float64(c / b)), b)) - b)); elseif (b <= 3.4e-79) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)); else tmp = Float64(-Float64(c / b)); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -1.66e+180], N[(N[(0.5 / a), $MachinePrecision] * N[(N[Abs[N[(a * N[(-2.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.4e-79], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], (-N[(c / b), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.66 \cdot 10^{+180}:\\
\;\;\;\;\frac{0.5}{a} \cdot \left(\left|\mathsf{fma}\left(a, -2 \cdot \frac{c}{b}, b\right)\right| - b\right)\\
\mathbf{elif}\;b \leq 3.4 \cdot 10^{-79}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;-\frac{c}{b}\\
\end{array}
\end{array}
if b < -1.6600000000000001e180Initial program 47.9%
*-commutative47.9%
Simplified47.9%
Applied egg-rr48.0%
sub-neg48.0%
distribute-rgt-out--48.0%
Simplified48.0%
Taylor expanded in a around 0 2.0%
associate-*r/2.0%
associate-*r*2.0%
*-commutative2.0%
associate-*l*2.0%
Simplified2.0%
add-sqr-sqrt0.2%
sqrt-unprod48.0%
pow248.0%
+-commutative48.0%
associate-/l*48.0%
fma-define48.0%
*-commutative48.0%
Applied egg-rr48.0%
unpow248.0%
rem-sqrt-square97.7%
*-commutative97.7%
associate-*r/97.7%
Simplified97.7%
if -1.6600000000000001e180 < b < 3.39999999999999976e-79Initial program 85.0%
if 3.39999999999999976e-79 < b Initial program 18.6%
*-commutative18.6%
Simplified18.6%
Taylor expanded in b around inf 86.4%
associate-*r/86.4%
mul-1-neg86.4%
Simplified86.4%
Final simplification87.6%
(FPCore (a b c)
:precision binary64
(if (<= b -7.2e+63)
(/ b (- a))
(if (<= b 1.1e-78)
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))
(- (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.2e+63) {
tmp = b / -a;
} else if (b <= 1.1e-78) {
tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
} else {
tmp = -(c / 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 <= (-7.2d+63)) then
tmp = b / -a
else if (b <= 1.1d-78) then
tmp = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
else
tmp = -(c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -7.2e+63) {
tmp = b / -a;
} else if (b <= 1.1e-78) {
tmp = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
} else {
tmp = -(c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7.2e+63: tmp = b / -a elif b <= 1.1e-78: tmp = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0) else: tmp = -(c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7.2e+63) tmp = Float64(b / Float64(-a)); elseif (b <= 1.1e-78) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)); else tmp = Float64(-Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -7.2e+63) tmp = b / -a; elseif (b <= 1.1e-78) tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0); else tmp = -(c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7.2e+63], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 1.1e-78], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], (-N[(c / b), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.2 \cdot 10^{+63}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{elif}\;b \leq 1.1 \cdot 10^{-78}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;-\frac{c}{b}\\
\end{array}
\end{array}
if b < -7.19999999999999998e63Initial program 64.8%
*-commutative64.8%
Simplified64.8%
Taylor expanded in b around -inf 96.7%
associate-*r/96.7%
mul-1-neg96.7%
Simplified96.7%
if -7.19999999999999998e63 < b < 1.0999999999999999e-78Initial program 82.4%
if 1.0999999999999999e-78 < b Initial program 18.6%
*-commutative18.6%
Simplified18.6%
Taylor expanded in b around inf 86.4%
associate-*r/86.4%
mul-1-neg86.4%
Simplified86.4%
Final simplification87.5%
(FPCore (a b c)
:precision binary64
(if (<= b -1.55e-27)
(/ b (- a))
(if (<= b 2.6e-84)
(/ (- (sqrt (* a (* c -4.0))) b) (* a 2.0))
(- (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.55e-27) {
tmp = b / -a;
} else if (b <= 2.6e-84) {
tmp = (sqrt((a * (c * -4.0))) - b) / (a * 2.0);
} else {
tmp = -(c / 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 <= (-1.55d-27)) then
tmp = b / -a
else if (b <= 2.6d-84) then
tmp = (sqrt((a * (c * (-4.0d0)))) - b) / (a * 2.0d0)
else
tmp = -(c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.55e-27) {
tmp = b / -a;
} else if (b <= 2.6e-84) {
tmp = (Math.sqrt((a * (c * -4.0))) - b) / (a * 2.0);
} else {
tmp = -(c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.55e-27: tmp = b / -a elif b <= 2.6e-84: tmp = (math.sqrt((a * (c * -4.0))) - b) / (a * 2.0) else: tmp = -(c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.55e-27) tmp = Float64(b / Float64(-a)); elseif (b <= 2.6e-84) tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -4.0))) - b) / Float64(a * 2.0)); else tmp = Float64(-Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.55e-27) tmp = b / -a; elseif (b <= 2.6e-84) tmp = (sqrt((a * (c * -4.0))) - b) / (a * 2.0); else tmp = -(c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.55e-27], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 2.6e-84], N[(N[(N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], (-N[(c / b), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.55 \cdot 10^{-27}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{elif}\;b \leq 2.6 \cdot 10^{-84}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -4\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;-\frac{c}{b}\\
\end{array}
\end{array}
if b < -1.5499999999999999e-27Initial program 72.8%
*-commutative72.8%
Simplified72.8%
Taylor expanded in b around -inf 95.4%
associate-*r/95.4%
mul-1-neg95.4%
Simplified95.4%
if -1.5499999999999999e-27 < b < 2.6e-84Initial program 78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in b around 0 68.6%
*-commutative68.6%
associate-*r*68.6%
Simplified68.6%
if 2.6e-84 < b Initial program 19.2%
*-commutative19.2%
Simplified19.2%
Taylor expanded in b around inf 86.0%
associate-*r/86.0%
mul-1-neg86.0%
Simplified86.0%
Final simplification83.9%
(FPCore (a b c) :precision binary64 (if (<= b -8.2e-159) (/ b (- a)) (if (<= b 5.3e-90) (* -0.5 (- (sqrt (* c (/ -4.0 a))))) (- (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -8.2e-159) {
tmp = b / -a;
} else if (b <= 5.3e-90) {
tmp = -0.5 * -sqrt((c * (-4.0 / a)));
} else {
tmp = -(c / 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-159)) then
tmp = b / -a
else if (b <= 5.3d-90) then
tmp = (-0.5d0) * -sqrt((c * ((-4.0d0) / a)))
else
tmp = -(c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -8.2e-159) {
tmp = b / -a;
} else if (b <= 5.3e-90) {
tmp = -0.5 * -Math.sqrt((c * (-4.0 / a)));
} else {
tmp = -(c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -8.2e-159: tmp = b / -a elif b <= 5.3e-90: tmp = -0.5 * -math.sqrt((c * (-4.0 / a))) else: tmp = -(c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -8.2e-159) tmp = Float64(b / Float64(-a)); elseif (b <= 5.3e-90) tmp = Float64(-0.5 * Float64(-sqrt(Float64(c * Float64(-4.0 / a))))); else tmp = Float64(-Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -8.2e-159) tmp = b / -a; elseif (b <= 5.3e-90) tmp = -0.5 * -sqrt((c * (-4.0 / a))); else tmp = -(c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -8.2e-159], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 5.3e-90], N[(-0.5 * (-N[Sqrt[N[(c * N[(-4.0 / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], (-N[(c / b), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.2 \cdot 10^{-159}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{elif}\;b \leq 5.3 \cdot 10^{-90}:\\
\;\;\;\;-0.5 \cdot \left(-\sqrt{c \cdot \frac{-4}{a}}\right)\\
\mathbf{else}:\\
\;\;\;\;-\frac{c}{b}\\
\end{array}
\end{array}
if b < -8.20000000000000029e-159Initial program 76.7%
*-commutative76.7%
Simplified76.7%
Taylor expanded in b around -inf 79.5%
associate-*r/79.5%
mul-1-neg79.5%
Simplified79.5%
if -8.20000000000000029e-159 < b < 5.3000000000000004e-90Initial program 72.0%
*-commutative72.0%
Simplified72.0%
add-cube-cbrt71.6%
pow371.6%
Applied egg-rr71.6%
Taylor expanded in a around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt43.4%
associate-/l*43.3%
rem-cube-cbrt43.8%
Simplified43.8%
if 5.3000000000000004e-90 < b Initial program 19.2%
*-commutative19.2%
Simplified19.2%
Taylor expanded in b around inf 86.0%
associate-*r/86.0%
mul-1-neg86.0%
Simplified86.0%
Final simplification75.1%
(FPCore (a b c) :precision binary64 (if (<= b 3.5e-302) (/ b (- a)) (- (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.5e-302) {
tmp = b / -a;
} else {
tmp = -(c / 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 <= 3.5d-302) then
tmp = b / -a
else
tmp = -(c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 3.5e-302) {
tmp = b / -a;
} else {
tmp = -(c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3.5e-302: tmp = b / -a else: tmp = -(c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3.5e-302) tmp = Float64(b / Float64(-a)); else tmp = Float64(-Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 3.5e-302) tmp = b / -a; else tmp = -(c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3.5e-302], N[(b / (-a)), $MachinePrecision], (-N[(c / b), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.5 \cdot 10^{-302}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{else}:\\
\;\;\;\;-\frac{c}{b}\\
\end{array}
\end{array}
if b < 3.5000000000000001e-302Initial program 76.5%
*-commutative76.5%
Simplified76.5%
Taylor expanded in b around -inf 68.1%
associate-*r/68.1%
mul-1-neg68.1%
Simplified68.1%
if 3.5000000000000001e-302 < b Initial program 30.9%
*-commutative30.9%
Simplified30.9%
Taylor expanded in b around inf 68.8%
associate-*r/68.8%
mul-1-neg68.8%
Simplified68.8%
Final simplification68.4%
(FPCore (a b c) :precision binary64 (if (<= b 8e+26) (/ b (- a)) (/ c b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 8e+26) {
tmp = b / -a;
} else {
tmp = c / 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 <= 8d+26) then
tmp = b / -a
else
tmp = c / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 8e+26) {
tmp = b / -a;
} else {
tmp = c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 8e+26: tmp = b / -a else: tmp = c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 8e+26) tmp = Float64(b / Float64(-a)); else tmp = Float64(c / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 8e+26) tmp = b / -a; else tmp = c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 8e+26], N[(b / (-a)), $MachinePrecision], N[(c / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8 \cdot 10^{+26}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b}\\
\end{array}
\end{array}
if b < 8.00000000000000038e26Initial program 71.4%
*-commutative71.4%
Simplified71.4%
Taylor expanded in b around -inf 49.4%
associate-*r/49.4%
mul-1-neg49.4%
Simplified49.4%
if 8.00000000000000038e26 < b Initial program 11.2%
*-commutative11.2%
Simplified11.2%
Taylor expanded in b around inf 95.1%
associate-*r/95.1%
mul-1-neg95.1%
Simplified95.1%
add-sqr-sqrt39.8%
sqrt-unprod48.1%
sqr-neg48.1%
sqrt-unprod17.8%
add-sqr-sqrt33.0%
div-inv33.0%
Applied egg-rr33.0%
associate-*r/33.0%
*-rgt-identity33.0%
Simplified33.0%
Final simplification44.7%
(FPCore (a b c) :precision binary64 (/ c b))
double code(double a, double b, double c) {
return c / b;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c / b
end function
public static double code(double a, double b, double c) {
return c / b;
}
def code(a, b, c): return c / b
function code(a, b, c) return Float64(c / b) end
function tmp = code(a, b, c) tmp = c / b; end
code[a_, b_, c_] := N[(c / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{c}{b}
\end{array}
Initial program 54.2%
*-commutative54.2%
Simplified54.2%
Taylor expanded in b around inf 34.7%
associate-*r/34.7%
mul-1-neg34.7%
Simplified34.7%
add-sqr-sqrt14.4%
sqrt-unprod18.9%
sqr-neg18.9%
sqrt-unprod6.1%
add-sqr-sqrt11.6%
div-inv11.6%
Applied egg-rr11.6%
associate-*r/11.6%
*-rgt-identity11.6%
Simplified11.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 54.2%
*-commutative54.2%
Simplified54.2%
Taylor expanded in b around -inf 36.2%
associate-*r/36.2%
mul-1-neg36.2%
Simplified36.2%
div-inv36.1%
add-sqr-sqrt34.6%
sqrt-unprod28.2%
sqr-neg28.2%
sqrt-prod1.8%
add-sqr-sqrt2.5%
Applied egg-rr2.5%
associate-*r/2.5%
*-rgt-identity2.5%
Simplified2.5%
herbie shell --seed 2024121
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))