
(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(4.0 * Float64(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[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 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(4.0 * Float64(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[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b -1.08e-97)
(/ (- c) b)
(if (<= b 8.5e+94)
(* -0.5 (/ (+ b (sqrt (fma a (* c -4.0) (* b b)))) a))
(/ (- b) a))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.08e-97) {
tmp = -c / b;
} else if (b <= 8.5e+94) {
tmp = -0.5 * ((b + sqrt(fma(a, (c * -4.0), (b * b)))) / a);
} else {
tmp = -b / a;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -1.08e-97) tmp = Float64(Float64(-c) / b); elseif (b <= 8.5e+94) tmp = Float64(-0.5 * Float64(Float64(b + sqrt(fma(a, Float64(c * -4.0), Float64(b * b)))) / a)); else tmp = Float64(Float64(-b) / a); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -1.08e-97], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 8.5e+94], N[(-0.5 * N[(N[(b + N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[((-b) / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.08 \cdot 10^{-97}:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{elif}\;b \leq 8.5 \cdot 10^{+94}:\\
\;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-b}{a}\\
\end{array}
\end{array}
if b < -1.0799999999999999e-97Initial program 17.5%
Simplified17.6%
Taylor expanded in b around -inf 85.9%
associate-*r/85.9%
neg-mul-185.9%
Simplified85.9%
if -1.0799999999999999e-97 < b < 8.50000000000000054e94Initial program 92.2%
Simplified92.2%
if 8.50000000000000054e94 < b Initial program 53.1%
Simplified53.3%
Taylor expanded in b around inf 100.0%
associate-*r/100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification91.7%
(FPCore (a b c)
:precision binary64
(if (<= b -1.08e-97)
(/ (- c) b)
(if (<= b 1.6e+95)
(/ (- (- b) (sqrt (- (* b b) (* 4.0 (* c a))))) (* a 2.0))
(/ (- b) a))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.08e-97) {
tmp = -c / b;
} else if (b <= 1.6e+95) {
tmp = (-b - sqrt(((b * b) - (4.0 * (c * a))))) / (a * 2.0);
} else {
tmp = -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 <= (-1.08d-97)) then
tmp = -c / b
else if (b <= 1.6d+95) then
tmp = (-b - sqrt(((b * b) - (4.0d0 * (c * a))))) / (a * 2.0d0)
else
tmp = -b / a
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.08e-97) {
tmp = -c / b;
} else if (b <= 1.6e+95) {
tmp = (-b - Math.sqrt(((b * b) - (4.0 * (c * a))))) / (a * 2.0);
} else {
tmp = -b / a;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.08e-97: tmp = -c / b elif b <= 1.6e+95: tmp = (-b - math.sqrt(((b * b) - (4.0 * (c * a))))) / (a * 2.0) else: tmp = -b / a return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.08e-97) tmp = Float64(Float64(-c) / b); elseif (b <= 1.6e+95) tmp = Float64(Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(c * a))))) / Float64(a * 2.0)); else tmp = Float64(Float64(-b) / a); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.08e-97) tmp = -c / b; elseif (b <= 1.6e+95) tmp = (-b - sqrt(((b * b) - (4.0 * (c * a))))) / (a * 2.0); else tmp = -b / a; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.08e-97], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 1.6e+95], N[(N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[((-b) / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.08 \cdot 10^{-97}:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{elif}\;b \leq 1.6 \cdot 10^{+95}:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-b}{a}\\
\end{array}
\end{array}
if b < -1.0799999999999999e-97Initial program 17.5%
Simplified17.6%
Taylor expanded in b around -inf 85.9%
associate-*r/85.9%
neg-mul-185.9%
Simplified85.9%
if -1.0799999999999999e-97 < b < 1.6e95Initial program 92.2%
if 1.6e95 < b Initial program 53.1%
Simplified53.3%
Taylor expanded in b around inf 100.0%
associate-*r/100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification91.7%
(FPCore (a b c)
:precision binary64
(if (<= b -8.2e-98)
(/ (- c) b)
(if (<= b 2.3e-67)
(* (- b (sqrt (* a (* c -4.0)))) (/ 0.5 a))
(- (/ c b) (/ b a)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -8.2e-98) {
tmp = -c / b;
} else if (b <= 2.3e-67) {
tmp = (b - sqrt((a * (c * -4.0)))) * (0.5 / a);
} else {
tmp = (c / b) - (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 <= (-8.2d-98)) then
tmp = -c / b
else if (b <= 2.3d-67) then
tmp = (b - sqrt((a * (c * (-4.0d0))))) * (0.5d0 / a)
else
tmp = (c / b) - (b / a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -8.2e-98) {
tmp = -c / b;
} else if (b <= 2.3e-67) {
tmp = (b - Math.sqrt((a * (c * -4.0)))) * (0.5 / a);
} else {
tmp = (c / b) - (b / a);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -8.2e-98: tmp = -c / b elif b <= 2.3e-67: tmp = (b - math.sqrt((a * (c * -4.0)))) * (0.5 / a) else: tmp = (c / b) - (b / a) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -8.2e-98) tmp = Float64(Float64(-c) / b); elseif (b <= 2.3e-67) tmp = Float64(Float64(b - sqrt(Float64(a * Float64(c * -4.0)))) * Float64(0.5 / a)); else tmp = Float64(Float64(c / b) - Float64(b / a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -8.2e-98) tmp = -c / b; elseif (b <= 2.3e-67) tmp = (b - sqrt((a * (c * -4.0)))) * (0.5 / a); else tmp = (c / b) - (b / a); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -8.2e-98], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 2.3e-67], N[(N[(b - N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.2 \cdot 10^{-98}:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{-67}:\\
\;\;\;\;\left(b - \sqrt{a \cdot \left(c \cdot -4\right)}\right) \cdot \frac{0.5}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}
\end{array}
if b < -8.1999999999999996e-98Initial program 17.5%
Simplified17.6%
Taylor expanded in b around -inf 85.9%
associate-*r/85.9%
neg-mul-185.9%
Simplified85.9%
if -8.1999999999999996e-98 < b < 2.3e-67Initial program 90.3%
Taylor expanded in b around 0 88.2%
*-commutative88.2%
associate-*l*88.3%
Simplified88.3%
div-inv88.3%
add-sqr-sqrt42.3%
sqrt-unprod87.9%
sqr-neg87.9%
sqrt-prod45.7%
add-sqr-sqrt87.7%
*-commutative87.7%
associate-*r*87.7%
*-commutative87.7%
associate-/r*87.7%
metadata-eval87.7%
Applied egg-rr87.7%
if 2.3e-67 < b Initial program 66.5%
Simplified66.6%
Taylor expanded in b around inf 93.8%
mul-1-neg93.8%
unsub-neg93.8%
Simplified93.8%
Final simplification89.2%
(FPCore (a b c)
:precision binary64
(if (<= b -1.02e-97)
(/ (- c) b)
(if (<= b 3.1e-65)
(* -0.5 (/ (+ b (sqrt (* a (* c -4.0)))) a))
(- (/ c b) (/ b a)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.02e-97) {
tmp = -c / b;
} else if (b <= 3.1e-65) {
tmp = -0.5 * ((b + sqrt((a * (c * -4.0)))) / a);
} else {
tmp = (c / b) - (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 <= (-1.02d-97)) then
tmp = -c / b
else if (b <= 3.1d-65) then
tmp = (-0.5d0) * ((b + sqrt((a * (c * (-4.0d0))))) / a)
else
tmp = (c / b) - (b / a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.02e-97) {
tmp = -c / b;
} else if (b <= 3.1e-65) {
tmp = -0.5 * ((b + Math.sqrt((a * (c * -4.0)))) / a);
} else {
tmp = (c / b) - (b / a);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.02e-97: tmp = -c / b elif b <= 3.1e-65: tmp = -0.5 * ((b + math.sqrt((a * (c * -4.0)))) / a) else: tmp = (c / b) - (b / a) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.02e-97) tmp = Float64(Float64(-c) / b); elseif (b <= 3.1e-65) tmp = Float64(-0.5 * Float64(Float64(b + sqrt(Float64(a * Float64(c * -4.0)))) / a)); else tmp = Float64(Float64(c / b) - Float64(b / a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.02e-97) tmp = -c / b; elseif (b <= 3.1e-65) tmp = -0.5 * ((b + sqrt((a * (c * -4.0)))) / a); else tmp = (c / b) - (b / a); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.02e-97], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 3.1e-65], N[(-0.5 * N[(N[(b + N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.02 \cdot 10^{-97}:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{elif}\;b \leq 3.1 \cdot 10^{-65}:\\
\;\;\;\;-0.5 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -4\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\end{array}
\end{array}
if b < -1.02000000000000004e-97Initial program 17.5%
Simplified17.6%
Taylor expanded in b around -inf 85.9%
associate-*r/85.9%
neg-mul-185.9%
Simplified85.9%
if -1.02000000000000004e-97 < b < 3.10000000000000016e-65Initial program 90.3%
Taylor expanded in b around 0 88.2%
*-commutative88.2%
associate-*l*88.3%
Simplified88.3%
frac-2neg88.3%
div-inv88.3%
neg-sub088.3%
add-sqr-sqrt42.3%
sqrt-unprod87.9%
sqr-neg87.9%
sqrt-prod45.7%
add-sqr-sqrt87.7%
associate-+l-87.7%
neg-sub087.7%
add-sqr-sqrt42.0%
sqrt-unprod88.0%
sqr-neg88.0%
sqrt-prod46.0%
add-sqr-sqrt88.3%
*-commutative88.3%
associate-*r*88.3%
*-commutative88.3%
*-commutative88.3%
distribute-rgt-neg-in88.3%
Applied egg-rr88.3%
associate-*r/88.3%
times-frac88.3%
metadata-eval88.3%
Simplified88.3%
if 3.10000000000000016e-65 < b Initial program 66.5%
Simplified66.6%
Taylor expanded in b around inf 93.8%
mul-1-neg93.8%
unsub-neg93.8%
Simplified93.8%
Final simplification89.3%
(FPCore (a b c) :precision binary64 (if (<= b -5.8e-275) (/ (- c) b) (/ (- b) a)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.8e-275) {
tmp = -c / b;
} else {
tmp = -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 <= (-5.8d-275)) then
tmp = -c / b
else
tmp = -b / a
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5.8e-275) {
tmp = -c / b;
} else {
tmp = -b / a;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.8e-275: tmp = -c / b else: tmp = -b / a return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.8e-275) tmp = Float64(Float64(-c) / b); else tmp = Float64(Float64(-b) / a); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5.8e-275) tmp = -c / b; else tmp = -b / a; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.8e-275], N[((-c) / b), $MachinePrecision], N[((-b) / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.8 \cdot 10^{-275}:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{-b}{a}\\
\end{array}
\end{array}
if b < -5.800000000000001e-275Initial program 32.2%
Simplified32.2%
Taylor expanded in b around -inf 69.9%
associate-*r/69.9%
neg-mul-169.9%
Simplified69.9%
if -5.800000000000001e-275 < b Initial program 74.0%
Simplified74.1%
Taylor expanded in b around inf 67.9%
associate-*r/67.9%
mul-1-neg67.9%
Simplified67.9%
Final simplification68.9%
(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 53.4%
Simplified53.5%
Taylor expanded in b around inf 35.8%
associate-*r/35.8%
mul-1-neg35.8%
Simplified35.8%
Final simplification35.8%
(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 53.4%
Simplified53.5%
clear-num53.4%
un-div-inv53.4%
Applied egg-rr53.4%
Taylor expanded in b around -inf 35.6%
Taylor expanded in b around 0 2.6%
Final simplification2.6%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (- (* b b) (* 4.0 (* a c))))))
(if (< b 0.0)
(/ c (* a (/ (+ (- b) t_0) (* 2.0 a))))
(/ (- (- 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 = c / (a * ((-b + t_0) / (2.0 * a)));
} 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 = c / (a * ((-b + t_0) / (2.0d0 * a)))
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 = c / (a * ((-b + t_0) / (2.0 * a)));
} 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 = c / (a * ((-b + t_0) / (2.0 * a))) else: tmp = (-b - t_0) / (2.0 * a) return tmp
function code(a, b, c) t_0 = sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c)))) tmp = 0.0 if (b < 0.0) tmp = Float64(c / Float64(a * Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a)))); 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 = c / (a * ((-b + t_0) / (2.0 * a))); 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[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Less[b, 0.0], N[(c / N[(a * N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]), $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 - 4 \cdot \left(a \cdot c\right)}\\
\mathbf{if}\;b < 0:\\
\;\;\;\;\frac{c}{a \cdot \frac{\left(-b\right) + t_0}{2 \cdot a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) - t_0}{2 \cdot a}\\
\end{array}
\end{array}
herbie shell --seed 2023216
(FPCore (a b c)
:name "quadm (p42, negative)"
:precision binary64
:herbie-target
(if (< b 0.0) (/ c (* a (/ (+ (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))) (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))
(/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))