
(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 -3e-57)
(/ (* -0.5 c) b_2)
(if (<= b_2 1e+69)
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* c a)))) a)
(+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -3e-57) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 1e+69) {
tmp = (-b_2 - sqrt(((b_2 * b_2) - (c * a)))) / a;
} else {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
}
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 <= (-3d-57)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= 1d+69) then
tmp = (-b_2 - sqrt(((b_2 * b_2) - (c * a)))) / a
else
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -3e-57) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 1e+69) {
tmp = (-b_2 - Math.sqrt(((b_2 * b_2) - (c * a)))) / a;
} else {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -3e-57: tmp = (-0.5 * c) / b_2 elif b_2 <= 1e+69: tmp = (-b_2 - math.sqrt(((b_2 * b_2) - (c * a)))) / a else: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -3e-57) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= 1e+69) tmp = Float64(Float64(Float64(-b_2) - sqrt(Float64(Float64(b_2 * b_2) - Float64(c * a)))) / a); else tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -3e-57) tmp = (-0.5 * c) / b_2; elseif (b_2 <= 1e+69) tmp = (-b_2 - sqrt(((b_2 * b_2) - (c * a)))) / a; else tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -3e-57], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 1e+69], N[(N[((-b$95$2) - N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(c * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -3 \cdot 10^{-57}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{elif}\;b_2 \leq 10^{+69}:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\end{array}
\end{array}
if b_2 < -3.00000000000000001e-57Initial program 15.8%
Taylor expanded in b_2 around -inf 89.3%
associate-*r/89.3%
Simplified89.3%
if -3.00000000000000001e-57 < b_2 < 1.0000000000000001e69Initial program 76.7%
if 1.0000000000000001e69 < b_2 Initial program 57.5%
Taylor expanded in b_2 around inf 98.2%
Final simplification86.1%
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -2.8e-57)
(/ (* -0.5 c) b_2)
(if (<= b_2 3.7e-126)
(/ (- (- b_2) (sqrt (* c (- a)))) a)
(/ (* b_2 -2.0) a))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.8e-57) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 3.7e-126) {
tmp = (-b_2 - sqrt((c * -a))) / a;
} else {
tmp = (b_2 * -2.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.8d-57)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= 3.7d-126) then
tmp = (-b_2 - sqrt((c * -a))) / a
else
tmp = (b_2 * (-2.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.8e-57) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 3.7e-126) {
tmp = (-b_2 - Math.sqrt((c * -a))) / a;
} else {
tmp = (b_2 * -2.0) / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.8e-57: tmp = (-0.5 * c) / b_2 elif b_2 <= 3.7e-126: tmp = (-b_2 - math.sqrt((c * -a))) / a else: tmp = (b_2 * -2.0) / a return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.8e-57) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= 3.7e-126) tmp = Float64(Float64(Float64(-b_2) - sqrt(Float64(c * Float64(-a)))) / a); else tmp = Float64(Float64(b_2 * -2.0) / a); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -2.8e-57) tmp = (-0.5 * c) / b_2; elseif (b_2 <= 3.7e-126) tmp = (-b_2 - sqrt((c * -a))) / a; else tmp = (b_2 * -2.0) / a; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.8e-57], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 3.7e-126], N[(N[((-b$95$2) - N[Sqrt[N[(c * (-a)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-57}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{elif}\;b_2 \leq 3.7 \cdot 10^{-126}:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{c \cdot \left(-a\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\
\end{array}
\end{array}
if b_2 < -2.7999999999999999e-57Initial program 15.8%
Taylor expanded in b_2 around -inf 89.3%
associate-*r/89.3%
Simplified89.3%
if -2.7999999999999999e-57 < b_2 < 3.6999999999999999e-126Initial program 71.3%
Taylor expanded in b_2 around 0 69.4%
mul-1-neg69.4%
distribute-rgt-neg-out69.4%
Simplified69.4%
if 3.6999999999999999e-126 < b_2 Initial program 69.3%
Taylor expanded in b_2 around inf 87.0%
*-commutative87.0%
Simplified87.0%
Final simplification83.1%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.4e-57) (/ (* -0.5 c) b_2) (if (<= b_2 2.45e-126) (/ (- (sqrt (* c (- a)))) a) (/ (* b_2 -2.0) a))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.4e-57) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 2.45e-126) {
tmp = -sqrt((c * -a)) / a;
} else {
tmp = (b_2 * -2.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.4d-57)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= 2.45d-126) then
tmp = -sqrt((c * -a)) / a
else
tmp = (b_2 * (-2.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.4e-57) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 2.45e-126) {
tmp = -Math.sqrt((c * -a)) / a;
} else {
tmp = (b_2 * -2.0) / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.4e-57: tmp = (-0.5 * c) / b_2 elif b_2 <= 2.45e-126: tmp = -math.sqrt((c * -a)) / a else: tmp = (b_2 * -2.0) / a return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.4e-57) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= 2.45e-126) tmp = Float64(Float64(-sqrt(Float64(c * Float64(-a)))) / a); else tmp = Float64(Float64(b_2 * -2.0) / a); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -2.4e-57) tmp = (-0.5 * c) / b_2; elseif (b_2 <= 2.45e-126) tmp = -sqrt((c * -a)) / a; else tmp = (b_2 * -2.0) / a; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.4e-57], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 2.45e-126], N[((-N[Sqrt[N[(c * (-a)), $MachinePrecision]], $MachinePrecision]) / a), $MachinePrecision], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.4 \cdot 10^{-57}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{elif}\;b_2 \leq 2.45 \cdot 10^{-126}:\\
\;\;\;\;\frac{-\sqrt{c \cdot \left(-a\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\
\end{array}
\end{array}
if b_2 < -2.40000000000000006e-57Initial program 15.8%
Taylor expanded in b_2 around -inf 89.3%
associate-*r/89.3%
Simplified89.3%
if -2.40000000000000006e-57 < b_2 < 2.45000000000000005e-126Initial program 71.3%
pow1/271.3%
pow-to-exp67.5%
Applied egg-rr67.5%
Taylor expanded in c around -inf 36.2%
mul-1-neg36.2%
unsub-neg36.2%
neg-mul-136.2%
remove-double-neg36.2%
Simplified36.2%
Taylor expanded in b_2 around 0 35.7%
Taylor expanded in a around 0 35.7%
associate-*r/35.7%
Simplified68.8%
if 2.45000000000000005e-126 < b_2 Initial program 69.3%
Taylor expanded in b_2 around inf 87.0%
*-commutative87.0%
Simplified87.0%
Final simplification82.9%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -4e-310) (/ (* -0.5 c) b_2) (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2)))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -4e-310) {
tmp = (-0.5 * c) / b_2;
} else {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
}
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 <= (-4d-310)) then
tmp = ((-0.5d0) * c) / b_2
else
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -4e-310) {
tmp = (-0.5 * c) / b_2;
} else {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -4e-310: tmp = (-0.5 * c) / b_2 else: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -4e-310) tmp = Float64(Float64(-0.5 * c) / b_2); else tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -4e-310) tmp = (-0.5 * c) / b_2; else tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -4e-310], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\end{array}
\end{array}
if b_2 < -3.999999999999988e-310Initial program 26.5%
Taylor expanded in b_2 around -inf 73.2%
associate-*r/73.2%
Simplified73.2%
if -3.999999999999988e-310 < b_2 Initial program 73.3%
Taylor expanded in b_2 around inf 62.4%
Final simplification68.3%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -4e-310) (/ (* -0.5 c) b_2) (/ (- b_2) a)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -4e-310) {
tmp = (-0.5 * c) / b_2;
} else {
tmp = -b_2 / 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 <= (-4d-310)) then
tmp = ((-0.5d0) * c) / b_2
else
tmp = -b_2 / a
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -4e-310) {
tmp = (-0.5 * c) / b_2;
} else {
tmp = -b_2 / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -4e-310: tmp = (-0.5 * c) / b_2 else: tmp = -b_2 / a return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -4e-310) tmp = Float64(Float64(-0.5 * c) / b_2); else tmp = Float64(Float64(-b_2) / a); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -4e-310) tmp = (-0.5 * c) / b_2; else tmp = -b_2 / a; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -4e-310], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], N[((-b$95$2) / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-b_2}{a}\\
\end{array}
\end{array}
if b_2 < -3.999999999999988e-310Initial program 26.5%
Taylor expanded in b_2 around -inf 73.2%
associate-*r/73.2%
Simplified73.2%
if -3.999999999999988e-310 < b_2 Initial program 73.3%
add-sqr-sqrt73.1%
pow273.1%
pow1/273.1%
sqrt-pow173.1%
metadata-eval73.1%
Applied egg-rr73.1%
Taylor expanded in b_2 around inf 26.7%
mul-1-neg26.7%
Simplified26.7%
Final simplification52.1%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -4e-310) (/ (* -0.5 c) b_2) (/ (* b_2 -2.0) a)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -4e-310) {
tmp = (-0.5 * c) / b_2;
} else {
tmp = (b_2 * -2.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 <= (-4d-310)) then
tmp = ((-0.5d0) * c) / b_2
else
tmp = (b_2 * (-2.0d0)) / a
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -4e-310) {
tmp = (-0.5 * c) / b_2;
} else {
tmp = (b_2 * -2.0) / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -4e-310: tmp = (-0.5 * c) / b_2 else: tmp = (b_2 * -2.0) / a return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -4e-310) tmp = Float64(Float64(-0.5 * c) / b_2); else tmp = Float64(Float64(b_2 * -2.0) / a); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -4e-310) tmp = (-0.5 * c) / b_2; else tmp = (b_2 * -2.0) / a; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -4e-310], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\
\end{array}
\end{array}
if b_2 < -3.999999999999988e-310Initial program 26.5%
Taylor expanded in b_2 around -inf 73.2%
associate-*r/73.2%
Simplified73.2%
if -3.999999999999988e-310 < b_2 Initial program 73.3%
Taylor expanded in b_2 around inf 62.4%
*-commutative62.4%
Simplified62.4%
Final simplification68.3%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -3.2e-226) (/ 0.0 a) (/ (- b_2) a)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -3.2e-226) {
tmp = 0.0 / a;
} else {
tmp = -b_2 / 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 <= (-3.2d-226)) then
tmp = 0.0d0 / a
else
tmp = -b_2 / a
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -3.2e-226) {
tmp = 0.0 / a;
} else {
tmp = -b_2 / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -3.2e-226: tmp = 0.0 / a else: tmp = -b_2 / a return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -3.2e-226) tmp = Float64(0.0 / a); else tmp = Float64(Float64(-b_2) / a); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -3.2e-226) tmp = 0.0 / a; else tmp = -b_2 / a; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -3.2e-226], N[(0.0 / a), $MachinePrecision], N[((-b$95$2) / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -3.2 \cdot 10^{-226}:\\
\;\;\;\;\frac{0}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-b_2}{a}\\
\end{array}
\end{array}
if b_2 < -3.19999999999999982e-226Initial program 25.7%
add-sqr-sqrt23.1%
pow223.1%
pow1/223.1%
sqrt-pow123.2%
metadata-eval23.2%
Applied egg-rr23.2%
Taylor expanded in b_2 around -inf 19.3%
distribute-lft1-in19.3%
metadata-eval19.3%
mul0-lft19.3%
Simplified19.3%
if -3.19999999999999982e-226 < b_2 Initial program 71.1%
add-sqr-sqrt70.9%
pow270.9%
pow1/270.9%
sqrt-pow170.9%
metadata-eval70.9%
Applied egg-rr70.9%
Taylor expanded in b_2 around inf 25.2%
mul-1-neg25.2%
Simplified25.2%
Final simplification22.2%
(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 47.7%
add-sqr-sqrt46.3%
pow246.3%
pow1/246.3%
sqrt-pow146.3%
metadata-eval46.3%
Applied egg-rr46.3%
Taylor expanded in b_2 around -inf 11.3%
distribute-lft1-in11.3%
metadata-eval11.3%
mul0-lft11.3%
Simplified11.3%
Final simplification11.3%
herbie shell --seed 2023242
(FPCore (a b_2 c)
:name "quad2m (problem 3.2.1, negative)"
:precision binary64
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))