
(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 -2.3e+128)
(+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2)))
(if (<= b_2 7400000000000.0)
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
(/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.3e+128) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 7400000000000.0) {
tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
} else {
tmp = (c * -0.5) / 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 <= (-2.3d+128)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 7400000000000.0d0) then
tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.3e+128) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 7400000000000.0) {
tmp = (Math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.3e+128: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 7400000000000.0: tmp = (math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.3e+128) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 7400000000000.0) tmp = Float64(Float64(sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c))) - b_2) / a); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -2.3e+128) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 7400000000000.0) tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a; else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.3e+128], 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, 7400000000000.0], 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 * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.3 \cdot 10^{+128}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 7400000000000:\\
\;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < -2.29999999999999998e128Initial program 38.3%
+-commutative38.3%
unsub-neg38.3%
Simplified38.3%
Taylor expanded in b_2 around -inf 93.4%
if -2.29999999999999998e128 < b_2 < 7.4e12Initial program 84.4%
+-commutative84.4%
unsub-neg84.4%
Simplified84.4%
if 7.4e12 < b_2 Initial program 10.0%
+-commutative10.0%
unsub-neg10.0%
Simplified10.0%
add-sqr-sqrt8.7%
pow28.7%
pow1/28.7%
sqrt-pow18.7%
fma-neg8.7%
*-commutative8.7%
distribute-rgt-neg-in8.7%
metadata-eval8.7%
Applied egg-rr8.7%
Taylor expanded in c around 0 96.2%
associate-*r/96.3%
Simplified96.3%
Final simplification89.4%
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -2.6e-91)
(+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2)))
(if (<= b_2 1000000000000.0)
(/ (- (sqrt (* a (- c))) b_2) a)
(/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.6e-91) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 1000000000000.0) {
tmp = (sqrt((a * -c)) - b_2) / a;
} else {
tmp = (c * -0.5) / 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 <= (-2.6d-91)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 1000000000000.0d0) then
tmp = (sqrt((a * -c)) - b_2) / a
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.6e-91) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 1000000000000.0) {
tmp = (Math.sqrt((a * -c)) - b_2) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.6e-91: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 1000000000000.0: tmp = (math.sqrt((a * -c)) - b_2) / a else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.6e-91) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 1000000000000.0) tmp = Float64(Float64(sqrt(Float64(a * Float64(-c))) - b_2) / a); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -2.6e-91) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 1000000000000.0) tmp = (sqrt((a * -c)) - b_2) / a; else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.6e-91], 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, 1000000000000.0], N[(N[(N[Sqrt[N[(a * (-c)), $MachinePrecision]], $MachinePrecision] - b$95$2), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.6 \cdot 10^{-91}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 1000000000000:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(-c\right)} - b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < -2.60000000000000014e-91Initial program 66.5%
+-commutative66.5%
unsub-neg66.5%
Simplified66.5%
Taylor expanded in b_2 around -inf 86.2%
if -2.60000000000000014e-91 < b_2 < 1e12Initial program 80.0%
+-commutative80.0%
unsub-neg80.0%
Simplified80.0%
Taylor expanded in b_2 around 0 77.3%
mul-1-neg77.3%
distribute-rgt-neg-out77.3%
Simplified77.3%
if 1e12 < b_2 Initial program 10.0%
+-commutative10.0%
unsub-neg10.0%
Simplified10.0%
add-sqr-sqrt8.7%
pow28.7%
pow1/28.7%
sqrt-pow18.7%
fma-neg8.7%
*-commutative8.7%
distribute-rgt-neg-in8.7%
metadata-eval8.7%
Applied egg-rr8.7%
Taylor expanded in c around 0 96.2%
associate-*r/96.3%
Simplified96.3%
Final simplification86.0%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -5e-310) (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))) (/ (* c -0.5) b_2)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else {
tmp = (c * -0.5) / 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 <= (-5d-310)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -5e-310: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -5e-310) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -5e-310) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -5e-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 * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < -4.999999999999985e-310Initial program 73.4%
+-commutative73.4%
unsub-neg73.4%
Simplified73.4%
Taylor expanded in b_2 around -inf 60.7%
if -4.999999999999985e-310 < b_2 Initial program 33.6%
+-commutative33.6%
unsub-neg33.6%
Simplified33.6%
add-sqr-sqrt32.7%
pow232.7%
pow1/232.7%
sqrt-pow132.7%
fma-neg32.7%
*-commutative32.7%
distribute-rgt-neg-in32.7%
metadata-eval32.7%
Applied egg-rr32.7%
Taylor expanded in c around 0 68.3%
associate-*r/68.3%
Simplified68.3%
Final simplification64.3%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.3e-279) (* -2.0 (/ b_2 a)) (/ 0.0 a)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.3e-279) {
tmp = -2.0 * (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.3d-279)) then
tmp = (-2.0d0) * (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.3e-279) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = 0.0 / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.3e-279: tmp = -2.0 * (b_2 / a) else: tmp = 0.0 / a return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.3e-279) tmp = Float64(-2.0 * 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.3e-279) tmp = -2.0 * (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.3e-279], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], N[(0.0 / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.3 \cdot 10^{-279}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{a}\\
\end{array}
\end{array}
if b_2 < -2.29999999999999995e-279Initial program 72.7%
+-commutative72.7%
unsub-neg72.7%
Simplified72.7%
Taylor expanded in b_2 around -inf 61.7%
if -2.29999999999999995e-279 < b_2 Initial program 35.2%
+-commutative35.2%
unsub-neg35.2%
Simplified35.2%
add-sqr-sqrt34.3%
pow234.3%
pow1/234.3%
sqrt-pow134.3%
fma-neg34.3%
*-commutative34.3%
distribute-rgt-neg-in34.3%
metadata-eval34.3%
Applied egg-rr34.3%
Taylor expanded in b_2 around inf 22.3%
distribute-lft1-in22.3%
metadata-eval22.3%
mul0-lft22.3%
Simplified22.3%
Final simplification42.6%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -5e-310) (* -2.0 (/ b_2 a)) (* (/ c b_2) -0.5)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = -2.0 * (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 <= (-5d-310)) then
tmp = (-2.0d0) * (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 <= -5e-310) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -5e-310: tmp = -2.0 * (b_2 / a) else: tmp = (c / b_2) * -0.5 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -5e-310) tmp = Float64(-2.0 * 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 <= -5e-310) tmp = -2.0 * (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, -5e-310], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b$95$2), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < -4.999999999999985e-310Initial program 73.4%
+-commutative73.4%
unsub-neg73.4%
Simplified73.4%
Taylor expanded in b_2 around -inf 60.4%
if -4.999999999999985e-310 < b_2 Initial program 33.6%
+-commutative33.6%
unsub-neg33.6%
Simplified33.6%
Taylor expanded in b_2 around inf 68.3%
Final simplification64.1%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 4e-309) (* -2.0 (/ b_2 a)) (/ (* c -0.5) b_2)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 4e-309) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = (c * -0.5) / 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-309) then
tmp = (-2.0d0) * (b_2 / a)
else
tmp = (c * (-0.5d0)) / 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-309) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= 4e-309: tmp = -2.0 * (b_2 / a) else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= 4e-309) tmp = Float64(-2.0 * Float64(b_2 / a)); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= 4e-309) tmp = -2.0 * (b_2 / a); else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, 4e-309], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq 4 \cdot 10^{-309}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\
\end{array}
\end{array}
if b_2 < 3.9999999999999977e-309Initial program 73.4%
+-commutative73.4%
unsub-neg73.4%
Simplified73.4%
Taylor expanded in b_2 around -inf 60.4%
if 3.9999999999999977e-309 < b_2 Initial program 33.6%
+-commutative33.6%
unsub-neg33.6%
Simplified33.6%
add-sqr-sqrt32.7%
pow232.7%
pow1/232.7%
sqrt-pow132.7%
fma-neg32.7%
*-commutative32.7%
distribute-rgt-neg-in32.7%
metadata-eval32.7%
Applied egg-rr32.7%
Taylor expanded in c around 0 68.3%
associate-*r/68.3%
Simplified68.3%
Final simplification64.1%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.3e-279) (/ (- b_2) a) (/ 0.0 a)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.3e-279) {
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.3d-279)) 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.3e-279) {
tmp = -b_2 / a;
} else {
tmp = 0.0 / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.3e-279: tmp = -b_2 / a else: tmp = 0.0 / a return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.3e-279) 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.3e-279) 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.3e-279], N[((-b$95$2) / a), $MachinePrecision], N[(0.0 / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.3 \cdot 10^{-279}:\\
\;\;\;\;\frac{-b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{a}\\
\end{array}
\end{array}
if b_2 < -2.29999999999999995e-279Initial program 72.7%
+-commutative72.7%
unsub-neg72.7%
Simplified72.7%
add-sqr-sqrt72.5%
pow272.5%
pow1/272.5%
sqrt-pow172.6%
fma-neg72.6%
*-commutative72.6%
distribute-rgt-neg-in72.6%
metadata-eval72.6%
Applied egg-rr72.6%
Taylor expanded in b_2 around inf 20.2%
neg-mul-120.2%
Simplified20.2%
if -2.29999999999999995e-279 < b_2 Initial program 35.2%
+-commutative35.2%
unsub-neg35.2%
Simplified35.2%
add-sqr-sqrt34.3%
pow234.3%
pow1/234.3%
sqrt-pow134.3%
fma-neg34.3%
*-commutative34.3%
distribute-rgt-neg-in34.3%
metadata-eval34.3%
Applied egg-rr34.3%
Taylor expanded in b_2 around inf 22.3%
distribute-lft1-in22.3%
metadata-eval22.3%
mul0-lft22.3%
Simplified22.3%
Final simplification21.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 54.6%
+-commutative54.6%
unsub-neg54.6%
Simplified54.6%
add-sqr-sqrt54.0%
pow254.0%
pow1/254.0%
sqrt-pow154.0%
fma-neg54.1%
*-commutative54.1%
distribute-rgt-neg-in54.1%
metadata-eval54.1%
Applied egg-rr54.1%
Taylor expanded in b_2 around inf 12.3%
distribute-lft1-in12.3%
metadata-eval12.3%
mul0-lft12.3%
Simplified12.3%
Final simplification12.3%
herbie shell --seed 2023215
(FPCore (a b_2 c)
:name "quad2p (problem 3.2.1, positive)"
:precision binary64
(/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))