
(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 10 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
(let* ((t_0 (- (* b_2 b_2) (* c a))) (t_1 (/ (* -0.5 c) b_2)))
(if (<= b_2 -2.65e+87)
t_1
(if (<= b_2 -2.3e-64)
(/ (/ (* c a) (- (sqrt (+ t_0 (* 2.0 (* a (* c 0.0))))) b_2)) a)
(if (<= b_2 -5.1e-127)
t_1
(if (<= b_2 1.15e+97)
(/ (- (- b_2) (sqrt t_0)) a)
(/ (* b_2 -2.0) a)))))))
double code(double a, double b_2, double c) {
double t_0 = (b_2 * b_2) - (c * a);
double t_1 = (-0.5 * c) / b_2;
double tmp;
if (b_2 <= -2.65e+87) {
tmp = t_1;
} else if (b_2 <= -2.3e-64) {
tmp = ((c * a) / (sqrt((t_0 + (2.0 * (a * (c * 0.0))))) - b_2)) / a;
} else if (b_2 <= -5.1e-127) {
tmp = t_1;
} else if (b_2 <= 1.15e+97) {
tmp = (-b_2 - sqrt(t_0)) / 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b_2 * b_2) - (c * a)
t_1 = ((-0.5d0) * c) / b_2
if (b_2 <= (-2.65d+87)) then
tmp = t_1
else if (b_2 <= (-2.3d-64)) then
tmp = ((c * a) / (sqrt((t_0 + (2.0d0 * (a * (c * 0.0d0))))) - b_2)) / a
else if (b_2 <= (-5.1d-127)) then
tmp = t_1
else if (b_2 <= 1.15d+97) then
tmp = (-b_2 - sqrt(t_0)) / 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 t_0 = (b_2 * b_2) - (c * a);
double t_1 = (-0.5 * c) / b_2;
double tmp;
if (b_2 <= -2.65e+87) {
tmp = t_1;
} else if (b_2 <= -2.3e-64) {
tmp = ((c * a) / (Math.sqrt((t_0 + (2.0 * (a * (c * 0.0))))) - b_2)) / a;
} else if (b_2 <= -5.1e-127) {
tmp = t_1;
} else if (b_2 <= 1.15e+97) {
tmp = (-b_2 - Math.sqrt(t_0)) / a;
} else {
tmp = (b_2 * -2.0) / a;
}
return tmp;
}
def code(a, b_2, c): t_0 = (b_2 * b_2) - (c * a) t_1 = (-0.5 * c) / b_2 tmp = 0 if b_2 <= -2.65e+87: tmp = t_1 elif b_2 <= -2.3e-64: tmp = ((c * a) / (math.sqrt((t_0 + (2.0 * (a * (c * 0.0))))) - b_2)) / a elif b_2 <= -5.1e-127: tmp = t_1 elif b_2 <= 1.15e+97: tmp = (-b_2 - math.sqrt(t_0)) / a else: tmp = (b_2 * -2.0) / a return tmp
function code(a, b_2, c) t_0 = Float64(Float64(b_2 * b_2) - Float64(c * a)) t_1 = Float64(Float64(-0.5 * c) / b_2) tmp = 0.0 if (b_2 <= -2.65e+87) tmp = t_1; elseif (b_2 <= -2.3e-64) tmp = Float64(Float64(Float64(c * a) / Float64(sqrt(Float64(t_0 + Float64(2.0 * Float64(a * Float64(c * 0.0))))) - b_2)) / a); elseif (b_2 <= -5.1e-127) tmp = t_1; elseif (b_2 <= 1.15e+97) tmp = Float64(Float64(Float64(-b_2) - sqrt(t_0)) / a); else tmp = Float64(Float64(b_2 * -2.0) / a); end return tmp end
function tmp_2 = code(a, b_2, c) t_0 = (b_2 * b_2) - (c * a); t_1 = (-0.5 * c) / b_2; tmp = 0.0; if (b_2 <= -2.65e+87) tmp = t_1; elseif (b_2 <= -2.3e-64) tmp = ((c * a) / (sqrt((t_0 + (2.0 * (a * (c * 0.0))))) - b_2)) / a; elseif (b_2 <= -5.1e-127) tmp = t_1; elseif (b_2 <= 1.15e+97) tmp = (-b_2 - sqrt(t_0)) / a; else tmp = (b_2 * -2.0) / a; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := Block[{t$95$0 = N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(c * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision]}, If[LessEqual[b$95$2, -2.65e+87], t$95$1, If[LessEqual[b$95$2, -2.3e-64], N[(N[(N[(c * a), $MachinePrecision] / N[(N[Sqrt[N[(t$95$0 + N[(2.0 * N[(a * N[(c * 0.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b$95$2), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b$95$2, -5.1e-127], t$95$1, If[LessEqual[b$95$2, 1.15e+97], N[(N[((-b$95$2) - N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b_2 \cdot b_2 - c \cdot a\\
t_1 := \frac{-0.5 \cdot c}{b_2}\\
\mathbf{if}\;b_2 \leq -2.65 \cdot 10^{+87}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b_2 \leq -2.3 \cdot 10^{-64}:\\
\;\;\;\;\frac{\frac{c \cdot a}{\sqrt{t_0 + 2 \cdot \left(a \cdot \left(c \cdot 0\right)\right)} - b_2}}{a}\\
\mathbf{elif}\;b_2 \leq -5.1 \cdot 10^{-127}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b_2 \leq 1.15 \cdot 10^{+97}:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{t_0}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\
\end{array}
\end{array}
if b_2 < -2.65000000000000002e87 or -2.3000000000000001e-64 < b_2 < -5.10000000000000019e-127Initial program 10.0%
Taylor expanded in b_2 around -inf 88.2%
associate-*r/88.2%
Simplified88.2%
if -2.65000000000000002e87 < b_2 < -2.3000000000000001e-64Initial program 33.6%
prod-diff33.5%
*-commutative33.5%
fma-neg33.5%
prod-diff33.5%
*-commutative33.5%
fma-neg33.5%
associate-+l+33.5%
*-commutative33.5%
fma-udef33.5%
distribute-lft-neg-in33.5%
*-commutative33.5%
distribute-rgt-neg-in33.5%
fma-def33.5%
*-commutative33.5%
fma-udef33.5%
distribute-lft-neg-in33.5%
*-commutative33.5%
distribute-rgt-neg-in33.5%
fma-def33.5%
Applied egg-rr33.5%
*-commutative33.5%
count-233.5%
*-commutative33.5%
Simplified33.5%
flip--33.5%
add-sqr-sqrt33.5%
*-commutative33.5%
*-commutative33.5%
*-commutative33.5%
*-commutative33.5%
Applied egg-rr33.5%
Simplified33.5%
Taylor expanded in b_2 around 0 91.6%
if -5.10000000000000019e-127 < b_2 < 1.15000000000000003e97Initial program 83.2%
if 1.15000000000000003e97 < b_2 Initial program 43.4%
Taylor expanded in b_2 around inf 93.7%
*-commutative93.7%
Simplified93.7%
Final simplification87.5%
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -1.2e-126)
(/ (* -0.5 c) b_2)
(if (<= b_2 1.1e+97)
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* c a)))) a)
(/ (* b_2 -2.0) a))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -1.2e-126) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 1.1e+97) {
tmp = (-b_2 - sqrt(((b_2 * b_2) - (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 <= (-1.2d-126)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= 1.1d+97) then
tmp = (-b_2 - sqrt(((b_2 * b_2) - (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 <= -1.2e-126) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 1.1e+97) {
tmp = (-b_2 - Math.sqrt(((b_2 * b_2) - (c * a)))) / a;
} else {
tmp = (b_2 * -2.0) / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -1.2e-126: tmp = (-0.5 * c) / b_2 elif b_2 <= 1.1e+97: tmp = (-b_2 - math.sqrt(((b_2 * b_2) - (c * a)))) / a else: tmp = (b_2 * -2.0) / a return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -1.2e-126) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= 1.1e+97) tmp = Float64(Float64(Float64(-b_2) - sqrt(Float64(Float64(b_2 * b_2) - Float64(c * 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 <= -1.2e-126) tmp = (-0.5 * c) / b_2; elseif (b_2 <= 1.1e+97) tmp = (-b_2 - sqrt(((b_2 * b_2) - (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, -1.2e-126], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 1.1e+97], 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[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -1.2 \cdot 10^{-126}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{elif}\;b_2 \leq 1.1 \cdot 10^{+97}:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\
\end{array}
\end{array}
if b_2 < -1.20000000000000003e-126Initial program 18.3%
Taylor expanded in b_2 around -inf 84.0%
associate-*r/84.0%
Simplified84.0%
if -1.20000000000000003e-126 < b_2 < 1.1e97Initial program 83.2%
if 1.1e97 < b_2 Initial program 43.4%
Taylor expanded in b_2 around inf 93.7%
*-commutative93.7%
Simplified93.7%
Final simplification85.3%
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -1.2e-126)
(/ (* -0.5 c) b_2)
(if (<= b_2 1.8e-93)
(/ (- (- b_2) (sqrt (* 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 <= -1.2e-126) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 1.8e-93) {
tmp = (-b_2 - sqrt((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 <= (-1.2d-126)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= 1.8d-93) then
tmp = (-b_2 - sqrt((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 <= -1.2e-126) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 1.8e-93) {
tmp = (-b_2 - Math.sqrt((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 <= -1.2e-126: tmp = (-0.5 * c) / b_2 elif b_2 <= 1.8e-93: tmp = (-b_2 - math.sqrt((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 <= -1.2e-126) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= 1.8e-93) tmp = Float64(Float64(Float64(-b_2) - sqrt(Float64(c * Float64(-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 <= -1.2e-126) tmp = (-0.5 * c) / b_2; elseif (b_2 <= 1.8e-93) tmp = (-b_2 - sqrt((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, -1.2e-126], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 1.8e-93], N[(N[((-b$95$2) - N[Sqrt[N[(c * (-a)), $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.2 \cdot 10^{-126}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{elif}\;b_2 \leq 1.8 \cdot 10^{-93}:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{c \cdot \left(-a\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.20000000000000003e-126Initial program 18.3%
Taylor expanded in b_2 around -inf 84.0%
associate-*r/84.0%
Simplified84.0%
if -1.20000000000000003e-126 < b_2 < 1.8000000000000001e-93Initial program 79.6%
Taylor expanded in b_2 around 0 74.1%
mul-1-neg74.1%
distribute-rgt-neg-out74.1%
Simplified74.1%
if 1.8000000000000001e-93 < b_2 Initial program 66.6%
Taylor expanded in b_2 around inf 82.6%
Final simplification81.1%
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -3.9e-128)
(/ (* -0.5 c) b_2)
(if (<= b_2 2.4e-94)
(/ (- (sqrt (* 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.9e-128) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 2.4e-94) {
tmp = -sqrt((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.9d-128)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= 2.4d-94) then
tmp = -sqrt((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.9e-128) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 2.4e-94) {
tmp = -Math.sqrt((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.9e-128: tmp = (-0.5 * c) / b_2 elif b_2 <= 2.4e-94: tmp = -math.sqrt((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.9e-128) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= 2.4e-94) tmp = Float64(Float64(-sqrt(Float64(c * Float64(-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.9e-128) tmp = (-0.5 * c) / b_2; elseif (b_2 <= 2.4e-94) tmp = -sqrt((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.9e-128], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 2.4e-94], N[((-N[Sqrt[N[(c * (-a)), $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.9 \cdot 10^{-128}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{elif}\;b_2 \leq 2.4 \cdot 10^{-94}:\\
\;\;\;\;\frac{-\sqrt{c \cdot \left(-a\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\end{array}
\end{array}
if b_2 < -3.89999999999999997e-128Initial program 18.3%
Taylor expanded in b_2 around -inf 84.0%
associate-*r/84.0%
Simplified84.0%
if -3.89999999999999997e-128 < b_2 < 2.4e-94Initial program 79.6%
prod-diff79.3%
*-commutative79.3%
fma-neg79.3%
prod-diff79.3%
*-commutative79.3%
fma-neg79.3%
associate-+l+79.2%
*-commutative79.2%
fma-udef79.3%
distribute-lft-neg-in79.3%
*-commutative79.3%
distribute-rgt-neg-in79.3%
fma-def79.2%
*-commutative79.2%
fma-udef79.3%
distribute-lft-neg-in79.3%
*-commutative79.3%
distribute-rgt-neg-in79.3%
fma-def79.2%
Applied egg-rr79.2%
*-commutative79.2%
count-279.2%
*-commutative79.2%
Simplified79.2%
Taylor expanded in b_2 around 0 71.9%
mul-1-neg71.9%
fma-neg71.9%
associate-*r*71.9%
neg-mul-171.9%
*-commutative71.9%
*-commutative71.9%
fma-def71.8%
fma-neg71.8%
fma-def71.9%
*-commutative71.9%
neg-mul-171.9%
associate-*r*71.9%
*-commutative71.9%
distribute-lft1-in71.9%
metadata-eval71.9%
mul0-lft72.2%
metadata-eval72.2%
neg-sub072.2%
distribute-lft-neg-in72.2%
*-commutative72.2%
Simplified72.2%
if 2.4e-94 < b_2 Initial program 66.6%
Taylor expanded in b_2 around inf 82.6%
Final simplification80.7%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2e-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 <= -2e-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 <= (-2d-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 <= -2e-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 <= -2e-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 <= -2e-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 <= -2e-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, -2e-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 -2 \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 < -1.999999999999994e-310Initial program 30.8%
Taylor expanded in b_2 around -inf 68.9%
associate-*r/68.9%
Simplified68.9%
if -1.999999999999994e-310 < b_2 Initial program 70.5%
Taylor expanded in b_2 around inf 65.0%
Final simplification67.0%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2e-310) (* c (/ -0.5 b_2)) (/ -2.0 (/ a b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2e-310) {
tmp = c * (-0.5 / b_2);
} else {
tmp = -2.0 / (a / 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 <= (-2d-310)) then
tmp = c * ((-0.5d0) / b_2)
else
tmp = (-2.0d0) / (a / b_2)
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 * (-0.5 / b_2);
} else {
tmp = -2.0 / (a / b_2);
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2e-310: tmp = c * (-0.5 / b_2) else: tmp = -2.0 / (a / b_2) return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2e-310) tmp = Float64(c * Float64(-0.5 / b_2)); else tmp = Float64(-2.0 / Float64(a / b_2)); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -2e-310) tmp = c * (-0.5 / b_2); else tmp = -2.0 / (a / b_2); end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2e-310], N[(c * N[(-0.5 / b$95$2), $MachinePrecision]), $MachinePrecision], N[(-2.0 / N[(a / b$95$2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2 \cdot 10^{-310}:\\
\;\;\;\;c \cdot \frac{-0.5}{b_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{\frac{a}{b_2}}\\
\end{array}
\end{array}
if b_2 < -1.999999999999994e-310Initial program 30.8%
frac-2neg30.8%
div-inv30.8%
Applied egg-rr37.1%
Taylor expanded in b_2 around -inf 0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt68.9%
associate-*r*68.9%
metadata-eval68.9%
associate-/l*68.6%
Simplified68.6%
associate-/r/68.7%
Applied egg-rr68.7%
if -1.999999999999994e-310 < b_2 Initial program 70.5%
prod-diff70.1%
*-commutative70.1%
fma-neg70.1%
prod-diff70.1%
*-commutative70.1%
fma-neg70.1%
associate-+l+70.1%
*-commutative70.1%
fma-udef70.1%
distribute-lft-neg-in70.1%
*-commutative70.1%
distribute-rgt-neg-in70.1%
fma-def70.1%
*-commutative70.1%
fma-udef70.1%
distribute-lft-neg-in70.1%
*-commutative70.1%
distribute-rgt-neg-in70.1%
fma-def70.1%
Applied egg-rr70.1%
*-commutative70.1%
count-270.1%
*-commutative70.1%
Simplified70.1%
Taylor expanded in b_2 around inf 64.6%
associate-*r/64.6%
associate-/l*64.4%
Simplified64.4%
Final simplification66.6%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2e-310) (/ (* -0.5 c) b_2) (/ -2.0 (/ a b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2e-310) {
tmp = (-0.5 * c) / b_2;
} else {
tmp = -2.0 / (a / 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 <= (-2d-310)) then
tmp = ((-0.5d0) * c) / b_2
else
tmp = (-2.0d0) / (a / b_2)
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 = (-0.5 * c) / b_2;
} else {
tmp = -2.0 / (a / b_2);
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2e-310: tmp = (-0.5 * c) / b_2 else: tmp = -2.0 / (a / b_2) return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2e-310) tmp = Float64(Float64(-0.5 * c) / b_2); else tmp = Float64(-2.0 / Float64(a / b_2)); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -2e-310) tmp = (-0.5 * c) / b_2; else tmp = -2.0 / (a / b_2); end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2e-310], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], N[(-2.0 / N[(a / b$95$2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2}{\frac{a}{b_2}}\\
\end{array}
\end{array}
if b_2 < -1.999999999999994e-310Initial program 30.8%
Taylor expanded in b_2 around -inf 68.9%
associate-*r/68.9%
Simplified68.9%
if -1.999999999999994e-310 < b_2 Initial program 70.5%
prod-diff70.1%
*-commutative70.1%
fma-neg70.1%
prod-diff70.1%
*-commutative70.1%
fma-neg70.1%
associate-+l+70.1%
*-commutative70.1%
fma-udef70.1%
distribute-lft-neg-in70.1%
*-commutative70.1%
distribute-rgt-neg-in70.1%
fma-def70.1%
*-commutative70.1%
fma-udef70.1%
distribute-lft-neg-in70.1%
*-commutative70.1%
distribute-rgt-neg-in70.1%
fma-def70.1%
Applied egg-rr70.1%
*-commutative70.1%
count-270.1%
*-commutative70.1%
Simplified70.1%
Taylor expanded in b_2 around inf 64.6%
associate-*r/64.6%
associate-/l*64.4%
Simplified64.4%
Final simplification66.7%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2e-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 <= -2e-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 <= (-2d-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 <= -2e-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 <= -2e-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 <= -2e-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 <= -2e-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, -2e-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 -2 \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 < -1.999999999999994e-310Initial program 30.8%
Taylor expanded in b_2 around -inf 68.9%
associate-*r/68.9%
Simplified68.9%
if -1.999999999999994e-310 < b_2 Initial program 70.5%
Taylor expanded in b_2 around inf 64.6%
*-commutative64.6%
Simplified64.6%
Final simplification66.8%
(FPCore (a b_2 c) :precision binary64 (* c (/ 0.5 b_2)))
double code(double a, double b_2, double c) {
return c * (0.5 / b_2);
}
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 = c * (0.5d0 / b_2)
end function
public static double code(double a, double b_2, double c) {
return c * (0.5 / b_2);
}
def code(a, b_2, c): return c * (0.5 / b_2)
function code(a, b_2, c) return Float64(c * Float64(0.5 / b_2)) end
function tmp = code(a, b_2, c) tmp = c * (0.5 / b_2); end
code[a_, b$95$2_, c_] := N[(c * N[(0.5 / b$95$2), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c \cdot \frac{0.5}{b_2}
\end{array}
Initial program 50.5%
Taylor expanded in b_2 around inf 30.6%
div-inv30.6%
*-commutative30.6%
Applied egg-rr30.6%
associate-*l*33.3%
Simplified33.3%
Taylor expanded in b_2 around 0 9.5%
*-commutative9.5%
associate-*l/9.5%
associate-*r/9.5%
Simplified9.5%
Final simplification9.5%
(FPCore (a b_2 c) :precision binary64 (* c (/ -0.5 b_2)))
double code(double a, double b_2, double c) {
return c * (-0.5 / b_2);
}
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 = c * ((-0.5d0) / b_2)
end function
public static double code(double a, double b_2, double c) {
return c * (-0.5 / b_2);
}
def code(a, b_2, c): return c * (-0.5 / b_2)
function code(a, b_2, c) return Float64(c * Float64(-0.5 / b_2)) end
function tmp = code(a, b_2, c) tmp = c * (-0.5 / b_2); end
code[a_, b$95$2_, c_] := N[(c * N[(-0.5 / b$95$2), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c \cdot \frac{-0.5}{b_2}
\end{array}
Initial program 50.5%
frac-2neg50.5%
div-inv50.3%
Applied egg-rr47.8%
Taylor expanded in b_2 around -inf 0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt35.8%
associate-*r*35.8%
metadata-eval35.8%
associate-/l*35.7%
Simplified35.7%
associate-/r/35.8%
Applied egg-rr35.8%
Final simplification35.8%
herbie shell --seed 2023171
(FPCore (a b_2 c)
:name "quad2m (problem 3.2.1, negative)"
:precision binary64
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))