
(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 -1e+153)
(/ b (- a))
(if (<= b 2.6e-128)
(/ (- (sqrt (- (* b b) (* (* a 4.0) c))) b) (* a 2.0))
(/ c (- b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e+153) {
tmp = b / -a;
} else if (b <= 2.6e-128) {
tmp = (sqrt(((b * b) - ((a * 4.0) * c))) - 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 <= (-1d+153)) then
tmp = b / -a
else if (b <= 2.6d-128) then
tmp = (sqrt(((b * b) - ((a * 4.0d0) * c))) - 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 <= -1e+153) {
tmp = b / -a;
} else if (b <= 2.6e-128) {
tmp = (Math.sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0);
} else {
tmp = c / -b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e+153: tmp = b / -a elif b <= 2.6e-128: tmp = (math.sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0) else: tmp = c / -b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e+153) tmp = Float64(b / Float64(-a)); elseif (b <= 2.6e-128) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 4.0) * c))) - b) / Float64(a * 2.0)); else tmp = Float64(c / Float64(-b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e+153) tmp = b / -a; elseif (b <= 2.6e-128) tmp = (sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0); else tmp = c / -b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e+153], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 2.6e-128], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * c), $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 \cdot 10^{+153}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{elif}\;b \leq 2.6 \cdot 10^{-128}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{-b}\\
\end{array}
\end{array}
if b < -1e153Initial program 34.5%
*-commutative34.5%
Simplified34.5%
Taylor expanded in b around -inf 100.0%
associate-*r/100.0%
mul-1-neg100.0%
Simplified100.0%
if -1e153 < b < 2.59999999999999981e-128Initial program 87.1%
if 2.59999999999999981e-128 < b Initial program 14.1%
*-commutative14.1%
Simplified14.1%
Taylor expanded in b around inf 88.8%
associate-*r/88.8%
mul-1-neg88.8%
Simplified88.8%
Final simplification89.8%
(FPCore (a b c)
:precision binary64
(if (<= b -4.8e-80)
(- (/ c b) (/ b a))
(if (<= b 3.8e-128)
(/ (- (sqrt (* c (* a -4.0))) b) (* a 2.0))
(/ c (- b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.8e-80) {
tmp = (c / b) - (b / a);
} else if (b <= 3.8e-128) {
tmp = (sqrt((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 <= (-4.8d-80)) then
tmp = (c / b) - (b / a)
else if (b <= 3.8d-128) then
tmp = (sqrt((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 <= -4.8e-80) {
tmp = (c / b) - (b / a);
} else if (b <= 3.8e-128) {
tmp = (Math.sqrt((c * (a * -4.0))) - b) / (a * 2.0);
} else {
tmp = c / -b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.8e-80: tmp = (c / b) - (b / a) elif b <= 3.8e-128: tmp = (math.sqrt((c * (a * -4.0))) - b) / (a * 2.0) else: tmp = c / -b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.8e-80) tmp = Float64(Float64(c / b) - Float64(b / a)); elseif (b <= 3.8e-128) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -4.0))) - b) / Float64(a * 2.0)); else tmp = Float64(c / Float64(-b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.8e-80) tmp = (c / b) - (b / a); elseif (b <= 3.8e-128) tmp = (sqrt((c * (a * -4.0))) - b) / (a * 2.0); else tmp = c / -b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.8e-80], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.8e-128], N[(N[(N[Sqrt[N[(c * N[(a * -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 -4.8 \cdot 10^{-80}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-128}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{-b}\\
\end{array}
\end{array}
if b < -4.7999999999999998e-80Initial program 69.1%
*-commutative69.1%
Simplified69.1%
Applied egg-rr69.0%
sub-neg69.0%
distribute-rgt-out--69.0%
Simplified69.0%
Taylor expanded in b around -inf 84.6%
mul-1-neg84.6%
*-commutative84.6%
distribute-rgt-neg-in84.6%
+-commutative84.6%
mul-1-neg84.6%
unsub-neg84.6%
Simplified84.6%
Taylor expanded in a around inf 84.9%
neg-mul-184.9%
+-commutative84.9%
unsub-neg84.9%
Simplified84.9%
if -4.7999999999999998e-80 < b < 3.8000000000000002e-128Initial program 79.7%
*-commutative79.7%
Simplified79.7%
Taylor expanded in b around 0 75.2%
associate-*r*75.2%
*-commutative75.2%
Simplified75.2%
if 3.8000000000000002e-128 < b Initial program 14.1%
*-commutative14.1%
Simplified14.1%
Taylor expanded in b around inf 88.8%
associate-*r/88.8%
mul-1-neg88.8%
Simplified88.8%
Final simplification84.4%
(FPCore (a b c)
:precision binary64
(if (<= b -8e-80)
(- (/ c b) (/ b a))
(if (<= b 3.2e-128)
(* (/ 0.5 a) (- (sqrt (* a (* c -4.0))) b))
(/ c (- b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -8e-80) {
tmp = (c / b) - (b / a);
} else if (b <= 3.2e-128) {
tmp = (0.5 / a) * (sqrt((a * (c * -4.0))) - b);
} 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-80)) then
tmp = (c / b) - (b / a)
else if (b <= 3.2d-128) then
tmp = (0.5d0 / a) * (sqrt((a * (c * (-4.0d0)))) - b)
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-80) {
tmp = (c / b) - (b / a);
} else if (b <= 3.2e-128) {
tmp = (0.5 / a) * (Math.sqrt((a * (c * -4.0))) - b);
} else {
tmp = c / -b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -8e-80: tmp = (c / b) - (b / a) elif b <= 3.2e-128: tmp = (0.5 / a) * (math.sqrt((a * (c * -4.0))) - b) else: tmp = c / -b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -8e-80) tmp = Float64(Float64(c / b) - Float64(b / a)); elseif (b <= 3.2e-128) tmp = Float64(Float64(0.5 / a) * Float64(sqrt(Float64(a * Float64(c * -4.0))) - b)); else tmp = Float64(c / Float64(-b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -8e-80) tmp = (c / b) - (b / a); elseif (b <= 3.2e-128) tmp = (0.5 / a) * (sqrt((a * (c * -4.0))) - b); else tmp = c / -b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -8e-80], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.2e-128], N[(N[(0.5 / a), $MachinePrecision] * N[(N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], N[(c / (-b)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8 \cdot 10^{-80}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 3.2 \cdot 10^{-128}:\\
\;\;\;\;\frac{0.5}{a} \cdot \left(\sqrt{a \cdot \left(c \cdot -4\right)} - b\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{-b}\\
\end{array}
\end{array}
if b < -7.99999999999999969e-80Initial program 69.1%
*-commutative69.1%
Simplified69.1%
Applied egg-rr69.0%
sub-neg69.0%
distribute-rgt-out--69.0%
Simplified69.0%
Taylor expanded in b around -inf 84.6%
mul-1-neg84.6%
*-commutative84.6%
distribute-rgt-neg-in84.6%
+-commutative84.6%
mul-1-neg84.6%
unsub-neg84.6%
Simplified84.6%
Taylor expanded in a around inf 84.9%
neg-mul-184.9%
+-commutative84.9%
unsub-neg84.9%
Simplified84.9%
if -7.99999999999999969e-80 < b < 3.1999999999999998e-128Initial program 79.7%
*-commutative79.7%
Simplified79.7%
Applied egg-rr79.6%
sub-neg79.6%
distribute-rgt-out--79.6%
Simplified79.6%
Taylor expanded in a around inf 75.1%
*-commutative75.1%
associate-*r*75.1%
Simplified75.1%
if 3.1999999999999998e-128 < b Initial program 14.1%
*-commutative14.1%
Simplified14.1%
Taylor expanded in b around inf 88.8%
associate-*r/88.8%
mul-1-neg88.8%
Simplified88.8%
Final simplification84.4%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (- (/ c b) (/ b a)) (/ c (- b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = (c / b) - (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 <= (-1d-310)) then
tmp = (c / b) - (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 <= -1e-310) {
tmp = (c / b) - (b / a);
} else {
tmp = c / -b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = (c / b) - (b / a) else: tmp = c / -b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) tmp = Float64(Float64(c / b) - Float64(b / a)); else tmp = Float64(c / Float64(-b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-310) tmp = (c / b) - (b / a); else tmp = c / -b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], N[(c / (-b)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{-b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 74.7%
*-commutative74.7%
Simplified74.7%
Applied egg-rr74.6%
sub-neg74.6%
distribute-rgt-out--74.6%
Simplified74.6%
Taylor expanded in b around -inf 65.8%
mul-1-neg65.8%
*-commutative65.8%
distribute-rgt-neg-in65.8%
+-commutative65.8%
mul-1-neg65.8%
unsub-neg65.8%
Simplified65.8%
Taylor expanded in a around inf 66.2%
neg-mul-166.2%
+-commutative66.2%
unsub-neg66.2%
Simplified66.2%
if -9.999999999999969e-311 < b Initial program 24.5%
*-commutative24.5%
Simplified24.5%
Taylor expanded in b around inf 73.7%
associate-*r/73.7%
mul-1-neg73.7%
Simplified73.7%
Final simplification70.2%
(FPCore (a b c) :precision binary64 (if (<= b 8e-282) (/ b (- a)) (/ c (- b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 8e-282) {
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-282) 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-282) {
tmp = b / -a;
} else {
tmp = c / -b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 8e-282: tmp = b / -a else: tmp = c / -b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 8e-282) tmp = Float64(b / Float64(-a)); else tmp = Float64(c / Float64(-b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 8e-282) tmp = b / -a; else tmp = c / -b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 8e-282], N[(b / (-a)), $MachinePrecision], N[(c / (-b)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8 \cdot 10^{-282}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{-b}\\
\end{array}
\end{array}
if b < 8.0000000000000001e-282Initial program 75.1%
*-commutative75.1%
Simplified75.1%
Taylor expanded in b around -inf 65.2%
associate-*r/65.2%
mul-1-neg65.2%
Simplified65.2%
if 8.0000000000000001e-282 < b Initial program 23.5%
*-commutative23.5%
Simplified23.5%
Taylor expanded in b around inf 74.7%
associate-*r/74.7%
mul-1-neg74.7%
Simplified74.7%
Final simplification70.2%
(FPCore (a b c) :precision binary64 (if (<= b 3.1e+46) (/ b (- a)) (/ c b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.1e+46) {
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.1d+46) 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.1e+46) {
tmp = b / -a;
} else {
tmp = c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3.1e+46: tmp = b / -a else: tmp = c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3.1e+46) 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 <= 3.1e+46) tmp = b / -a; else tmp = c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3.1e+46], N[(b / (-a)), $MachinePrecision], N[(c / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.1 \cdot 10^{+46}:\\
\;\;\;\;\frac{b}{-a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b}\\
\end{array}
\end{array}
if b < 3.09999999999999975e46Initial program 62.0%
*-commutative62.0%
Simplified62.0%
Taylor expanded in b around -inf 43.5%
associate-*r/43.5%
mul-1-neg43.5%
Simplified43.5%
if 3.09999999999999975e46 < b Initial program 11.0%
*-commutative11.0%
Simplified11.0%
Applied egg-rr7.8%
sub-neg7.8%
distribute-rgt-out--11.0%
Simplified11.0%
Taylor expanded in b around -inf 2.7%
mul-1-neg2.7%
*-commutative2.7%
distribute-rgt-neg-in2.7%
+-commutative2.7%
mul-1-neg2.7%
unsub-neg2.7%
Simplified2.7%
Taylor expanded in a around inf 35.1%
Final simplification41.2%
(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 47.7%
*-commutative47.7%
Simplified47.7%
Applied egg-rr46.7%
sub-neg46.7%
distribute-rgt-out--47.6%
Simplified47.6%
Taylor expanded in b around -inf 31.6%
mul-1-neg31.6%
*-commutative31.6%
distribute-rgt-neg-in31.6%
+-commutative31.6%
mul-1-neg31.6%
unsub-neg31.6%
Simplified31.6%
Taylor expanded in a around inf 11.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(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 47.7%
*-commutative47.7%
Simplified47.7%
Taylor expanded in b around -inf 32.1%
associate-*r/32.1%
mul-1-neg32.1%
Simplified32.1%
div-inv32.0%
add-sqr-sqrt30.2%
sqrt-unprod22.2%
sqr-neg22.2%
sqrt-prod1.7%
add-sqr-sqrt2.4%
Applied egg-rr2.4%
associate-*r/2.4%
*-rgt-identity2.4%
Simplified2.4%
herbie shell --seed 2024114
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))