
(FPCore (a b_2 c) :precision binary64 (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
double code(double a, double b_2, double c) {
return (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
code = (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a
end function
public static double code(double a, double b_2, double c) {
return (-b_2 + Math.sqrt(((b_2 * b_2) - (a * c)))) / a;
}
def code(a, b_2, c): return (-b_2 + math.sqrt(((b_2 * b_2) - (a * c)))) / a
function code(a, b_2, c) return Float64(Float64(Float64(-b_2) + sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))) / a) end
function tmp = code(a, b_2, c) tmp = (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a; end
code[a_, b$95$2_, c_] := N[(N[((-b$95$2) + N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b_2 c) :precision binary64 (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
double code(double a, double b_2, double c) {
return (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
code = (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a
end function
public static double code(double a, double b_2, double c) {
return (-b_2 + Math.sqrt(((b_2 * b_2) - (a * c)))) / a;
}
def code(a, b_2, c): return (-b_2 + math.sqrt(((b_2 * b_2) - (a * c)))) / a
function code(a, b_2, c) return Float64(Float64(Float64(-b_2) + sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))) / a) end
function tmp = code(a, b_2, c) tmp = (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a; end
code[a_, b$95$2_, c_] := N[(N[((-b$95$2) + N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\end{array}
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -2e+155)
(+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2)))
(if (<= b_2 1.2e-70)
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
(* (/ c b_2) -0.5))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2e+155) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 1.2e-70) {
tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-2d+155)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 1.2d-70) then
tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a
else
tmp = (c / b_2) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2e+155) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 1.2e-70) {
tmp = (Math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2e+155: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 1.2e-70: tmp = (math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a else: tmp = (c / b_2) * -0.5 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2e+155) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 1.2e-70) tmp = Float64(Float64(sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c))) - b_2) / a); else tmp = Float64(Float64(c / b_2) * -0.5); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -2e+155) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 1.2e-70) tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a; else tmp = (c / b_2) * -0.5; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2e+155], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 1.2e-70], N[(N[(N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b$95$2), $MachinePrecision] / a), $MachinePrecision], N[(N[(c / b$95$2), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2 \cdot 10^{+155}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 1.2 \cdot 10^{-70}:\\
\;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < -2.00000000000000001e155Initial program 33.5%
+-commutative33.5%
unsub-neg33.5%
Simplified33.5%
Taylor expanded in b_2 around -inf 97.9%
if -2.00000000000000001e155 < b_2 < 1.2000000000000001e-70Initial program 83.1%
+-commutative83.1%
unsub-neg83.1%
Simplified83.1%
if 1.2000000000000001e-70 < b_2 Initial program 17.5%
+-commutative17.5%
unsub-neg17.5%
Simplified17.5%
Taylor expanded in b_2 around inf 84.6%
Final simplification86.0%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.75e-42) (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))) (if (<= b_2 2.7e-68) (/ (- (sqrt (* a (- c))) b_2) a) (* (/ c b_2) -0.5))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.75e-42) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 2.7e-68) {
tmp = (sqrt((a * -c)) - b_2) / a;
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-2.75d-42)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 2.7d-68) then
tmp = (sqrt((a * -c)) - b_2) / a
else
tmp = (c / b_2) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.75e-42) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 2.7e-68) {
tmp = (Math.sqrt((a * -c)) - b_2) / a;
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.75e-42: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 2.7e-68: tmp = (math.sqrt((a * -c)) - b_2) / a else: tmp = (c / b_2) * -0.5 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.75e-42) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 2.7e-68) tmp = Float64(Float64(sqrt(Float64(a * Float64(-c))) - b_2) / a); else tmp = Float64(Float64(c / b_2) * -0.5); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -2.75e-42) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 2.7e-68) tmp = (sqrt((a * -c)) - b_2) / a; else tmp = (c / b_2) * -0.5; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.75e-42], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 2.7e-68], N[(N[(N[Sqrt[N[(a * (-c)), $MachinePrecision]], $MachinePrecision] - b$95$2), $MachinePrecision] / a), $MachinePrecision], N[(N[(c / b$95$2), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.75 \cdot 10^{-42}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 2.7 \cdot 10^{-68}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(-c\right)} - b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < -2.75e-42Initial program 65.5%
+-commutative65.5%
unsub-neg65.5%
Simplified65.5%
Taylor expanded in b_2 around -inf 90.8%
if -2.75e-42 < b_2 < 2.7000000000000002e-68Initial program 75.4%
+-commutative75.4%
unsub-neg75.4%
Simplified75.4%
Taylor expanded in b_2 around 0 69.3%
mul-1-neg69.3%
distribute-rgt-neg-out69.3%
Simplified69.3%
if 2.7000000000000002e-68 < b_2 Initial program 17.5%
+-commutative17.5%
unsub-neg17.5%
Simplified17.5%
Taylor expanded in b_2 around inf 84.6%
Final simplification82.1%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2e-310) (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))) (* (/ c b_2) -0.5)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2e-310) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-2d-310)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else
tmp = (c / b_2) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2e-310) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2e-310: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) else: tmp = (c / b_2) * -0.5 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2e-310) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); else tmp = Float64(Float64(c / b_2) * -0.5); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -2e-310) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); else tmp = (c / b_2) * -0.5; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2e-310], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b$95$2), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < -1.999999999999994e-310Initial program 70.2%
+-commutative70.2%
unsub-neg70.2%
Simplified70.2%
Taylor expanded in b_2 around -inf 71.4%
if -1.999999999999994e-310 < b_2 Initial program 33.3%
+-commutative33.3%
unsub-neg33.3%
Simplified33.3%
Taylor expanded in b_2 around inf 64.8%
Final simplification67.7%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 1.05e-308) (/ (- b_2) a) (* (/ c b_2) -0.5)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1.05e-308) {
tmp = -b_2 / a;
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= 1.05d-308) then
tmp = -b_2 / a
else
tmp = (c / b_2) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1.05e-308) {
tmp = -b_2 / a;
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= 1.05e-308: tmp = -b_2 / a else: tmp = (c / b_2) * -0.5 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= 1.05e-308) tmp = Float64(Float64(-b_2) / a); else tmp = Float64(Float64(c / b_2) * -0.5); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= 1.05e-308) tmp = -b_2 / a; else tmp = (c / b_2) * -0.5; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, 1.05e-308], N[((-b$95$2) / a), $MachinePrecision], N[(N[(c / b$95$2), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq 1.05 \cdot 10^{-308}:\\
\;\;\;\;\frac{-b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < 1.0499999999999998e-308Initial program 69.6%
+-commutative69.6%
unsub-neg69.6%
Simplified69.6%
Taylor expanded in b_2 around 0 40.3%
mul-1-neg40.3%
distribute-rgt-neg-out40.3%
Simplified40.3%
Taylor expanded in c around 0 26.9%
neg-mul-126.9%
distribute-neg-frac26.9%
Simplified26.9%
if 1.0499999999999998e-308 < b_2 Initial program 33.5%
+-commutative33.5%
unsub-neg33.5%
Simplified33.5%
Taylor expanded in b_2 around inf 65.3%
Final simplification48.3%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 1e-308) (/ -2.0 (/ a b_2)) (* (/ c b_2) -0.5)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1e-308) {
tmp = -2.0 / (a / b_2);
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= 1d-308) then
tmp = (-2.0d0) / (a / b_2)
else
tmp = (c / b_2) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1e-308) {
tmp = -2.0 / (a / b_2);
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= 1e-308: tmp = -2.0 / (a / b_2) else: tmp = (c / b_2) * -0.5 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= 1e-308) tmp = Float64(-2.0 / Float64(a / b_2)); else tmp = Float64(Float64(c / b_2) * -0.5); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= 1e-308) tmp = -2.0 / (a / b_2); else tmp = (c / b_2) * -0.5; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, 1e-308], N[(-2.0 / N[(a / b$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(c / b$95$2), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq 10^{-308}:\\
\;\;\;\;\frac{-2}{\frac{a}{b_2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < 9.9999999999999991e-309Initial program 69.6%
+-commutative69.6%
unsub-neg69.6%
Simplified69.6%
add-cube-cbrt68.6%
pow368.6%
sub-neg68.6%
add-sqr-sqrt55.7%
hypot-def65.5%
*-commutative65.5%
distribute-rgt-neg-in65.5%
Applied egg-rr65.5%
Taylor expanded in b_2 around -inf 70.3%
associate-*r/70.3%
associate-/l*70.0%
Simplified70.0%
if 9.9999999999999991e-309 < b_2 Initial program 33.5%
+-commutative33.5%
unsub-neg33.5%
Simplified33.5%
Taylor expanded in b_2 around inf 65.3%
Final simplification67.3%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 1e-308) (/ (* b_2 -2.0) a) (* (/ c b_2) -0.5)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1e-308) {
tmp = (b_2 * -2.0) / a;
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= 1d-308) then
tmp = (b_2 * (-2.0d0)) / a
else
tmp = (c / b_2) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1e-308) {
tmp = (b_2 * -2.0) / a;
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= 1e-308: tmp = (b_2 * -2.0) / a else: tmp = (c / b_2) * -0.5 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= 1e-308) tmp = Float64(Float64(b_2 * -2.0) / a); else tmp = Float64(Float64(c / b_2) * -0.5); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= 1e-308) tmp = (b_2 * -2.0) / a; else tmp = (c / b_2) * -0.5; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, 1e-308], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision], N[(N[(c / b$95$2), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq 10^{-308}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < 9.9999999999999991e-309Initial program 69.6%
+-commutative69.6%
unsub-neg69.6%
Simplified69.6%
Taylor expanded in b_2 around -inf 70.3%
*-commutative70.3%
Simplified70.3%
if 9.9999999999999991e-309 < b_2 Initial program 33.5%
+-commutative33.5%
unsub-neg33.5%
Simplified33.5%
Taylor expanded in b_2 around inf 65.3%
Final simplification67.5%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.35e-288) (/ (- b_2) a) (/ 0.0 a)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.35e-288) {
tmp = -b_2 / a;
} else {
tmp = 0.0 / a;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-2.35d-288)) then
tmp = -b_2 / a
else
tmp = 0.0d0 / a
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.35e-288) {
tmp = -b_2 / a;
} else {
tmp = 0.0 / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.35e-288: tmp = -b_2 / a else: tmp = 0.0 / a return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.35e-288) tmp = Float64(Float64(-b_2) / a); else tmp = Float64(0.0 / a); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -2.35e-288) tmp = -b_2 / a; else tmp = 0.0 / a; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.35e-288], N[((-b$95$2) / a), $MachinePrecision], N[(0.0 / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.35 \cdot 10^{-288}:\\
\;\;\;\;\frac{-b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{a}\\
\end{array}
\end{array}
if b_2 < -2.3499999999999999e-288Initial program 70.8%
+-commutative70.8%
unsub-neg70.8%
Simplified70.8%
Taylor expanded in b_2 around 0 41.0%
mul-1-neg41.0%
distribute-rgt-neg-out41.0%
Simplified41.0%
Taylor expanded in c around 0 27.3%
neg-mul-127.3%
distribute-neg-frac27.3%
Simplified27.3%
if -2.3499999999999999e-288 < b_2 Initial program 33.1%
+-commutative33.1%
unsub-neg33.1%
Simplified33.1%
add-sqr-sqrt30.3%
fma-neg29.4%
pow1/229.4%
sqrt-pow129.5%
fma-neg29.5%
*-commutative29.5%
distribute-rgt-neg-in29.5%
metadata-eval29.5%
pow1/229.5%
sqrt-pow129.4%
fma-neg29.4%
*-commutative29.4%
distribute-rgt-neg-in29.4%
metadata-eval29.4%
Applied egg-rr29.4%
Taylor expanded in b_2 around inf 21.0%
distribute-lft1-in21.0%
metadata-eval21.0%
mul0-lft21.0%
Simplified21.0%
Final simplification23.7%
(FPCore (a b_2 c) :precision binary64 (/ 0.0 a))
double code(double a, double b_2, double c) {
return 0.0 / a;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
code = 0.0d0 / a
end function
public static double code(double a, double b_2, double c) {
return 0.0 / a;
}
def code(a, b_2, c): return 0.0 / a
function code(a, b_2, c) return Float64(0.0 / a) end
function tmp = code(a, b_2, c) tmp = 0.0 / a; end
code[a_, b$95$2_, c_] := N[(0.0 / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{0}{a}
\end{array}
Initial program 49.4%
+-commutative49.4%
unsub-neg49.4%
Simplified49.4%
add-sqr-sqrt47.8%
fma-neg47.3%
pow1/247.3%
sqrt-pow147.4%
fma-neg47.4%
*-commutative47.4%
distribute-rgt-neg-in47.4%
metadata-eval47.4%
pow1/247.4%
sqrt-pow147.3%
fma-neg47.4%
*-commutative47.4%
distribute-rgt-neg-in47.4%
metadata-eval47.4%
Applied egg-rr47.4%
Taylor expanded in b_2 around inf 13.0%
distribute-lft1-in13.0%
metadata-eval13.0%
mul0-lft13.0%
Simplified13.0%
Final simplification13.0%
herbie shell --seed 2023261
(FPCore (a b_2 c)
:name "quad2p (problem 3.2.1, positive)"
:precision binary64
(/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))