
(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.76e+99)
(/ (- b) a)
(if (<= b 1.6e-37)
(/ (- (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 <= -1.76e+99) {
tmp = -b / a;
} else if (b <= 1.6e-37) {
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 <= (-1.76d+99)) then
tmp = -b / a
else if (b <= 1.6d-37) 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 <= -1.76e+99) {
tmp = -b / a;
} else if (b <= 1.6e-37) {
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 <= -1.76e+99: tmp = -b / a elif b <= 1.6e-37: 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 <= -1.76e+99) tmp = Float64(Float64(-b) / a); elseif (b <= 1.6e-37) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 4.0) * c))) - 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.76e+99) tmp = -b / a; elseif (b <= 1.6e-37) 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, -1.76e+99], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 1.6e-37], 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.76 \cdot 10^{+99}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{elif}\;b \leq 1.6 \cdot 10^{-37}:\\
\;\;\;\;\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 < -1.76000000000000007e99Initial program 54.2%
*-commutative54.2%
Simplified54.2%
Taylor expanded in b around -inf 96.1%
associate-*r/96.1%
mul-1-neg96.1%
Simplified96.1%
if -1.76000000000000007e99 < b < 1.5999999999999999e-37Initial program 76.3%
if 1.5999999999999999e-37 < b Initial program 12.8%
*-commutative12.8%
Simplified12.8%
Taylor expanded in b around inf 92.2%
mul-1-neg92.2%
distribute-neg-frac92.2%
Simplified92.2%
Final simplification85.1%
(FPCore (a b c)
:precision binary64
(if (<= b -1e-29)
(- (/ c b) (/ b a))
(if (<= b 7.1e-37)
(/ (- (sqrt (* c (* a -4.0))) b) (* a 2.0))
(/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-29) {
tmp = (c / b) - (b / a);
} else if (b <= 7.1e-37) {
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 <= (-1d-29)) then
tmp = (c / b) - (b / a)
else if (b <= 7.1d-37) 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 <= -1e-29) {
tmp = (c / b) - (b / a);
} else if (b <= 7.1e-37) {
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 <= -1e-29: tmp = (c / b) - (b / a) elif b <= 7.1e-37: 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 <= -1e-29) tmp = Float64(Float64(c / b) - Float64(b / a)); elseif (b <= 7.1e-37) tmp = Float64(Float64(sqrt(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 <= -1e-29) tmp = (c / b) - (b / a); elseif (b <= 7.1e-37) 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, -1e-29], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.1e-37], 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 -1 \cdot 10^{-29}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 7.1 \cdot 10^{-37}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -9.99999999999999943e-30Initial program 62.9%
*-commutative62.9%
Simplified62.9%
Taylor expanded in b around -inf 83.1%
+-commutative83.1%
mul-1-neg83.1%
unsub-neg83.1%
Simplified83.1%
if -9.99999999999999943e-30 < b < 7.09999999999999978e-37Initial program 75.8%
*-commutative75.8%
Simplified75.8%
prod-diff75.4%
*-commutative75.4%
fma-def75.4%
associate-+l+75.4%
pow275.4%
*-commutative75.4%
distribute-rgt-neg-in75.4%
*-commutative75.4%
distribute-rgt-neg-in75.4%
metadata-eval75.4%
*-commutative75.4%
fma-udef75.4%
distribute-lft-neg-in75.4%
distribute-rgt-neg-in75.4%
*-commutative75.4%
distribute-rgt-neg-in75.4%
metadata-eval75.4%
associate-*l*75.4%
Applied egg-rr75.4%
fma-def75.4%
fma-def75.4%
*-commutative75.4%
Simplified75.4%
Taylor expanded in b around 0 69.8%
neg-mul-169.8%
unsub-neg69.8%
distribute-rgt-out70.2%
*-commutative70.2%
metadata-eval70.2%
associate-*r*70.2%
*-commutative70.2%
Simplified70.2%
if 7.09999999999999978e-37 < b Initial program 12.8%
*-commutative12.8%
Simplified12.8%
Taylor expanded in b around inf 92.2%
mul-1-neg92.2%
distribute-neg-frac92.2%
Simplified92.2%
Final simplification81.0%
(FPCore (a b c) :precision binary64 (if (<= b -9.8e-30) (- (/ c b) (/ b a)) (if (<= b 1.55e-35) (* 0.5 (/ (sqrt (* c (* a -4.0))) a)) (/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -9.8e-30) {
tmp = (c / b) - (b / a);
} else if (b <= 1.55e-35) {
tmp = 0.5 * (sqrt((c * (a * -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 <= (-9.8d-30)) then
tmp = (c / b) - (b / a)
else if (b <= 1.55d-35) then
tmp = 0.5d0 * (sqrt((c * (a * (-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 <= -9.8e-30) {
tmp = (c / b) - (b / a);
} else if (b <= 1.55e-35) {
tmp = 0.5 * (Math.sqrt((c * (a * -4.0))) / a);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -9.8e-30: tmp = (c / b) - (b / a) elif b <= 1.55e-35: tmp = 0.5 * (math.sqrt((c * (a * -4.0))) / a) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -9.8e-30) tmp = Float64(Float64(c / b) - Float64(b / a)); elseif (b <= 1.55e-35) tmp = Float64(0.5 * Float64(sqrt(Float64(c * Float64(a * -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 <= -9.8e-30) tmp = (c / b) - (b / a); elseif (b <= 1.55e-35) tmp = 0.5 * (sqrt((c * (a * -4.0))) / a); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -9.8e-30], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.55e-35], N[(0.5 * N[(N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9.8 \cdot 10^{-30}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 1.55 \cdot 10^{-35}:\\
\;\;\;\;0.5 \cdot \frac{\sqrt{c \cdot \left(a \cdot -4\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -9.79999999999999942e-30Initial program 62.9%
*-commutative62.9%
Simplified62.9%
Taylor expanded in b around -inf 83.1%
+-commutative83.1%
mul-1-neg83.1%
unsub-neg83.1%
Simplified83.1%
if -9.79999999999999942e-30 < b < 1.55000000000000006e-35Initial program 75.8%
*-commutative75.8%
Simplified75.8%
prod-diff75.4%
*-commutative75.4%
fma-def75.4%
associate-+l+75.4%
pow275.4%
*-commutative75.4%
distribute-rgt-neg-in75.4%
*-commutative75.4%
distribute-rgt-neg-in75.4%
metadata-eval75.4%
*-commutative75.4%
fma-udef75.4%
distribute-lft-neg-in75.4%
distribute-rgt-neg-in75.4%
*-commutative75.4%
distribute-rgt-neg-in75.4%
metadata-eval75.4%
associate-*l*75.4%
Applied egg-rr75.4%
fma-def75.4%
fma-def75.4%
*-commutative75.4%
Simplified75.4%
Taylor expanded in b around 0 69.4%
associate-*l/69.5%
*-lft-identity69.5%
distribute-rgt-out69.9%
*-commutative69.9%
metadata-eval69.9%
associate-*r*69.9%
*-commutative69.9%
Simplified69.9%
if 1.55000000000000006e-35 < b Initial program 12.8%
*-commutative12.8%
Simplified12.8%
Taylor expanded in b around inf 92.2%
mul-1-neg92.2%
distribute-neg-frac92.2%
Simplified92.2%
Final simplification80.9%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (- (/ c b) (/ b a)) (/ (- c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-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 <= (-5d-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 <= -5e-310) {
tmp = (c / b) - (b / a);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = (c / b) - (b / a) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-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 <= -5e-310) tmp = (c / b) - (b / a); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-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 -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 69.3%
*-commutative69.3%
Simplified69.3%
Taylor expanded in b around -inf 58.4%
+-commutative58.4%
mul-1-neg58.4%
unsub-neg58.4%
Simplified58.4%
if -4.999999999999985e-310 < b Initial program 36.6%
*-commutative36.6%
Simplified36.6%
Taylor expanded in b around inf 62.4%
mul-1-neg62.4%
distribute-neg-frac62.4%
Simplified62.4%
Final simplification60.5%
(FPCore (a b c) :precision binary64 (if (<= b -6.6e-301) (/ (- b) a) (/ 0.0 a)))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.6e-301) {
tmp = -b / a;
} else {
tmp = 0.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) :: tmp
if (b <= (-6.6d-301)) then
tmp = -b / a
else
tmp = 0.0d0 / a
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -6.6e-301) {
tmp = -b / a;
} else {
tmp = 0.0 / a;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.6e-301: tmp = -b / a else: tmp = 0.0 / a return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.6e-301) tmp = Float64(Float64(-b) / a); else tmp = Float64(0.0 / a); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6.6e-301) tmp = -b / a; else tmp = 0.0 / a; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.6e-301], N[((-b) / a), $MachinePrecision], N[(0.0 / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.6 \cdot 10^{-301}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{a}\\
\end{array}
\end{array}
if b < -6.6000000000000001e-301Initial program 68.6%
*-commutative68.6%
Simplified68.6%
Taylor expanded in b around -inf 59.6%
associate-*r/59.6%
mul-1-neg59.6%
Simplified59.6%
if -6.6000000000000001e-301 < b Initial program 38.0%
*-commutative38.0%
Simplified38.0%
prod-diff37.7%
*-commutative37.7%
fma-def37.7%
associate-+l+37.7%
pow237.7%
*-commutative37.7%
distribute-rgt-neg-in37.7%
*-commutative37.7%
distribute-rgt-neg-in37.7%
metadata-eval37.7%
*-commutative37.7%
fma-udef37.7%
distribute-lft-neg-in37.7%
distribute-rgt-neg-in37.7%
*-commutative37.7%
distribute-rgt-neg-in37.7%
metadata-eval37.7%
associate-*l*37.7%
Applied egg-rr37.7%
fma-def37.7%
fma-def37.7%
*-commutative37.7%
Simplified37.7%
clear-num37.7%
inv-pow37.7%
Applied egg-rr40.7%
unpow-140.7%
*-commutative40.7%
metadata-eval40.7%
distribute-rgt-out40.7%
associate-*r*40.7%
*-commutative40.7%
fma-def40.7%
*-commutative40.7%
associate-*r*40.7%
distribute-rgt-in41.0%
distribute-rgt-out41.0%
metadata-eval41.0%
*-commutative41.0%
distribute-rgt-out41.0%
metadata-eval41.0%
mul0-rgt41.0%
mul0-rgt41.0%
Simplified41.0%
Taylor expanded in a around 0 15.8%
associate-*r/15.8%
distribute-rgt1-in15.8%
metadata-eval15.8%
mul0-lft15.8%
metadata-eval15.8%
Simplified15.8%
Final simplification35.6%
(FPCore (a b c) :precision binary64 (if (<= b 1.65e-292) (/ (- b) a) (/ (- c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.65e-292) {
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.65d-292) 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.65e-292) {
tmp = -b / a;
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.65e-292: tmp = -b / a else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.65e-292) 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.65e-292) tmp = -b / a; else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.65e-292], N[((-b) / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.65 \cdot 10^{-292}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < 1.64999999999999997e-292Initial program 69.9%
*-commutative69.9%
Simplified69.9%
Taylor expanded in b around -inf 57.3%
associate-*r/57.3%
mul-1-neg57.3%
Simplified57.3%
if 1.64999999999999997e-292 < b Initial program 35.7%
*-commutative35.7%
Simplified35.7%
Taylor expanded in b around inf 63.2%
mul-1-neg63.2%
distribute-neg-frac63.2%
Simplified63.2%
Final simplification60.4%
(FPCore (a b c) :precision binary64 (/ 0.0 a))
double code(double a, double b, double c) {
return 0.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 = 0.0d0 / a
end function
public static double code(double a, double b, double c) {
return 0.0 / a;
}
def code(a, b, c): return 0.0 / a
function code(a, b, c) return Float64(0.0 / a) end
function tmp = code(a, b, c) tmp = 0.0 / a; end
code[a_, b_, c_] := N[(0.0 / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{0}{a}
\end{array}
Initial program 51.8%
*-commutative51.8%
Simplified51.8%
prod-diff51.5%
*-commutative51.5%
fma-def51.5%
associate-+l+51.5%
pow251.5%
*-commutative51.5%
distribute-rgt-neg-in51.5%
*-commutative51.5%
distribute-rgt-neg-in51.5%
metadata-eval51.5%
*-commutative51.5%
fma-udef51.5%
distribute-lft-neg-in51.5%
distribute-rgt-neg-in51.5%
*-commutative51.5%
distribute-rgt-neg-in51.5%
metadata-eval51.5%
associate-*l*51.5%
Applied egg-rr51.5%
fma-def51.5%
fma-def51.5%
*-commutative51.5%
Simplified51.5%
clear-num51.4%
inv-pow51.4%
Applied egg-rr50.0%
unpow-150.0%
*-commutative50.0%
metadata-eval50.0%
distribute-rgt-out50.0%
associate-*r*50.0%
*-commutative50.0%
fma-def50.0%
*-commutative50.0%
associate-*r*50.0%
distribute-rgt-in50.3%
distribute-rgt-out50.3%
metadata-eval50.3%
*-commutative50.3%
distribute-rgt-out50.3%
metadata-eval50.3%
mul0-rgt50.3%
mul0-rgt50.3%
Simplified50.3%
Taylor expanded in a around 0 9.9%
associate-*r/9.9%
distribute-rgt1-in9.9%
metadata-eval9.9%
mul0-lft9.9%
metadata-eval9.9%
Simplified9.9%
Final simplification9.9%
herbie shell --seed 2023310
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))