
(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 19 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.4e-7) (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) (pow (- (cbrt (/ c b))) 3.0)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.4e-7) {
tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
} else {
tmp = pow(-cbrt((c / b)), 3.0);
}
return tmp;
}
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.4e-7) {
tmp = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
} else {
tmp = Math.pow(-Math.cbrt((c / b)), 3.0);
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 1.4e-7) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)); else tmp = Float64(-cbrt(Float64(c / b))) ^ 3.0; end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 1.4e-7], 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[Power[(-N[Power[N[(c / b), $MachinePrecision], 1/3], $MachinePrecision]), 3.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.4 \cdot 10^{-7}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;{\left(-\sqrt[3]{\frac{c}{b}}\right)}^{3}\\
\end{array}
\end{array}
if b < 1.4000000000000001e-7Initial program 67.9%
if 1.4000000000000001e-7 < b Initial program 12.4%
*-commutative12.4%
Simplified12.4%
Taylor expanded in b around -inf 2.5%
mul-1-neg2.5%
distribute-rgt-neg-in2.5%
+-commutative2.5%
mul-1-neg2.5%
unsub-neg2.5%
Simplified2.5%
add-cube-cbrt2.5%
pow32.5%
Applied egg-rr2.9%
Taylor expanded in c around -inf 90.6%
mul-1-neg90.6%
Simplified90.6%
Final simplification75.3%
(FPCore (a b c) :precision binary64 (let* ((t_0 (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)))) (if (<= t_0 5e+303) t_0 (/ (- (- c) (/ (* a (pow c 2.0)) (pow b 2.0))) b))))
double code(double a, double b, double c) {
double t_0 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
double tmp;
if (t_0 <= 5e+303) {
tmp = t_0;
} else {
tmp = (-c - ((a * pow(c, 2.0)) / pow(b, 2.0))) / 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) :: t_0
real(8) :: tmp
t_0 = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
if (t_0 <= 5d+303) then
tmp = t_0
else
tmp = (-c - ((a * (c ** 2.0d0)) / (b ** 2.0d0))) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
double tmp;
if (t_0 <= 5e+303) {
tmp = t_0;
} else {
tmp = (-c - ((a * Math.pow(c, 2.0)) / Math.pow(b, 2.0))) / b;
}
return tmp;
}
def code(a, b, c): t_0 = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0) tmp = 0 if t_0 <= 5e+303: tmp = t_0 else: tmp = (-c - ((a * math.pow(c, 2.0)) / math.pow(b, 2.0))) / b return tmp
function code(a, b, c) t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) tmp = 0.0 if (t_0 <= 5e+303) tmp = t_0; else tmp = Float64(Float64(Float64(-c) - Float64(Float64(a * (c ^ 2.0)) / (b ^ 2.0))) / b); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0); tmp = 0.0; if (t_0 <= 5e+303) tmp = t_0; else tmp = (-c - ((a * (c ^ 2.0)) / (b ^ 2.0))) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, 5e+303], t$95$0, N[(N[((-c) - N[(N[(a * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+303}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-c\right) - \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 4.9999999999999997e303Initial program 58.9%
if 4.9999999999999997e303 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) Initial program 22.5%
*-commutative22.5%
Simplified22.5%
Taylor expanded in b around inf 29.5%
mul-1-neg29.5%
unsub-neg29.5%
mul-1-neg29.5%
Simplified29.5%
Final simplification51.7%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))))
(if (<= t_0 5e+303)
t_0
(/ 1.0 (pow (pow (- (/ a b) (/ b c)) 3.0) 0.3333333333333333)))))
double code(double a, double b, double c) {
double t_0 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
double tmp;
if (t_0 <= 5e+303) {
tmp = t_0;
} else {
tmp = 1.0 / pow(pow(((a / b) - (b / c)), 3.0), 0.3333333333333333);
}
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) :: t_0
real(8) :: tmp
t_0 = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
if (t_0 <= 5d+303) then
tmp = t_0
else
tmp = 1.0d0 / ((((a / b) - (b / c)) ** 3.0d0) ** 0.3333333333333333d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
double tmp;
if (t_0 <= 5e+303) {
tmp = t_0;
} else {
tmp = 1.0 / Math.pow(Math.pow(((a / b) - (b / c)), 3.0), 0.3333333333333333);
}
return tmp;
}
def code(a, b, c): t_0 = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0) tmp = 0 if t_0 <= 5e+303: tmp = t_0 else: tmp = 1.0 / math.pow(math.pow(((a / b) - (b / c)), 3.0), 0.3333333333333333) return tmp
function code(a, b, c) t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) tmp = 0.0 if (t_0 <= 5e+303) tmp = t_0; else tmp = Float64(1.0 / ((Float64(Float64(a / b) - Float64(b / c)) ^ 3.0) ^ 0.3333333333333333)); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0); tmp = 0.0; if (t_0 <= 5e+303) tmp = t_0; else tmp = 1.0 / ((((a / b) - (b / c)) ^ 3.0) ^ 0.3333333333333333); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, 5e+303], t$95$0, N[(1.0 / N[Power[N[Power[N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+303}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left({\left(\frac{a}{b} - \frac{b}{c}\right)}^{3}\right)}^{0.3333333333333333}}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 4.9999999999999997e303Initial program 58.9%
if 4.9999999999999997e303 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) Initial program 22.5%
*-commutative22.5%
Simplified22.5%
Applied egg-rr22.4%
sub-neg22.4%
distribute-rgt-out--22.6%
Simplified22.6%
associate-*l/22.6%
clear-num22.6%
Applied egg-rr22.6%
Taylor expanded in a around 0 47.2%
+-commutative47.2%
mul-1-neg47.2%
unsub-neg47.2%
Simplified47.2%
add-cbrt-cube33.8%
pow1/331.3%
pow331.3%
Applied egg-rr31.3%
Final simplification52.1%
(FPCore (a b c) :precision binary64 (let* ((t_0 (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)))) (if (<= t_0 5e+303) t_0 (/ 1.0 (pow (cbrt (- (/ a b) (/ b c))) 3.0)))))
double code(double a, double b, double c) {
double t_0 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
double tmp;
if (t_0 <= 5e+303) {
tmp = t_0;
} else {
tmp = 1.0 / pow(cbrt(((a / b) - (b / c))), 3.0);
}
return tmp;
}
public static double code(double a, double b, double c) {
double t_0 = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
double tmp;
if (t_0 <= 5e+303) {
tmp = t_0;
} else {
tmp = 1.0 / Math.pow(Math.cbrt(((a / b) - (b / c))), 3.0);
}
return tmp;
}
function code(a, b, c) t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) tmp = 0.0 if (t_0 <= 5e+303) tmp = t_0; else tmp = Float64(1.0 / (cbrt(Float64(Float64(a / b) - Float64(b / c))) ^ 3.0)); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, 5e+303], t$95$0, N[(1.0 / N[Power[N[Power[N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+303}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left(\sqrt[3]{\frac{a}{b} - \frac{b}{c}}\right)}^{3}}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < 4.9999999999999997e303Initial program 58.9%
if 4.9999999999999997e303 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) Initial program 22.5%
*-commutative22.5%
Simplified22.5%
Applied egg-rr22.4%
sub-neg22.4%
distribute-rgt-out--22.6%
Simplified22.6%
associate-*l/22.6%
clear-num22.6%
Applied egg-rr22.6%
Taylor expanded in a around 0 47.2%
+-commutative47.2%
mul-1-neg47.2%
unsub-neg47.2%
Simplified47.2%
add-cube-cbrt46.9%
pow346.9%
Applied egg-rr46.9%
Final simplification55.9%
(FPCore (a b c) :precision binary64 (if (<= b 1.15e+112) (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) (pow (sqrt (- (/ a b) (/ b c))) -2.0)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.15e+112) {
tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
} else {
tmp = pow(sqrt(((a / b) - (b / c))), -2.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.15d+112) then
tmp = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
else
tmp = sqrt(((a / b) - (b / c))) ** (-2.0d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.15e+112) {
tmp = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
} else {
tmp = Math.pow(Math.sqrt(((a / b) - (b / c))), -2.0);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.15e+112: tmp = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0) else: tmp = math.pow(math.sqrt(((a / b) - (b / c))), -2.0) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.15e+112) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)); else tmp = sqrt(Float64(Float64(a / b) - Float64(b / c))) ^ -2.0; end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.15e+112) tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0); else tmp = sqrt(((a / b) - (b / c))) ^ -2.0; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.15e+112], 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[Power[N[Sqrt[N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], -2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.15 \cdot 10^{+112}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{\frac{a}{b} - \frac{b}{c}}\right)}^{-2}\\
\end{array}
\end{array}
if b < 1.15e112Initial program 64.2%
if 1.15e112 < b Initial program 5.3%
*-commutative5.3%
Simplified5.3%
Applied egg-rr3.1%
sub-neg3.1%
distribute-rgt-out--5.4%
Simplified5.4%
associate-*l/5.4%
clear-num5.4%
Applied egg-rr5.4%
Taylor expanded in a around 0 92.2%
+-commutative92.2%
mul-1-neg92.2%
unsub-neg92.2%
Simplified92.2%
inv-pow92.2%
add-sqr-sqrt51.3%
unpow-prod-down51.3%
Applied egg-rr51.3%
pow-sqr51.4%
metadata-eval51.4%
Simplified51.4%
Final simplification61.1%
(FPCore (a b c) :precision binary64 (if (<= b 1.22e+112) (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) (exp (- (log (- (/ a b) (/ b c)))))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.22e+112) {
tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
} else {
tmp = exp(-log(((a / b) - (b / c))));
}
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.22d+112) then
tmp = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
else
tmp = exp(-log(((a / b) - (b / c))))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.22e+112) {
tmp = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
} else {
tmp = Math.exp(-Math.log(((a / b) - (b / c))));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.22e+112: tmp = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0) else: tmp = math.exp(-math.log(((a / b) - (b / c)))) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.22e+112) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)); else tmp = exp(Float64(-log(Float64(Float64(a / b) - Float64(b / c))))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.22e+112) tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0); else tmp = exp(-log(((a / b) - (b / c)))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.22e+112], 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[Exp[(-N[Log[N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.22 \cdot 10^{+112}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;e^{-\log \left(\frac{a}{b} - \frac{b}{c}\right)}\\
\end{array}
\end{array}
if b < 1.22e112Initial program 64.2%
if 1.22e112 < b Initial program 5.3%
*-commutative5.3%
Simplified5.3%
Applied egg-rr3.1%
sub-neg3.1%
distribute-rgt-out--5.4%
Simplified5.4%
associate-*l/5.4%
clear-num5.4%
Applied egg-rr5.4%
Taylor expanded in a around 0 92.2%
+-commutative92.2%
mul-1-neg92.2%
unsub-neg92.2%
Simplified92.2%
add-exp-log65.2%
log-rec48.9%
Applied egg-rr48.9%
Final simplification60.5%
(FPCore (a b c) :precision binary64 (/ (- (sqrt (fma a (* c -4.0) (* b b))) b) (* a 2.0)))
double code(double a, double b, double c) {
return (sqrt(fma(a, (c * -4.0), (b * b))) - b) / (a * 2.0);
}
function code(a, b, c) return Float64(Float64(sqrt(fma(a, Float64(c * -4.0), Float64(b * b))) - b) / Float64(a * 2.0)) end
code[a_, b_, c_] := N[(N[(N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}
\end{array}
Initial program 49.9%
*-commutative49.9%
Simplified50.0%
Final simplification50.0%
(FPCore (a b c) :precision binary64 (if (<= b -7e-105) (- (/ c b) (/ b a)) (- (* (sqrt (* a (* c -4.0))) (/ 0.5 a)) (* b (/ 0.5 a)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7e-105) {
tmp = (c / b) - (b / a);
} else {
tmp = (sqrt((a * (c * -4.0))) * (0.5 / a)) - (b * (0.5 / 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 <= (-7d-105)) then
tmp = (c / b) - (b / a)
else
tmp = (sqrt((a * (c * (-4.0d0)))) * (0.5d0 / a)) - (b * (0.5d0 / a))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -7e-105) {
tmp = (c / b) - (b / a);
} else {
tmp = (Math.sqrt((a * (c * -4.0))) * (0.5 / a)) - (b * (0.5 / a));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7e-105: tmp = (c / b) - (b / a) else: tmp = (math.sqrt((a * (c * -4.0))) * (0.5 / a)) - (b * (0.5 / a)) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7e-105) tmp = Float64(Float64(c / b) - Float64(b / a)); else tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -4.0))) * Float64(0.5 / a)) - Float64(b * Float64(0.5 / a))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -7e-105) tmp = (c / b) - (b / a); else tmp = (sqrt((a * (c * -4.0))) * (0.5 / a)) - (b * (0.5 / a)); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7e-105], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision] - N[(b * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7 \cdot 10^{-105}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{a \cdot \left(c \cdot -4\right)} \cdot \frac{0.5}{a} - b \cdot \frac{0.5}{a}\\
\end{array}
\end{array}
if b < -7e-105Initial program 69.1%
*-commutative69.1%
Simplified69.1%
Taylor expanded in b around -inf 90.8%
mul-1-neg90.8%
distribute-rgt-neg-in90.8%
+-commutative90.8%
mul-1-neg90.8%
unsub-neg90.8%
Simplified90.8%
Taylor expanded in a around inf 91.0%
+-commutative91.0%
mul-1-neg91.0%
unsub-neg91.0%
Simplified91.0%
if -7e-105 < b Initial program 37.9%
*-commutative37.9%
Simplified37.9%
Applied egg-rr36.9%
Taylor expanded in a around inf 29.0%
*-commutative29.0%
associate-*r*29.0%
Simplified29.0%
Final simplification53.0%
(FPCore (a b c) :precision binary64 (if (<= b -1e-311) (- (/ c b) (/ b a)) (/ 1.0 (* (- (* a c) (pow b 2.0)) (/ 1.0 (* c b))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = (c / b) - (b / a);
} else {
tmp = 1.0 / (((a * c) - pow(b, 2.0)) * (1.0 / (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-311)) then
tmp = (c / b) - (b / a)
else
tmp = 1.0d0 / (((a * c) - (b ** 2.0d0)) * (1.0d0 / (c * b)))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = (c / b) - (b / a);
} else {
tmp = 1.0 / (((a * c) - Math.pow(b, 2.0)) * (1.0 / (c * b)));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-311: tmp = (c / b) - (b / a) else: tmp = 1.0 / (((a * c) - math.pow(b, 2.0)) * (1.0 / (c * b))) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-311) tmp = Float64(Float64(c / b) - Float64(b / a)); else tmp = Float64(1.0 / Float64(Float64(Float64(a * c) - (b ^ 2.0)) * Float64(1.0 / Float64(c * b)))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-311) tmp = (c / b) - (b / a); else tmp = 1.0 / (((a * c) - (b ^ 2.0)) * (1.0 / (c * b))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-311], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(a * c), $MachinePrecision] - N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(c * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(a \cdot c - {b}^{2}\right) \cdot \frac{1}{c \cdot b}}\\
\end{array}
\end{array}
if b < -9.99999999999948e-312Initial program 70.6%
*-commutative70.6%
Simplified70.6%
Taylor expanded in b around -inf 72.2%
mul-1-neg72.2%
distribute-rgt-neg-in72.2%
+-commutative72.2%
mul-1-neg72.2%
unsub-neg72.2%
Simplified72.2%
Taylor expanded in a around inf 74.1%
+-commutative74.1%
mul-1-neg74.1%
unsub-neg74.1%
Simplified74.1%
if -9.99999999999948e-312 < b Initial program 28.7%
*-commutative28.7%
Simplified28.7%
Applied egg-rr27.5%
sub-neg27.5%
distribute-rgt-out--28.7%
Simplified28.7%
associate-*l/28.7%
clear-num28.7%
Applied egg-rr28.7%
Taylor expanded in a around 0 68.7%
+-commutative68.7%
mul-1-neg68.7%
unsub-neg68.7%
Simplified68.7%
frac-sub44.3%
div-inv44.3%
pow244.3%
Applied egg-rr44.3%
Final simplification59.4%
(FPCore (a b c) :precision binary64 (if (<= b 8e-95) (- (/ c b) (/ b a)) (* c (- (/ -1.0 b) (/ (* a c) (pow b 3.0))))))
double code(double a, double b, double c) {
double tmp;
if (b <= 8e-95) {
tmp = (c / b) - (b / a);
} else {
tmp = c * ((-1.0 / b) - ((a * c) / pow(b, 3.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 <= 8d-95) then
tmp = (c / b) - (b / a)
else
tmp = c * (((-1.0d0) / b) - ((a * c) / (b ** 3.0d0)))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 8e-95) {
tmp = (c / b) - (b / a);
} else {
tmp = c * ((-1.0 / b) - ((a * c) / Math.pow(b, 3.0)));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 8e-95: tmp = (c / b) - (b / a) else: tmp = c * ((-1.0 / b) - ((a * c) / math.pow(b, 3.0))) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 8e-95) tmp = Float64(Float64(c / b) - Float64(b / a)); else tmp = Float64(c * Float64(Float64(-1.0 / b) - Float64(Float64(a * c) / (b ^ 3.0)))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 8e-95) tmp = (c / b) - (b / a); else tmp = c * ((-1.0 / b) - ((a * c) / (b ^ 3.0))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 8e-95], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(-1.0 / b), $MachinePrecision] - N[(N[(a * c), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8 \cdot 10^{-95}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(\frac{-1}{b} - \frac{a \cdot c}{{b}^{3}}\right)\\
\end{array}
\end{array}
if b < 7.99999999999999992e-95Initial program 69.4%
*-commutative69.4%
Simplified69.4%
Taylor expanded in b around -inf 59.9%
mul-1-neg59.9%
distribute-rgt-neg-in59.9%
+-commutative59.9%
mul-1-neg59.9%
unsub-neg59.9%
Simplified59.9%
Taylor expanded in a around inf 61.6%
+-commutative61.6%
mul-1-neg61.6%
unsub-neg61.6%
Simplified61.6%
if 7.99999999999999992e-95 < b Initial program 19.0%
*-commutative19.0%
Simplified19.0%
Taylor expanded in c around 0 78.7%
associate-*r/78.7%
neg-mul-178.7%
distribute-rgt-neg-in78.7%
Simplified78.7%
Final simplification68.2%
(FPCore (a b c) :precision binary64 (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)))
double code(double a, double b, double c) {
return (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
end function
public static double code(double a, double b, double c) {
return (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
}
def code(a, b, c): return (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)
function code(a, b, c) return Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) end
function tmp = code(a, b, c) tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0); end
code[a_, b_, c_] := 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]
\begin{array}{l}
\\
\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}
\end{array}
Initial program 49.9%
Final simplification49.9%
(FPCore (a b c) :precision binary64 (if (<= b -1e-311) (/ (- b) a) (* (/ 0.5 a) (- b b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = -b / a;
} else {
tmp = (0.5 / a) * (b - 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-311)) then
tmp = -b / a
else
tmp = (0.5d0 / a) * (b - b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-311) {
tmp = -b / a;
} else {
tmp = (0.5 / a) * (b - b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-311: tmp = -b / a else: tmp = (0.5 / a) * (b - b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-311) tmp = Float64(Float64(-b) / a); else tmp = Float64(Float64(0.5 / a) * Float64(b - b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-311) tmp = -b / a; else tmp = (0.5 / a) * (b - b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-311], N[((-b) / a), $MachinePrecision], N[(N[(0.5 / a), $MachinePrecision] * N[(b - b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{a} \cdot \left(b - b\right)\\
\end{array}
\end{array}
if b < -9.99999999999948e-312Initial program 70.6%
*-commutative70.6%
Simplified70.6%
Taylor expanded in b around -inf 73.6%
mul-1-neg73.6%
distribute-neg-frac273.6%
Simplified73.6%
if -9.99999999999948e-312 < b Initial program 28.7%
*-commutative28.7%
Simplified28.7%
Applied egg-rr27.5%
sub-neg27.5%
distribute-rgt-out--28.7%
Simplified28.7%
Taylor expanded in a around 0 24.2%
Final simplification49.3%
(FPCore (a b c) :precision binary64 (if (<= a -9e-22) (/ (- c) b) (* b (/ -1.0 a))))
double code(double a, double b, double c) {
double tmp;
if (a <= -9e-22) {
tmp = -c / b;
} else {
tmp = b * (-1.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 (a <= (-9d-22)) then
tmp = -c / b
else
tmp = b * ((-1.0d0) / a)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (a <= -9e-22) {
tmp = -c / b;
} else {
tmp = b * (-1.0 / a);
}
return tmp;
}
def code(a, b, c): tmp = 0 if a <= -9e-22: tmp = -c / b else: tmp = b * (-1.0 / a) return tmp
function code(a, b, c) tmp = 0.0 if (a <= -9e-22) tmp = Float64(Float64(-c) / b); else tmp = Float64(b * Float64(-1.0 / a)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (a <= -9e-22) tmp = -c / b; else tmp = b * (-1.0 / a); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[a, -9e-22], N[((-c) / b), $MachinePrecision], N[(b * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9 \cdot 10^{-22}:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{else}:\\
\;\;\;\;b \cdot \frac{-1}{a}\\
\end{array}
\end{array}
if a < -8.99999999999999973e-22Initial program 30.6%
*-commutative30.6%
Simplified30.6%
Taylor expanded in b around inf 39.5%
associate-*r/39.5%
mul-1-neg39.5%
Simplified39.5%
if -8.99999999999999973e-22 < a Initial program 56.1%
*-commutative56.1%
Simplified56.1%
Taylor expanded in b around -inf 39.9%
mul-1-neg39.9%
distribute-rgt-neg-in39.9%
+-commutative39.9%
mul-1-neg39.9%
unsub-neg39.9%
Simplified39.9%
Taylor expanded in a around 0 41.2%
Final simplification40.8%
(FPCore (a b c) :precision binary64 (if (<= a -4.4e-22) (/ (- c) b) (/ -1.0 (/ a b))))
double code(double a, double b, double c) {
double tmp;
if (a <= -4.4e-22) {
tmp = -c / b;
} else {
tmp = -1.0 / (a / 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 (a <= (-4.4d-22)) then
tmp = -c / b
else
tmp = (-1.0d0) / (a / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (a <= -4.4e-22) {
tmp = -c / b;
} else {
tmp = -1.0 / (a / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if a <= -4.4e-22: tmp = -c / b else: tmp = -1.0 / (a / b) return tmp
function code(a, b, c) tmp = 0.0 if (a <= -4.4e-22) tmp = Float64(Float64(-c) / b); else tmp = Float64(-1.0 / Float64(a / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (a <= -4.4e-22) tmp = -c / b; else tmp = -1.0 / (a / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[a, -4.4e-22], N[((-c) / b), $MachinePrecision], N[(-1.0 / N[(a / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.4 \cdot 10^{-22}:\\
\;\;\;\;\frac{-c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{a}{b}}\\
\end{array}
\end{array}
if a < -4.4000000000000001e-22Initial program 30.6%
*-commutative30.6%
Simplified30.6%
Taylor expanded in b around inf 39.5%
associate-*r/39.5%
mul-1-neg39.5%
Simplified39.5%
if -4.4000000000000001e-22 < a Initial program 56.1%
*-commutative56.1%
Simplified56.1%
Applied egg-rr55.3%
sub-neg55.3%
distribute-rgt-out--56.0%
Simplified56.0%
associate-*l/56.1%
clear-num56.0%
Applied egg-rr56.0%
Taylor expanded in b around -inf 41.2%
associate-*r/41.2%
neg-mul-141.2%
Simplified41.2%
Final simplification40.8%
(FPCore (a b c) :precision binary64 (if (<= a 2.25e-243) (/ (- b) a) (/ (- c) b)))
double code(double a, double b, double c) {
double tmp;
if (a <= 2.25e-243) {
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 (a <= 2.25d-243) 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 (a <= 2.25e-243) {
tmp = -b / a;
} else {
tmp = -c / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if a <= 2.25e-243: tmp = -b / a else: tmp = -c / b return tmp
function code(a, b, c) tmp = 0.0 if (a <= 2.25e-243) 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 (a <= 2.25e-243) tmp = -b / a; else tmp = -c / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[a, 2.25e-243], N[((-b) / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.25 \cdot 10^{-243}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\
\end{array}
\end{array}
if a < 2.25000000000000009e-243Initial program 49.4%
*-commutative49.4%
Simplified49.4%
Taylor expanded in b around -inf 44.1%
mul-1-neg44.1%
distribute-neg-frac244.1%
Simplified44.1%
if 2.25000000000000009e-243 < a Initial program 50.5%
*-commutative50.5%
Simplified50.5%
Taylor expanded in b around inf 38.2%
associate-*r/38.2%
mul-1-neg38.2%
Simplified38.2%
Final simplification41.3%
(FPCore (a b c) :precision binary64 (- (/ c b) (/ b a)))
double code(double a, double b, double c) {
return (c / b) - (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 = (c / b) - (b / a)
end function
public static double code(double a, double b, double c) {
return (c / b) - (b / a);
}
def code(a, b, c): return (c / b) - (b / a)
function code(a, b, c) return Float64(Float64(c / b) - Float64(b / a)) end
function tmp = code(a, b, c) tmp = (c / b) - (b / a); end
code[a_, b_, c_] := N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{c}{b} - \frac{b}{a}
\end{array}
Initial program 49.9%
*-commutative49.9%
Simplified49.9%
Taylor expanded in b around -inf 37.8%
mul-1-neg37.8%
distribute-rgt-neg-in37.8%
+-commutative37.8%
mul-1-neg37.8%
unsub-neg37.8%
Simplified37.8%
Taylor expanded in a around inf 38.8%
+-commutative38.8%
mul-1-neg38.8%
unsub-neg38.8%
Simplified38.8%
Final simplification38.8%
(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(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 49.9%
*-commutative49.9%
Simplified49.9%
Taylor expanded in b around -inf 38.8%
mul-1-neg38.8%
distribute-neg-frac238.8%
Simplified38.8%
Final simplification38.8%
(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 49.9%
*-commutative49.9%
Simplified49.9%
Applied egg-rr28.0%
unpow-128.0%
associate-/l*28.0%
Simplified28.0%
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 49.9%
*-commutative49.9%
Simplified49.9%
Taylor expanded in b around -inf 37.8%
mul-1-neg37.8%
distribute-rgt-neg-in37.8%
+-commutative37.8%
mul-1-neg37.8%
unsub-neg37.8%
Simplified37.8%
Taylor expanded in b around 0 12.9%
Final simplification12.9%
herbie shell --seed 2024066
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))