
(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 -3.4e+129)
(+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2)))
(if (<= b_2 6.2e-33)
(/ (- (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 <= -3.4e+129) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 6.2e-33) {
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 <= (-3.4d+129)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 6.2d-33) 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 <= -3.4e+129) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 6.2e-33) {
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 <= -3.4e+129: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 6.2e-33: 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 <= -3.4e+129) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 6.2e-33) 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 <= -3.4e+129) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 6.2e-33) 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, -3.4e+129], 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, 6.2e-33], 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 -3.4 \cdot 10^{+129}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 6.2 \cdot 10^{-33}:\\
\;\;\;\;\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 < -3.40000000000000018e129Initial program 44.9%
+-commutative44.9%
unsub-neg44.9%
Simplified44.9%
Taylor expanded in b_2 around -inf 95.8%
if -3.40000000000000018e129 < b_2 < 6.19999999999999994e-33Initial program 77.4%
+-commutative77.4%
unsub-neg77.4%
Simplified77.4%
if 6.19999999999999994e-33 < b_2 Initial program 17.6%
+-commutative17.6%
unsub-neg17.6%
Simplified17.6%
Taylor expanded in b_2 around inf 91.2%
Final simplification85.1%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -9.5e-74) (- (- (* (/ c b_2) (- -0.5)) (/ b_2 a)) (/ b_2 a)) (if (<= b_2 1.04e-76) (/ (- (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 <= -9.5e-74) {
tmp = (((c / b_2) * -(-0.5)) - (b_2 / a)) - (b_2 / a);
} else if (b_2 <= 1.04e-76) {
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 <= (-9.5d-74)) then
tmp = (((c / b_2) * -(-0.5d0)) - (b_2 / a)) - (b_2 / a)
else if (b_2 <= 1.04d-76) 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 <= -9.5e-74) {
tmp = (((c / b_2) * -(-0.5)) - (b_2 / a)) - (b_2 / a);
} else if (b_2 <= 1.04e-76) {
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 <= -9.5e-74: tmp = (((c / b_2) * -(-0.5)) - (b_2 / a)) - (b_2 / a) elif b_2 <= 1.04e-76: 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 <= -9.5e-74) tmp = Float64(Float64(Float64(Float64(c / b_2) * Float64(-(-0.5))) - Float64(b_2 / a)) - Float64(b_2 / a)); elseif (b_2 <= 1.04e-76) 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 <= -9.5e-74) tmp = (((c / b_2) * -(-0.5)) - (b_2 / a)) - (b_2 / a); elseif (b_2 <= 1.04e-76) 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, -9.5e-74], N[(N[(N[(N[(c / b$95$2), $MachinePrecision] * (--0.5)), $MachinePrecision] - N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] - N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 1.04e-76], 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 -9.5 \cdot 10^{-74}:\\
\;\;\;\;\left(\frac{c}{b_2} \cdot \left(--0.5\right) - \frac{b_2}{a}\right) - \frac{b_2}{a}\\
\mathbf{elif}\;b_2 \leq 1.04 \cdot 10^{-76}:\\
\;\;\;\;\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 < -9.5000000000000007e-74Initial program 70.0%
+-commutative70.0%
unsub-neg70.0%
Simplified70.0%
div-sub70.0%
sub-neg70.0%
add-sqr-sqrt45.1%
hypot-def50.8%
*-commutative50.8%
distribute-rgt-neg-in50.8%
Applied egg-rr50.8%
Taylor expanded in b_2 around -inf 0.0%
neg-mul-10.0%
unsub-neg0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt86.1%
mul-1-neg86.1%
Simplified86.1%
if -9.5000000000000007e-74 < b_2 < 1.04e-76Initial program 69.0%
+-commutative69.0%
unsub-neg69.0%
Simplified69.0%
Taylor expanded in b_2 around 0 65.2%
mul-1-neg65.2%
distribute-rgt-neg-out65.2%
Simplified65.2%
if 1.04e-76 < b_2 Initial program 19.9%
+-commutative19.9%
unsub-neg19.9%
Simplified19.9%
Taylor expanded in b_2 around inf 87.8%
Final simplification81.1%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2e-310) (- (- (* (/ c b_2) (- -0.5)) (/ b_2 a)) (/ b_2 a)) (* (/ c b_2) -0.5)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2e-310) {
tmp = (((c / b_2) * -(-0.5)) - (b_2 / a)) - (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-310)) then
tmp = (((c / b_2) * -(-0.5d0)) - (b_2 / a)) - (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-310) {
tmp = (((c / b_2) * -(-0.5)) - (b_2 / a)) - (b_2 / a);
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2e-310: tmp = (((c / b_2) * -(-0.5)) - (b_2 / a)) - (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-310) tmp = Float64(Float64(Float64(Float64(c / b_2) * Float64(-(-0.5))) - Float64(b_2 / a)) - 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 <= -2e-310) tmp = (((c / b_2) * -(-0.5)) - (b_2 / a)) - (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-310], N[(N[(N[(N[(c / b$95$2), $MachinePrecision] * (--0.5)), $MachinePrecision] - N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] - 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 -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{c}{b_2} \cdot \left(--0.5\right) - \frac{b_2}{a}\right) - \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < -1.999999999999994e-310Initial program 69.1%
+-commutative69.1%
unsub-neg69.1%
Simplified69.1%
div-sub69.1%
sub-neg69.1%
add-sqr-sqrt50.2%
hypot-def54.9%
*-commutative54.9%
distribute-rgt-neg-in54.9%
Applied egg-rr54.9%
Taylor expanded in b_2 around -inf 0.0%
neg-mul-10.0%
unsub-neg0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt69.0%
mul-1-neg69.0%
Simplified69.0%
if -1.999999999999994e-310 < b_2 Initial program 34.9%
+-commutative34.9%
unsub-neg34.9%
Simplified34.9%
Taylor expanded in b_2 around inf 68.7%
Final simplification68.8%
(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 69.1%
+-commutative69.1%
unsub-neg69.1%
Simplified69.1%
Taylor expanded in b_2 around -inf 69.0%
if -1.999999999999994e-310 < b_2 Initial program 34.9%
+-commutative34.9%
unsub-neg34.9%
Simplified34.9%
Taylor expanded in b_2 around inf 68.7%
Final simplification68.8%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 1.46e-291) (* -2.0 (/ b_2 a)) 0.0))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1.46e-291) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = 0.0;
}
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.46d-291) then
tmp = (-2.0d0) * (b_2 / a)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1.46e-291) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= 1.46e-291: tmp = -2.0 * (b_2 / a) else: tmp = 0.0 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= 1.46e-291) tmp = Float64(-2.0 * Float64(b_2 / a)); else tmp = 0.0; end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= 1.46e-291) tmp = -2.0 * (b_2 / a); else tmp = 0.0; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, 1.46e-291], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq 1.46 \cdot 10^{-291}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b_2 < 1.4599999999999999e-291Initial program 68.9%
+-commutative68.9%
unsub-neg68.9%
Simplified68.9%
Taylor expanded in b_2 around -inf 67.7%
if 1.4599999999999999e-291 < b_2 Initial program 34.6%
+-commutative34.6%
unsub-neg34.6%
Simplified34.6%
div-sub33.6%
add-sqr-sqrt30.1%
*-un-lft-identity30.1%
times-frac30.9%
fma-neg27.4%
Applied egg-rr27.5%
Taylor expanded in b_2 around inf 17.4%
distribute-rgt1-in17.4%
metadata-eval17.4%
mul0-lft21.2%
Simplified21.2%
Final simplification45.2%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 1.46e-291) (* -2.0 (/ b_2 a)) (* (/ c b_2) -0.5)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1.46e-291) {
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 <= 1.46d-291) 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 <= 1.46e-291) {
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 <= 1.46e-291: 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 <= 1.46e-291) 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 <= 1.46e-291) 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, 1.46e-291], 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 1.46 \cdot 10^{-291}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < 1.4599999999999999e-291Initial program 68.9%
+-commutative68.9%
unsub-neg68.9%
Simplified68.9%
Taylor expanded in b_2 around -inf 67.7%
if 1.4599999999999999e-291 < b_2 Initial program 34.6%
+-commutative34.6%
unsub-neg34.6%
Simplified34.6%
Taylor expanded in b_2 around inf 69.8%
Final simplification68.7%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 1.46e-291) (- (/ b_2 a)) 0.0))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1.46e-291) {
tmp = -(b_2 / a);
} else {
tmp = 0.0;
}
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.46d-291) then
tmp = -(b_2 / a)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 1.46e-291) {
tmp = -(b_2 / a);
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= 1.46e-291: tmp = -(b_2 / a) else: tmp = 0.0 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= 1.46e-291) tmp = Float64(-Float64(b_2 / a)); else tmp = 0.0; end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= 1.46e-291) tmp = -(b_2 / a); else tmp = 0.0; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, 1.46e-291], (-N[(b$95$2 / a), $MachinePrecision]), 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq 1.46 \cdot 10^{-291}:\\
\;\;\;\;-\frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b_2 < 1.4599999999999999e-291Initial program 68.9%
+-commutative68.9%
unsub-neg68.9%
Simplified68.9%
add-sqr-sqrt68.7%
pow268.7%
pow1/268.7%
sqrt-pow168.7%
fma-neg68.8%
*-commutative68.8%
distribute-rgt-neg-in68.8%
metadata-eval68.8%
Applied egg-rr68.8%
Taylor expanded in b_2 around inf 26.0%
neg-mul-126.0%
Simplified26.0%
if 1.4599999999999999e-291 < b_2 Initial program 34.6%
+-commutative34.6%
unsub-neg34.6%
Simplified34.6%
div-sub33.6%
add-sqr-sqrt30.1%
*-un-lft-identity30.1%
times-frac30.9%
fma-neg27.4%
Applied egg-rr27.5%
Taylor expanded in b_2 around inf 17.4%
distribute-rgt1-in17.4%
metadata-eval17.4%
mul0-lft21.2%
Simplified21.2%
Final simplification23.7%
(FPCore (a b_2 c) :precision binary64 0.0)
double code(double a, double b_2, double c) {
return 0.0;
}
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
end function
public static double code(double a, double b_2, double c) {
return 0.0;
}
def code(a, b_2, c): return 0.0
function code(a, b_2, c) return 0.0 end
function tmp = code(a, b_2, c) tmp = 0.0; end
code[a_, b$95$2_, c_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 52.3%
+-commutative52.3%
unsub-neg52.3%
Simplified52.3%
div-sub51.8%
add-sqr-sqrt50.0%
*-un-lft-identity50.0%
times-frac50.4%
fma-neg48.7%
Applied egg-rr48.8%
Taylor expanded in b_2 around inf 9.7%
distribute-rgt1-in9.7%
metadata-eval9.7%
mul0-lft11.7%
Simplified11.7%
Final simplification11.7%
herbie shell --seed 2023208
(FPCore (a b_2 c)
:name "quad2p (problem 3.2.1, positive)"
:precision binary64
(/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))