
(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 -1.25e+50)
(- (/ c b) (/ b a))
(if (<= b 2.2e-105)
(/ (- (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.25e+50) {
tmp = (c / b) - (b / a);
} else if (b <= 2.2e-105) {
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 <= (-1.25d+50)) then
tmp = (c / b) - (b / a)
else if (b <= 2.2d-105) 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 <= -1.25e+50) {
tmp = (c / b) - (b / a);
} else if (b <= 2.2e-105) {
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 <= -1.25e+50: tmp = (c / b) - (b / a) elif b <= 2.2e-105: 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 <= -1.25e+50) tmp = Float64(Float64(c / b) - Float64(b / a)); elseif (b <= 2.2e-105) 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 <= -1.25e+50) tmp = (c / b) - (b / a); elseif (b <= 2.2e-105) 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, -1.25e+50], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.2e-105], 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.25 \cdot 10^{+50}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 2.2 \cdot 10^{-105}:\\
\;\;\;\;\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.25e50Initial program 57.2%
neg-sub057.2%
associate-+l-57.2%
sub0-neg57.2%
neg-mul-157.2%
associate-*l/57.0%
*-commutative57.0%
associate-/r*57.0%
/-rgt-identity57.0%
metadata-eval57.0%
Simplified57.1%
Taylor expanded in b around -inf 90.1%
mul-1-neg90.1%
unsub-neg90.1%
Simplified90.1%
if -1.25e50 < b < 2.20000000000000004e-105Initial program 71.8%
if 2.20000000000000004e-105 < b Initial program 14.4%
neg-sub014.4%
associate-+l-14.4%
sub0-neg14.4%
neg-mul-114.4%
associate-*l/14.4%
*-commutative14.4%
associate-/r*14.4%
/-rgt-identity14.4%
metadata-eval14.4%
Simplified14.4%
Taylor expanded in b around inf 88.4%
mul-1-neg88.4%
distribute-neg-frac88.4%
Simplified88.4%
Final simplification82.0%
(FPCore (a b c)
:precision binary64
(if (<= b -1.8e+33)
(- (/ c b) (/ b a))
(if (<= b 8.2e-107)
(* (- b (sqrt (- (* b b) (* a (* c 4.0))))) (/ -0.5 a))
(/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.8e+33) {
tmp = (c / b) - (b / a);
} else if (b <= 8.2e-107) {
tmp = (b - sqrt(((b * b) - (a * (c * 4.0))))) * (-0.5 / 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.8d+33)) then
tmp = (c / b) - (b / a)
else if (b <= 8.2d-107) then
tmp = (b - sqrt(((b * b) - (a * (c * 4.0d0))))) * ((-0.5d0) / 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.8e+33) {
tmp = (c / b) - (b / a);
} else if (b <= 8.2e-107) {
tmp = (b - Math.sqrt(((b * b) - (a * (c * 4.0))))) * (-0.5 / a);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.8e+33: tmp = (c / b) - (b / a) elif b <= 8.2e-107: tmp = (b - math.sqrt(((b * b) - (a * (c * 4.0))))) * (-0.5 / a) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.8e+33) tmp = Float64(Float64(c / b) - Float64(b / a)); elseif (b <= 8.2e-107) tmp = Float64(Float64(b - sqrt(Float64(Float64(b * b) - Float64(a * Float64(c * 4.0))))) * Float64(-0.5 / a)); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.8e+33) tmp = (c / b) - (b / a); elseif (b <= 8.2e-107) tmp = (b - sqrt(((b * b) - (a * (c * 4.0))))) * (-0.5 / a); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.8e+33], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.2e-107], N[(N[(b - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(a * N[(c * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.8 \cdot 10^{+33}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 8.2 \cdot 10^{-107}:\\
\;\;\;\;\left(b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}\right) \cdot \frac{-0.5}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -1.8000000000000001e33Initial program 61.9%
neg-sub061.9%
associate-+l-61.9%
sub0-neg61.9%
neg-mul-161.9%
associate-*l/61.7%
*-commutative61.7%
associate-/r*61.7%
/-rgt-identity61.7%
metadata-eval61.7%
Simplified61.9%
Taylor expanded in b around -inf 91.2%
mul-1-neg91.2%
unsub-neg91.2%
Simplified91.2%
if -1.8000000000000001e33 < b < 8.1999999999999998e-107Initial program 69.8%
neg-sub069.8%
associate-+l-69.8%
sub0-neg69.8%
neg-mul-169.8%
associate-*l/69.6%
*-commutative69.6%
associate-/r*69.6%
/-rgt-identity69.6%
metadata-eval69.6%
Simplified69.6%
fma-udef69.6%
*-commutative69.6%
associate-*r*69.6%
metadata-eval69.6%
distribute-rgt-neg-in69.6%
*-commutative69.6%
distribute-lft-neg-in69.6%
+-commutative69.6%
sub-neg69.6%
*-commutative69.6%
associate-*l*69.6%
Applied egg-rr69.6%
*-commutative69.6%
Simplified69.6%
if 8.1999999999999998e-107 < b Initial program 14.4%
neg-sub014.4%
associate-+l-14.4%
sub0-neg14.4%
neg-mul-114.4%
associate-*l/14.4%
*-commutative14.4%
associate-/r*14.4%
/-rgt-identity14.4%
metadata-eval14.4%
Simplified14.4%
Taylor expanded in b around inf 88.4%
mul-1-neg88.4%
distribute-neg-frac88.4%
Simplified88.4%
Final simplification82.0%
(FPCore (a b c)
:precision binary64
(if (<= b -2.3e-99)
(- (/ c b) (/ b a))
(if (<= b 9e-108)
(* (/ -0.5 a) (- b (sqrt (* a (* c -4.0)))))
(/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.3e-99) {
tmp = (c / b) - (b / a);
} else if (b <= 9e-108) {
tmp = (-0.5 / a) * (b - sqrt((a * (c * -4.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 <= (-2.3d-99)) then
tmp = (c / b) - (b / a)
else if (b <= 9d-108) then
tmp = ((-0.5d0) / a) * (b - sqrt((a * (c * (-4.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 <= -2.3e-99) {
tmp = (c / b) - (b / a);
} else if (b <= 9e-108) {
tmp = (-0.5 / a) * (b - Math.sqrt((a * (c * -4.0))));
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.3e-99: tmp = (c / b) - (b / a) elif b <= 9e-108: tmp = (-0.5 / a) * (b - math.sqrt((a * (c * -4.0)))) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.3e-99) tmp = Float64(Float64(c / b) - Float64(b / a)); elseif (b <= 9e-108) tmp = Float64(Float64(-0.5 / a) * Float64(b - sqrt(Float64(a * Float64(c * -4.0))))); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.3e-99) tmp = (c / b) - (b / a); elseif (b <= 9e-108) tmp = (-0.5 / a) * (b - sqrt((a * (c * -4.0)))); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.3e-99], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9e-108], N[(N[(-0.5 / a), $MachinePrecision] * N[(b - N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{-99}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 9 \cdot 10^{-108}:\\
\;\;\;\;\frac{-0.5}{a} \cdot \left(b - \sqrt{a \cdot \left(c \cdot -4\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -2.2999999999999998e-99Initial program 66.4%
neg-sub066.4%
associate-+l-66.4%
sub0-neg66.4%
neg-mul-166.4%
associate-*l/66.2%
*-commutative66.2%
associate-/r*66.2%
/-rgt-identity66.2%
metadata-eval66.2%
Simplified66.3%
Taylor expanded in b around -inf 81.3%
mul-1-neg81.3%
unsub-neg81.3%
Simplified81.3%
if -2.2999999999999998e-99 < b < 8.99999999999999941e-108Initial program 67.0%
neg-sub067.0%
associate-+l-67.0%
sub0-neg67.0%
neg-mul-167.0%
associate-*l/66.9%
*-commutative66.9%
associate-/r*66.9%
/-rgt-identity66.9%
metadata-eval66.9%
Simplified66.9%
Taylor expanded in a around inf 64.9%
*-commutative64.9%
*-commutative64.9%
associate-*r*64.9%
Simplified64.9%
if 8.99999999999999941e-108 < b Initial program 14.4%
neg-sub014.4%
associate-+l-14.4%
sub0-neg14.4%
neg-mul-114.4%
associate-*l/14.4%
*-commutative14.4%
associate-/r*14.4%
/-rgt-identity14.4%
metadata-eval14.4%
Simplified14.4%
Taylor expanded in b around inf 88.4%
mul-1-neg88.4%
distribute-neg-frac88.4%
Simplified88.4%
Final simplification79.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(Float64(-c) / 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 68.0%
neg-sub068.0%
associate-+l-68.0%
sub0-neg68.0%
neg-mul-168.0%
associate-*l/67.8%
*-commutative67.8%
associate-/r*67.8%
/-rgt-identity67.8%
metadata-eval67.8%
Simplified67.9%
Taylor expanded in b around -inf 66.5%
mul-1-neg66.5%
unsub-neg66.5%
Simplified66.5%
if -9.999999999999969e-311 < b Initial program 30.0%
neg-sub030.0%
associate-+l-30.0%
sub0-neg30.0%
neg-mul-130.0%
associate-*l/29.9%
*-commutative29.9%
associate-/r*29.9%
/-rgt-identity29.9%
metadata-eval29.9%
Simplified30.0%
Taylor expanded in b around inf 66.2%
mul-1-neg66.2%
distribute-neg-frac66.2%
Simplified66.2%
Final simplification66.3%
(FPCore (a b c) :precision binary64 (if (<= b -3.5e-302) (/ (- b) a) 0.0))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.5e-302) {
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 <= (-3.5d-302)) 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 <= -3.5e-302) {
tmp = -b / a;
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.5e-302: tmp = -b / a else: tmp = 0.0 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.5e-302) 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 <= -3.5e-302) tmp = -b / a; else tmp = 0.0; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.5e-302], N[((-b) / a), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.5 \cdot 10^{-302}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b < -3.5000000000000001e-302Initial program 68.6%
neg-sub068.6%
associate-+l-68.6%
sub0-neg68.6%
neg-mul-168.6%
associate-*l/68.4%
*-commutative68.4%
associate-/r*68.4%
/-rgt-identity68.4%
metadata-eval68.4%
Simplified68.5%
Taylor expanded in b around -inf 66.6%
associate-*r/66.6%
mul-1-neg66.6%
Simplified66.6%
if -3.5000000000000001e-302 < b Initial program 29.8%
neg-sub029.8%
associate-+l-29.8%
sub0-neg29.8%
neg-mul-129.8%
associate-*l/29.8%
*-commutative29.8%
associate-/r*29.8%
/-rgt-identity29.8%
metadata-eval29.8%
Simplified29.8%
Taylor expanded in a around 0 6.2%
unpow26.2%
Simplified6.2%
Taylor expanded in b around 0 21.9%
Final simplification41.8%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (/ (- b) a) (/ (- c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
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 <= (-1d-310)) 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 <= -1e-310) {
tmp = -b / a;
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = -b / a else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) 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 <= -1e-310) tmp = -b / a; else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[((-b) / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 68.0%
neg-sub068.0%
associate-+l-68.0%
sub0-neg68.0%
neg-mul-168.0%
associate-*l/67.8%
*-commutative67.8%
associate-/r*67.8%
/-rgt-identity67.8%
metadata-eval67.8%
Simplified67.9%
Taylor expanded in b around -inf 66.0%
associate-*r/66.0%
mul-1-neg66.0%
Simplified66.0%
if -9.999999999999969e-311 < b Initial program 30.0%
neg-sub030.0%
associate-+l-30.0%
sub0-neg30.0%
neg-mul-130.0%
associate-*l/29.9%
*-commutative29.9%
associate-/r*29.9%
/-rgt-identity29.9%
metadata-eval29.9%
Simplified30.0%
Taylor expanded in b around inf 66.2%
mul-1-neg66.2%
distribute-neg-frac66.2%
Simplified66.2%
Final simplification66.1%
(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 47.1%
neg-sub047.1%
associate-+l-47.1%
sub0-neg47.1%
neg-mul-147.1%
associate-*l/47.0%
*-commutative47.0%
associate-/r*47.0%
/-rgt-identity47.0%
metadata-eval47.0%
Simplified47.0%
Taylor expanded in a around 0 25.4%
unpow225.4%
Simplified25.4%
Taylor expanded in b around 0 13.3%
Final simplification13.3%
herbie shell --seed 2023240
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))