
(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 -7.8e+134)
(/ (- b) a)
(if (<= b 1.8e-116)
(/ (- (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 <= -7.8e+134) {
tmp = -b / a;
} else if (b <= 1.8e-116) {
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 <= (-7.8d+134)) then
tmp = -b / a
else if (b <= 1.8d-116) 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 <= -7.8e+134) {
tmp = -b / a;
} else if (b <= 1.8e-116) {
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 <= -7.8e+134: tmp = -b / a elif b <= 1.8e-116: 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 <= -7.8e+134) tmp = Float64(Float64(-b) / a); elseif (b <= 1.8e-116) 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 <= -7.8e+134) tmp = -b / a; elseif (b <= 1.8e-116) 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, -7.8e+134], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 1.8e-116], 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 -7.8 \cdot 10^{+134}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{elif}\;b \leq 1.8 \cdot 10^{-116}:\\
\;\;\;\;\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 < -7.79999999999999967e134Initial program 52.4%
*-commutative52.4%
Simplified52.4%
Taylor expanded in b around -inf 93.0%
associate-*r/93.0%
mul-1-neg93.0%
Simplified93.0%
if -7.79999999999999967e134 < b < 1.79999999999999988e-116Initial program 89.1%
if 1.79999999999999988e-116 < b Initial program 17.6%
*-commutative17.6%
Simplified17.6%
Taylor expanded in b around inf 84.4%
mul-1-neg84.4%
distribute-neg-frac84.4%
Simplified84.4%
Final simplification87.8%
(FPCore (a b c)
:precision binary64
(if (<= b -1.76e-53)
(/ (- b) a)
(if (<= b 3.4e-116)
(* (/ 0.5 a) (- (sqrt (* c (* a -4.0))) b))
(/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.76e-53) {
tmp = -b / a;
} else if (b <= 3.4e-116) {
tmp = (0.5 / a) * (sqrt((c * (a * -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 <= (-1.76d-53)) then
tmp = -b / a
else if (b <= 3.4d-116) then
tmp = (0.5d0 / a) * (sqrt((c * (a * (-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 <= -1.76e-53) {
tmp = -b / a;
} else if (b <= 3.4e-116) {
tmp = (0.5 / a) * (Math.sqrt((c * (a * -4.0))) - b);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.76e-53: tmp = -b / a elif b <= 3.4e-116: tmp = (0.5 / a) * (math.sqrt((c * (a * -4.0))) - b) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.76e-53) tmp = Float64(Float64(-b) / a); elseif (b <= 3.4e-116) tmp = Float64(Float64(0.5 / a) * Float64(sqrt(Float64(c * Float64(a * -4.0))) - b)); else tmp = Float64(Float64(-c) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.76e-53) tmp = -b / a; elseif (b <= 3.4e-116) tmp = (0.5 / a) * (sqrt((c * (a * -4.0))) - b); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.76e-53], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 3.4e-116], N[(N[(0.5 / a), $MachinePrecision] * N[(N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.76 \cdot 10^{-53}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{elif}\;b \leq 3.4 \cdot 10^{-116}:\\
\;\;\;\;\frac{0.5}{a} \cdot \left(\sqrt{c \cdot \left(a \cdot -4\right)} - b\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -1.76e-53Initial program 78.3%
*-commutative78.3%
Simplified78.3%
Taylor expanded in b around -inf 90.5%
associate-*r/90.5%
mul-1-neg90.5%
Simplified90.5%
if -1.76e-53 < b < 3.39999999999999992e-116Initial program 80.8%
*-commutative80.8%
Simplified80.8%
prod-diff80.5%
*-commutative80.5%
fma-def80.5%
associate-+l+80.5%
pow280.5%
distribute-lft-neg-in80.5%
*-commutative80.5%
distribute-rgt-neg-in80.5%
metadata-eval80.5%
associate-*r*80.5%
*-commutative80.5%
*-commutative80.5%
fma-udef80.5%
Applied egg-rr80.5%
fma-def80.5%
fma-def80.4%
associate-*l*80.4%
Simplified80.4%
Taylor expanded in b around 0 77.2%
mul-1-neg77.2%
unsub-neg77.2%
distribute-rgt-out77.5%
metadata-eval77.5%
associate-*r*77.5%
*-commutative77.5%
Simplified77.5%
expm1-log1p-u59.8%
expm1-udef23.3%
clear-num23.3%
associate-/r/23.3%
*-commutative23.3%
associate-/r*23.3%
metadata-eval23.3%
associate-*r*23.3%
*-commutative23.3%
Applied egg-rr23.3%
expm1-def59.7%
expm1-log1p77.3%
Simplified77.3%
if 3.39999999999999992e-116 < b Initial program 17.6%
*-commutative17.6%
Simplified17.6%
Taylor expanded in b around inf 84.4%
mul-1-neg84.4%
distribute-neg-frac84.4%
Simplified84.4%
Final simplification84.8%
(FPCore (a b c)
:precision binary64
(if (<= b -1.52e-53)
(/ (- b) a)
(if (<= b 3.5e-116)
(/ (- (sqrt (* a (* c -4.0))) b) (* a 2.0))
(/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.52e-53) {
tmp = -b / a;
} else if (b <= 3.5e-116) {
tmp = (sqrt((a * (c * -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.52d-53)) then
tmp = -b / a
else if (b <= 3.5d-116) then
tmp = (sqrt((a * (c * (-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.52e-53) {
tmp = -b / a;
} else if (b <= 3.5e-116) {
tmp = (Math.sqrt((a * (c * -4.0))) - b) / (a * 2.0);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.52e-53: tmp = -b / a elif b <= 3.5e-116: tmp = (math.sqrt((a * (c * -4.0))) - b) / (a * 2.0) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.52e-53) tmp = Float64(Float64(-b) / a); elseif (b <= 3.5e-116) tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -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.52e-53) tmp = -b / a; elseif (b <= 3.5e-116) tmp = (sqrt((a * (c * -4.0))) - b) / (a * 2.0); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.52e-53], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 3.5e-116], N[(N[(N[Sqrt[N[(a * N[(c * -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.52 \cdot 10^{-53}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{elif}\;b \leq 3.5 \cdot 10^{-116}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -4\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -1.5200000000000001e-53Initial program 78.3%
*-commutative78.3%
Simplified78.3%
Taylor expanded in b around -inf 90.5%
associate-*r/90.5%
mul-1-neg90.5%
Simplified90.5%
if -1.5200000000000001e-53 < b < 3.49999999999999984e-116Initial program 80.8%
*-commutative80.8%
Simplified80.8%
prod-diff80.5%
*-commutative80.5%
fma-def80.5%
associate-+l+80.5%
pow280.5%
distribute-lft-neg-in80.5%
*-commutative80.5%
distribute-rgt-neg-in80.5%
metadata-eval80.5%
associate-*r*80.5%
*-commutative80.5%
*-commutative80.5%
fma-udef80.5%
Applied egg-rr80.5%
fma-def80.5%
fma-def80.4%
associate-*l*80.4%
Simplified80.4%
Taylor expanded in b around 0 77.2%
mul-1-neg77.2%
unsub-neg77.2%
distribute-rgt-out77.5%
metadata-eval77.5%
associate-*r*77.5%
*-commutative77.5%
Simplified77.5%
if 3.49999999999999984e-116 < b Initial program 17.6%
*-commutative17.6%
Simplified17.6%
Taylor expanded in b around inf 84.4%
mul-1-neg84.4%
distribute-neg-frac84.4%
Simplified84.4%
Final simplification84.8%
(FPCore (a b c) :precision binary64 (if (<= b -1.9e-53) (/ (- b) a) (if (<= b 3.5e-116) (* 0.5 (/ (sqrt (* a (* c -4.0))) a)) (/ (- c) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.9e-53) {
tmp = -b / a;
} else if (b <= 3.5e-116) {
tmp = 0.5 * (sqrt((a * (c * -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 <= (-1.9d-53)) then
tmp = -b / a
else if (b <= 3.5d-116) then
tmp = 0.5d0 * (sqrt((a * (c * (-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 <= -1.9e-53) {
tmp = -b / a;
} else if (b <= 3.5e-116) {
tmp = 0.5 * (Math.sqrt((a * (c * -4.0))) / a);
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.9e-53: tmp = -b / a elif b <= 3.5e-116: tmp = 0.5 * (math.sqrt((a * (c * -4.0))) / a) else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.9e-53) tmp = Float64(Float64(-b) / a); elseif (b <= 3.5e-116) tmp = Float64(0.5 * Float64(sqrt(Float64(a * Float64(c * -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 <= -1.9e-53) tmp = -b / a; elseif (b <= 3.5e-116) tmp = 0.5 * (sqrt((a * (c * -4.0))) / a); else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.9e-53], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 3.5e-116], N[(0.5 * N[(N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.9 \cdot 10^{-53}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{elif}\;b \leq 3.5 \cdot 10^{-116}:\\
\;\;\;\;0.5 \cdot \frac{\sqrt{a \cdot \left(c \cdot -4\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < -1.8999999999999999e-53Initial program 78.3%
*-commutative78.3%
Simplified78.3%
Taylor expanded in b around -inf 90.5%
associate-*r/90.5%
mul-1-neg90.5%
Simplified90.5%
if -1.8999999999999999e-53 < b < 3.49999999999999984e-116Initial program 80.8%
*-commutative80.8%
Simplified80.8%
prod-diff80.5%
*-commutative80.5%
fma-def80.5%
associate-+l+80.5%
pow280.5%
distribute-lft-neg-in80.5%
*-commutative80.5%
distribute-rgt-neg-in80.5%
metadata-eval80.5%
associate-*r*80.5%
*-commutative80.5%
*-commutative80.5%
fma-udef80.5%
Applied egg-rr80.5%
fma-def80.5%
fma-def80.4%
associate-*l*80.4%
Simplified80.4%
Taylor expanded in b around 0 76.2%
associate-*l/76.4%
*-lft-identity76.4%
distribute-rgt-out76.7%
metadata-eval76.7%
associate-*r*76.7%
*-commutative76.7%
Simplified76.7%
if 3.49999999999999984e-116 < b Initial program 17.6%
*-commutative17.6%
Simplified17.6%
Taylor expanded in b around inf 84.4%
mul-1-neg84.4%
distribute-neg-frac84.4%
Simplified84.4%
Final simplification84.6%
(FPCore (a b c) :precision binary64 (if (<= b 2.15e+101) (/ (- b) a) (/ c b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.15e+101) {
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 <= 2.15d+101) 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 <= 2.15e+101) {
tmp = -b / a;
} else {
tmp = c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.15e+101: tmp = -b / a else: tmp = c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.15e+101) tmp = Float64(Float64(-b) / a); else tmp = Float64(c / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 2.15e+101) tmp = -b / a; else tmp = c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.15e+101], N[((-b) / a), $MachinePrecision], N[(c / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.15 \cdot 10^{+101}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b}\\
\end{array}
\end{array}
if b < 2.15e101Initial program 67.3%
*-commutative67.3%
Simplified67.3%
Taylor expanded in b around -inf 43.4%
associate-*r/43.4%
mul-1-neg43.4%
Simplified43.4%
if 2.15e101 < b Initial program 6.5%
*-commutative6.5%
Simplified6.5%
Applied egg-rr1.8%
Taylor expanded in b around -inf 32.0%
Final simplification40.9%
(FPCore (a b c) :precision binary64 (if (<= b 2.6e-287) (/ (- b) a) (/ (- c) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.6e-287) {
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 <= 2.6d-287) 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 <= 2.6e-287) {
tmp = -b / a;
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.6e-287: tmp = -b / a else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.6e-287) 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 <= 2.6e-287) tmp = -b / a; else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.6e-287], N[((-b) / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.6 \cdot 10^{-287}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if b < 2.6e-287Initial program 80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in b around -inf 66.4%
associate-*r/66.4%
mul-1-neg66.4%
Simplified66.4%
if 2.6e-287 < b Initial program 28.0%
*-commutative28.0%
Simplified28.0%
Taylor expanded in b around inf 71.7%
mul-1-neg71.7%
distribute-neg-frac71.7%
Simplified71.7%
Final simplification69.1%
(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 54.0%
*-commutative54.0%
Simplified54.0%
Applied egg-rr31.5%
Taylor expanded in a around 0 2.5%
Final simplification2.5%
(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 54.0%
*-commutative54.0%
Simplified54.0%
Applied egg-rr31.5%
Taylor expanded in b around -inf 9.3%
Final simplification9.3%
herbie shell --seed 2023321
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))