
(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 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(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 -4e+110)
(- (/ c b) (/ b a))
(if (<= b 2.9e-81)
(/ (- (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 <= -4e+110) {
tmp = (c / b) - (b / a);
} else if (b <= 2.9e-81) {
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 <= (-4d+110)) then
tmp = (c / b) - (b / a)
else if (b <= 2.9d-81) 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 <= -4e+110) {
tmp = (c / b) - (b / a);
} else if (b <= 2.9e-81) {
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 <= -4e+110: tmp = (c / b) - (b / a) elif b <= 2.9e-81: 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 <= -4e+110) tmp = Float64(Float64(c / b) - Float64(b / a)); elseif (b <= 2.9e-81) 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 <= -4e+110) tmp = (c / b) - (b / a); elseif (b <= 2.9e-81) 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, -4e+110], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.9e-81], 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 -4 \cdot 10^{+110}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 2.9 \cdot 10^{-81}:\\
\;\;\;\;\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 < -4.0000000000000001e110Initial program 49.8%
neg-sub049.8%
associate-+l-49.8%
sub0-neg49.8%
neg-mul-149.8%
associate-*l/49.7%
*-commutative49.7%
associate-/r*49.7%
/-rgt-identity49.7%
metadata-eval49.7%
Simplified49.8%
Taylor expanded in b around -inf 95.4%
mul-1-neg95.4%
unsub-neg95.4%
Simplified95.4%
if -4.0000000000000001e110 < b < 2.89999999999999989e-81Initial program 86.4%
if 2.89999999999999989e-81 < b Initial program 15.0%
neg-sub015.0%
associate-+l-15.0%
sub0-neg15.0%
neg-mul-115.0%
associate-*l/15.0%
*-commutative15.0%
associate-/r*15.0%
/-rgt-identity15.0%
metadata-eval15.0%
Simplified16.1%
Taylor expanded in b around inf 85.5%
associate-*r/85.5%
neg-mul-185.5%
Simplified85.5%
Final simplification88.2%
(FPCore (a b c)
:precision binary64
(if (<= b -1e+114)
(- (/ c b) (/ b a))
(if (<= b 3.55e-81)
(/ (- (sqrt (- (* b b) (* 4.0 (* c a)))) b) (* a 2.0))
(/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e+114) {
tmp = (c / b) - (b / a);
} else if (b <= 3.55e-81) {
tmp = (sqrt(((b * b) - (4.0 * (c * a)))) - 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+114)) then
tmp = (c / b) - (b / a)
else if (b <= 3.55d-81) then
tmp = (sqrt(((b * b) - (4.0d0 * (c * a)))) - 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+114) {
tmp = (c / b) - (b / a);
} else if (b <= 3.55e-81) {
tmp = (Math.sqrt(((b * b) - (4.0 * (c * a)))) - b) / (a * 2.0);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e+114: tmp = (c / b) - (b / a) elif b <= 3.55e-81: tmp = (math.sqrt(((b * b) - (4.0 * (c * a)))) - b) / (a * 2.0) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e+114) tmp = Float64(Float64(c / b) - Float64(b / a)); elseif (b <= 3.55e-81) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(c * a)))) - 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 <= -1e+114) tmp = (c / b) - (b / a); elseif (b <= 3.55e-81) tmp = (sqrt(((b * b) - (4.0 * (c * a)))) - b) / (a * 2.0); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e+114], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.55e-81], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(c * a), $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 \cdot 10^{+114}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 3.55 \cdot 10^{-81}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -1e114Initial program 49.8%
neg-sub049.8%
associate-+l-49.8%
sub0-neg49.8%
neg-mul-149.8%
associate-*l/49.7%
*-commutative49.7%
associate-/r*49.7%
/-rgt-identity49.7%
metadata-eval49.7%
Simplified49.8%
Taylor expanded in b around -inf 95.4%
mul-1-neg95.4%
unsub-neg95.4%
Simplified95.4%
if -1e114 < b < 3.5500000000000001e-81Initial program 86.4%
neg-sub086.4%
associate-+l-86.4%
associate-+l-86.4%
neg-sub086.4%
associate-*l*86.4%
*-commutative86.4%
Simplified86.4%
if 3.5500000000000001e-81 < b Initial program 15.0%
neg-sub015.0%
associate-+l-15.0%
sub0-neg15.0%
neg-mul-115.0%
associate-*l/15.0%
*-commutative15.0%
associate-/r*15.0%
/-rgt-identity15.0%
metadata-eval15.0%
Simplified16.1%
Taylor expanded in b around inf 85.5%
associate-*r/85.5%
neg-mul-185.5%
Simplified85.5%
Final simplification88.2%
(FPCore (a b c)
:precision binary64
(if (<= b -1.32e-36)
(- (/ c b) (/ b a))
(if (<= b 1.5e-81)
(* 0.5 (/ (- (sqrt (* c (* a -4.0))) b) a))
(/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.32e-36) {
tmp = (c / b) - (b / a);
} else if (b <= 1.5e-81) {
tmp = 0.5 * ((sqrt((c * (a * -4.0))) - 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 <= (-1.32d-36)) then
tmp = (c / b) - (b / a)
else if (b <= 1.5d-81) then
tmp = 0.5d0 * ((sqrt((c * (a * (-4.0d0)))) - 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 <= -1.32e-36) {
tmp = (c / b) - (b / a);
} else if (b <= 1.5e-81) {
tmp = 0.5 * ((Math.sqrt((c * (a * -4.0))) - b) / a);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.32e-36: tmp = (c / b) - (b / a) elif b <= 1.5e-81: tmp = 0.5 * ((math.sqrt((c * (a * -4.0))) - b) / a) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.32e-36) tmp = Float64(Float64(c / b) - Float64(b / a)); elseif (b <= 1.5e-81) tmp = Float64(0.5 * Float64(Float64(sqrt(Float64(c * Float64(a * -4.0))) - b) / a)); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.32e-36) tmp = (c / b) - (b / a); elseif (b <= 1.5e-81) tmp = 0.5 * ((sqrt((c * (a * -4.0))) - b) / a); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.32e-36], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.5e-81], N[(0.5 * N[(N[(N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.32 \cdot 10^{-36}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{-81}:\\
\;\;\;\;0.5 \cdot \frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -1.31999999999999993e-36Initial program 66.7%
neg-sub066.7%
associate-+l-66.7%
sub0-neg66.7%
neg-mul-166.7%
associate-*l/66.5%
*-commutative66.5%
associate-/r*66.5%
/-rgt-identity66.5%
metadata-eval66.5%
Simplified66.6%
Taylor expanded in b around -inf 91.9%
mul-1-neg91.9%
unsub-neg91.9%
Simplified91.9%
if -1.31999999999999993e-36 < b < 1.4999999999999999e-81Initial program 81.0%
/-rgt-identity81.0%
metadata-eval81.0%
associate-/l*81.0%
associate-*r/80.7%
+-commutative80.7%
unsub-neg80.7%
fma-neg80.7%
associate-*l*80.6%
*-commutative80.6%
distribute-rgt-neg-in80.6%
metadata-eval80.6%
associate-/r*80.6%
metadata-eval80.6%
metadata-eval80.6%
Simplified80.6%
fma-udef80.6%
*-commutative80.6%
metadata-eval80.6%
cancel-sign-sub-inv80.6%
add-sqr-sqrt80.5%
pow280.5%
pow1/280.5%
sqrt-pow180.6%
cancel-sign-sub-inv80.6%
metadata-eval80.6%
*-commutative80.6%
fma-udef80.6%
associate-*l*80.7%
metadata-eval80.7%
Applied egg-rr80.7%
Taylor expanded in a around inf 37.5%
Simplified77.6%
if 1.4999999999999999e-81 < b Initial program 15.6%
neg-sub015.6%
associate-+l-15.6%
sub0-neg15.6%
neg-mul-115.6%
associate-*l/15.5%
*-commutative15.5%
associate-/r*15.5%
/-rgt-identity15.5%
metadata-eval15.5%
Simplified16.6%
Taylor expanded in b around inf 85.2%
associate-*r/85.2%
neg-mul-185.2%
Simplified85.2%
Final simplification85.4%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (- (/ c b) (/ b a)) (/ (- c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
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 <= (-5d-311)) 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 <= -5e-311) {
tmp = (c / b) - (b / a);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = (c / b) - (b / a) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(Float64(c / b) - Float64(b / a)); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-311) tmp = (c / b) - (b / a); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 72.4%
neg-sub072.4%
associate-+l-72.4%
sub0-neg72.4%
neg-mul-172.4%
associate-*l/72.1%
*-commutative72.1%
associate-/r*72.1%
/-rgt-identity72.1%
metadata-eval72.1%
Simplified72.2%
Taylor expanded in b around -inf 69.3%
mul-1-neg69.3%
unsub-neg69.3%
Simplified69.3%
if -5.00000000000023e-311 < b Initial program 32.5%
neg-sub032.5%
associate-+l-32.5%
sub0-neg32.5%
neg-mul-132.5%
associate-*l/32.5%
*-commutative32.5%
associate-/r*32.5%
/-rgt-identity32.5%
metadata-eval32.5%
Simplified33.2%
Taylor expanded in b around inf 66.1%
associate-*r/66.1%
neg-mul-166.1%
Simplified66.1%
Final simplification67.7%
(FPCore (a b c) :precision binary64 (if (<= b -1.9e-300) (/ (- b) a) 0.0))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.9e-300) {
tmp = -b / a;
} else {
tmp = 0.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 <= (-1.9d-300)) then
tmp = -b / a
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.9e-300) {
tmp = -b / a;
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.9e-300: tmp = -b / a else: tmp = 0.0 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.9e-300) tmp = Float64(Float64(-b) / a); else tmp = 0.0; end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.9e-300) tmp = -b / a; else tmp = 0.0; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.9e-300], N[((-b) / a), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.9 \cdot 10^{-300}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b < -1.90000000000000006e-300Initial program 72.1%
neg-sub072.1%
associate-+l-72.1%
sub0-neg72.1%
neg-mul-172.1%
associate-*l/71.9%
*-commutative71.9%
associate-/r*71.9%
/-rgt-identity71.9%
metadata-eval71.9%
Simplified71.9%
Taylor expanded in b around -inf 69.6%
associate-*r/69.6%
mul-1-neg69.6%
Simplified69.6%
if -1.90000000000000006e-300 < b Initial program 33.1%
neg-sub033.1%
associate-+l-33.1%
sub0-neg33.1%
neg-mul-133.1%
associate-*l/33.0%
*-commutative33.0%
associate-/r*33.0%
/-rgt-identity33.0%
metadata-eval33.0%
Simplified33.7%
Taylor expanded in b around -inf 2.7%
count-22.7%
Simplified2.7%
add-log-exp4.1%
*-commutative4.1%
exp-prod7.6%
add-sqr-sqrt7.6%
sqrt-prod7.6%
sqr-neg7.6%
sqrt-unprod6.7%
add-sqr-sqrt17.9%
sub-neg17.9%
+-inverses17.9%
metadata-eval17.9%
metadata-eval17.9%
Applied egg-rr17.9%
Final simplification43.7%
(FPCore (a b c) :precision binary64 (if (<= b 1.32e-303) (/ (- b) a) (/ (- c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.32e-303) {
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 <= 1.32d-303) 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 <= 1.32e-303) {
tmp = -b / a;
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.32e-303: tmp = -b / a else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.32e-303) tmp = Float64(Float64(-b) / a); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.32e-303) tmp = -b / a; else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.32e-303], N[((-b) / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.32 \cdot 10^{-303}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < 1.32000000000000005e-303Initial program 72.8%
neg-sub072.8%
associate-+l-72.8%
sub0-neg72.8%
neg-mul-172.8%
associate-*l/72.5%
*-commutative72.5%
associate-/r*72.5%
/-rgt-identity72.5%
metadata-eval72.5%
Simplified72.6%
Taylor expanded in b around -inf 68.1%
associate-*r/68.1%
mul-1-neg68.1%
Simplified68.1%
if 1.32000000000000005e-303 < b Initial program 31.5%
neg-sub031.5%
associate-+l-31.5%
sub0-neg31.5%
neg-mul-131.5%
associate-*l/31.4%
*-commutative31.4%
associate-/r*31.4%
/-rgt-identity31.4%
metadata-eval31.4%
Simplified32.2%
Taylor expanded in b around inf 67.2%
associate-*r/67.2%
neg-mul-167.2%
Simplified67.2%
Final simplification67.6%
(FPCore (a b c) :precision binary64 0.0)
double code(double a, double b, double c) {
return 0.0;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = 0.0d0
end function
public static double code(double a, double b, double c) {
return 0.0;
}
def code(a, b, c): return 0.0
function code(a, b, c) return 0.0 end
function tmp = code(a, b, c) tmp = 0.0; end
code[a_, b_, c_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 52.6%
neg-sub052.6%
associate-+l-52.6%
sub0-neg52.6%
neg-mul-152.6%
associate-*l/52.4%
*-commutative52.4%
associate-/r*52.4%
/-rgt-identity52.4%
metadata-eval52.4%
Simplified52.8%
Taylor expanded in b around -inf 36.1%
count-236.1%
Simplified36.1%
add-log-exp14.8%
*-commutative14.8%
exp-prod15.6%
add-sqr-sqrt4.6%
sqrt-prod5.0%
sqr-neg5.0%
sqrt-unprod7.8%
add-sqr-sqrt10.3%
sub-neg10.3%
+-inverses10.3%
metadata-eval10.3%
metadata-eval10.3%
Applied egg-rr10.3%
Final simplification10.3%
herbie shell --seed 2023182
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))