
(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 9 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.2e-105)
(/ (* -0.5 c) b_2)
(if (<= b_2 5e+102)
(/ (- (- 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 <= -3.2e-105) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 5e+102) {
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 <= (-3.2d-105)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= 5d+102) 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 <= -3.2e-105) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 5e+102) {
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 <= -3.2e-105: tmp = (-0.5 * c) / b_2 elif b_2 <= 5e+102: 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 <= -3.2e-105) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= 5e+102) 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 <= -3.2e-105) tmp = (-0.5 * c) / b_2; elseif (b_2 <= 5e+102) 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, -3.2e-105], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 5e+102], 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.2 \cdot 10^{-105}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{elif}\;b_2 \leq 5 \cdot 10^{+102}:\\
\;\;\;\;\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.19999999999999981e-105Initial program 17.2%
frac-2neg17.2%
div-inv17.1%
Applied egg-rr25.4%
Taylor expanded in b_2 around -inf 0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt83.4%
associate-*r*83.4%
metadata-eval83.4%
Simplified83.4%
if -3.19999999999999981e-105 < b_2 < 5e102Initial program 82.3%
if 5e102 < b_2 Initial program 52.5%
Taylor expanded in b_2 around inf 98.3%
Final simplification86.3%
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -1.6e-107)
(/ (* -0.5 c) b_2)
(if (<= b_2 2.9e-72)
(/ (- (- b_2) (sqrt (* a (- c)))) 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 <= -1.6e-107) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 2.9e-72) {
tmp = (-b_2 - sqrt((a * -c))) / 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 <= (-1.6d-107)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= 2.9d-72) then
tmp = (-b_2 - sqrt((a * -c))) / 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 <= -1.6e-107) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 2.9e-72) {
tmp = (-b_2 - Math.sqrt((a * -c))) / 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 <= -1.6e-107: tmp = (-0.5 * c) / b_2 elif b_2 <= 2.9e-72: tmp = (-b_2 - math.sqrt((a * -c))) / 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 <= -1.6e-107) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= 2.9e-72) tmp = Float64(Float64(Float64(-b_2) - sqrt(Float64(a * Float64(-c)))) / 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 <= -1.6e-107) tmp = (-0.5 * c) / b_2; elseif (b_2 <= 2.9e-72) tmp = (-b_2 - sqrt((a * -c))) / 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, -1.6e-107], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 2.9e-72], N[(N[((-b$95$2) - N[Sqrt[N[(a * (-c)), $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 -1.6 \cdot 10^{-107}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{elif}\;b_2 \leq 2.9 \cdot 10^{-72}:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{a \cdot \left(-c\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\end{array}
\end{array}
if b_2 < -1.60000000000000006e-107Initial program 17.2%
frac-2neg17.2%
div-inv17.1%
Applied egg-rr25.4%
Taylor expanded in b_2 around -inf 0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt83.4%
associate-*r*83.4%
metadata-eval83.4%
Simplified83.4%
if -1.60000000000000006e-107 < b_2 < 2.89999999999999998e-72Initial program 78.7%
Taylor expanded in b_2 around 0 76.6%
associate-*r*76.6%
neg-mul-176.6%
*-commutative76.6%
Simplified76.6%
if 2.89999999999999998e-72 < b_2 Initial program 67.2%
Taylor expanded in b_2 around inf 86.5%
Final simplification82.9%
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -1.15e-105)
(/ (* -0.5 c) b_2)
(if (<= b_2 2.6e-74)
(/ (- (sqrt (* a (- c)))) 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 <= -1.15e-105) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 2.6e-74) {
tmp = -sqrt((a * -c)) / 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 <= (-1.15d-105)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= 2.6d-74) then
tmp = -sqrt((a * -c)) / 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 <= -1.15e-105) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 2.6e-74) {
tmp = -Math.sqrt((a * -c)) / 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 <= -1.15e-105: tmp = (-0.5 * c) / b_2 elif b_2 <= 2.6e-74: tmp = -math.sqrt((a * -c)) / 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 <= -1.15e-105) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= 2.6e-74) tmp = Float64(Float64(-sqrt(Float64(a * Float64(-c)))) / 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 <= -1.15e-105) tmp = (-0.5 * c) / b_2; elseif (b_2 <= 2.6e-74) tmp = -sqrt((a * -c)) / 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, -1.15e-105], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 2.6e-74], N[((-N[Sqrt[N[(a * (-c)), $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 -1.15 \cdot 10^{-105}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{elif}\;b_2 \leq 2.6 \cdot 10^{-74}:\\
\;\;\;\;\frac{-\sqrt{a \cdot \left(-c\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\end{array}
\end{array}
if b_2 < -1.15e-105Initial program 17.2%
frac-2neg17.2%
div-inv17.1%
Applied egg-rr25.4%
Taylor expanded in b_2 around -inf 0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt83.4%
associate-*r*83.4%
metadata-eval83.4%
Simplified83.4%
if -1.15e-105 < b_2 < 2.6000000000000001e-74Initial program 78.7%
prod-diff78.4%
*-commutative78.4%
fma-neg78.4%
prod-diff78.4%
*-commutative78.4%
fma-neg78.4%
associate-+l+78.3%
*-commutative78.3%
fma-udef78.4%
distribute-lft-neg-in78.4%
*-commutative78.4%
distribute-rgt-neg-in78.4%
fma-def78.3%
*-commutative78.3%
fma-udef78.4%
distribute-lft-neg-in78.4%
*-commutative78.4%
distribute-rgt-neg-in78.4%
fma-def78.3%
Applied egg-rr78.3%
count-278.3%
Simplified78.3%
Taylor expanded in b_2 around 0 75.6%
mul-1-neg75.6%
Simplified76.0%
if 2.6000000000000001e-74 < b_2 Initial program 67.2%
Taylor expanded in b_2 around inf 86.5%
Final simplification82.8%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -5e-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 <= -5e-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 <= (-5d-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 <= -5e-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 <= -5e-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 <= -5e-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 <= -5e-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, -5e-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 -5 \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 < -4.999999999999985e-310Initial program 28.1%
frac-2neg28.1%
div-inv28.1%
Applied egg-rr34.5%
Taylor expanded in b_2 around -inf 0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt68.1%
associate-*r*68.1%
metadata-eval68.1%
Simplified68.1%
if -4.999999999999985e-310 < b_2 Initial program 72.7%
Taylor expanded in b_2 around inf 67.8%
Final simplification67.9%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.8e-306) (* -0.5 (/ c b_2)) (/ (- b_2) a)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.8e-306) {
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 <= (-2.8d-306)) 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 <= -2.8e-306) {
tmp = -0.5 * (c / b_2);
} else {
tmp = -b_2 / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.8e-306: 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 <= -2.8e-306) tmp = Float64(-0.5 * Float64(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 <= -2.8e-306) 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, -2.8e-306], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], N[((-b$95$2) / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-306}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-b_2}{a}\\
\end{array}
\end{array}
if b_2 < -2.8000000000000001e-306Initial program 28.3%
Taylor expanded in b_2 around -inf 68.6%
if -2.8000000000000001e-306 < b_2 Initial program 72.2%
Taylor expanded in b_2 around 0 40.6%
associate-*r*40.6%
neg-mul-140.6%
*-commutative40.6%
Simplified40.6%
Taylor expanded in b_2 around inf 28.5%
associate-*r/28.5%
mul-1-neg28.5%
Simplified28.5%
Final simplification48.2%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.8e-306) (/ (* -0.5 c) b_2) (/ (- b_2) a)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.8e-306) {
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 <= (-2.8d-306)) 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 <= -2.8e-306) {
tmp = (-0.5 * c) / b_2;
} else {
tmp = -b_2 / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.8e-306: 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 <= -2.8e-306) 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 <= -2.8e-306) 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, -2.8e-306], 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 -2.8 \cdot 10^{-306}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-b_2}{a}\\
\end{array}
\end{array}
if b_2 < -2.8000000000000001e-306Initial program 28.3%
frac-2neg28.3%
div-inv28.3%
Applied egg-rr34.8%
Taylor expanded in b_2 around -inf 0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt68.6%
associate-*r*68.6%
metadata-eval68.6%
Simplified68.6%
if -2.8000000000000001e-306 < b_2 Initial program 72.2%
Taylor expanded in b_2 around 0 40.6%
associate-*r*40.6%
neg-mul-140.6%
*-commutative40.6%
Simplified40.6%
Taylor expanded in b_2 around inf 28.5%
associate-*r/28.5%
mul-1-neg28.5%
Simplified28.5%
Final simplification48.2%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.8e-306) (/ (* -0.5 c) b_2) (/ (* b_2 -2.0) a)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.8e-306) {
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 <= (-2.8d-306)) 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 <= -2.8e-306) {
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 <= -2.8e-306: 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 <= -2.8e-306) 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 <= -2.8e-306) 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, -2.8e-306], 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 -2.8 \cdot 10^{-306}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\
\end{array}
\end{array}
if b_2 < -2.8000000000000001e-306Initial program 28.3%
frac-2neg28.3%
div-inv28.3%
Applied egg-rr34.8%
Taylor expanded in b_2 around -inf 0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt68.6%
associate-*r*68.6%
metadata-eval68.6%
Simplified68.6%
if -2.8000000000000001e-306 < b_2 Initial program 72.2%
Taylor expanded in b_2 around inf 66.8%
*-commutative66.8%
Simplified66.8%
Final simplification67.7%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.8e-306) 0.0 (/ (- b_2) a)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.8e-306) {
tmp = 0.0;
} 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 <= (-2.8d-306)) then
tmp = 0.0d0
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 <= -2.8e-306) {
tmp = 0.0;
} else {
tmp = -b_2 / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.8e-306: tmp = 0.0 else: tmp = -b_2 / a return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.8e-306) tmp = 0.0; 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 <= -2.8e-306) tmp = 0.0; else tmp = -b_2 / a; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.8e-306], 0.0, N[((-b$95$2) / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-306}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{-b_2}{a}\\
\end{array}
\end{array}
if b_2 < -2.8000000000000001e-306Initial program 28.3%
frac-2neg28.3%
div-inv28.3%
Applied egg-rr34.8%
Taylor expanded in b_2 around inf 2.5%
count-22.5%
Simplified2.5%
*-commutative2.5%
flip-+0.0%
frac-times0.0%
*-un-lft-identity0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-cube-cbrt5.1%
fma-neg6.3%
add-sqr-sqrt6.3%
sqrt-unprod6.3%
sqr-neg6.3%
sqrt-unprod0.0%
add-sqr-sqrt6.3%
fma-def6.3%
add-cube-cbrt6.3%
Applied egg-rr6.3%
div-sub5.2%
+-inverses20.9%
Simplified20.9%
if -2.8000000000000001e-306 < b_2 Initial program 72.2%
Taylor expanded in b_2 around 0 40.6%
associate-*r*40.6%
neg-mul-140.6%
*-commutative40.6%
Simplified40.6%
Taylor expanded in b_2 around inf 28.5%
associate-*r/28.5%
mul-1-neg28.5%
Simplified28.5%
Final simplification24.8%
(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 50.6%
frac-2neg50.6%
div-inv50.5%
Applied egg-rr48.6%
Taylor expanded in b_2 around inf 35.0%
count-235.0%
Simplified35.0%
*-commutative35.0%
flip-+0.0%
frac-times0.0%
*-un-lft-identity0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-cube-cbrt3.2%
fma-neg3.9%
add-sqr-sqrt3.1%
sqrt-unprod3.9%
sqr-neg3.9%
sqrt-unprod0.8%
add-sqr-sqrt3.9%
fma-def3.9%
add-cube-cbrt3.9%
Applied egg-rr3.9%
div-sub3.3%
+-inverses11.5%
Simplified11.5%
Final simplification11.5%
herbie shell --seed 2023278
(FPCore (a b_2 c)
:name "quad2m (problem 3.2.1, negative)"
:precision binary64
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))