
(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
(let* ((t_0 (sqrt (- (* b_2 b_2) (* c a)))))
(if (<= b_2 -7.5e-23)
(* -0.5 (/ c b_2))
(if (<= b_2 -1.8e-160)
(/ (/ (* c (- a)) (- b_2 t_0)) a)
(if (<= b_2 -9e-192)
(* c (/ -0.5 b_2))
(if (<= b_2 120000000.0)
(/ (- (- b_2) t_0) a)
(/ (* b_2 -2.0) a)))))))
double code(double a, double b_2, double c) {
double t_0 = sqrt(((b_2 * b_2) - (c * a)));
double tmp;
if (b_2 <= -7.5e-23) {
tmp = -0.5 * (c / b_2);
} else if (b_2 <= -1.8e-160) {
tmp = ((c * -a) / (b_2 - t_0)) / a;
} else if (b_2 <= -9e-192) {
tmp = c * (-0.5 / b_2);
} else if (b_2 <= 120000000.0) {
tmp = (-b_2 - 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) :: tmp
t_0 = sqrt(((b_2 * b_2) - (c * a)))
if (b_2 <= (-7.5d-23)) then
tmp = (-0.5d0) * (c / b_2)
else if (b_2 <= (-1.8d-160)) then
tmp = ((c * -a) / (b_2 - t_0)) / a
else if (b_2 <= (-9d-192)) then
tmp = c * ((-0.5d0) / b_2)
else if (b_2 <= 120000000.0d0) then
tmp = (-b_2 - 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 = Math.sqrt(((b_2 * b_2) - (c * a)));
double tmp;
if (b_2 <= -7.5e-23) {
tmp = -0.5 * (c / b_2);
} else if (b_2 <= -1.8e-160) {
tmp = ((c * -a) / (b_2 - t_0)) / a;
} else if (b_2 <= -9e-192) {
tmp = c * (-0.5 / b_2);
} else if (b_2 <= 120000000.0) {
tmp = (-b_2 - t_0) / a;
} else {
tmp = (b_2 * -2.0) / a;
}
return tmp;
}
def code(a, b_2, c): t_0 = math.sqrt(((b_2 * b_2) - (c * a))) tmp = 0 if b_2 <= -7.5e-23: tmp = -0.5 * (c / b_2) elif b_2 <= -1.8e-160: tmp = ((c * -a) / (b_2 - t_0)) / a elif b_2 <= -9e-192: tmp = c * (-0.5 / b_2) elif b_2 <= 120000000.0: tmp = (-b_2 - t_0) / a else: tmp = (b_2 * -2.0) / a return tmp
function code(a, b_2, c) t_0 = sqrt(Float64(Float64(b_2 * b_2) - Float64(c * a))) tmp = 0.0 if (b_2 <= -7.5e-23) tmp = Float64(-0.5 * Float64(c / b_2)); elseif (b_2 <= -1.8e-160) tmp = Float64(Float64(Float64(c * Float64(-a)) / Float64(b_2 - t_0)) / a); elseif (b_2 <= -9e-192) tmp = Float64(c * Float64(-0.5 / b_2)); elseif (b_2 <= 120000000.0) tmp = Float64(Float64(Float64(-b_2) - 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 = sqrt(((b_2 * b_2) - (c * a))); tmp = 0.0; if (b_2 <= -7.5e-23) tmp = -0.5 * (c / b_2); elseif (b_2 <= -1.8e-160) tmp = ((c * -a) / (b_2 - t_0)) / a; elseif (b_2 <= -9e-192) tmp = c * (-0.5 / b_2); elseif (b_2 <= 120000000.0) tmp = (-b_2 - 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[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(c * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b$95$2, -7.5e-23], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, -1.8e-160], N[(N[(N[(c * (-a)), $MachinePrecision] / N[(b$95$2 - t$95$0), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b$95$2, -9e-192], N[(c * N[(-0.5 / b$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 120000000.0], N[(N[((-b$95$2) - t$95$0), $MachinePrecision] / a), $MachinePrecision], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{b_2 \cdot b_2 - c \cdot a}\\
\mathbf{if}\;b_2 \leq -7.5 \cdot 10^{-23}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq -1.8 \cdot 10^{-160}:\\
\;\;\;\;\frac{\frac{c \cdot \left(-a\right)}{b_2 - t_0}}{a}\\
\mathbf{elif}\;b_2 \leq -9 \cdot 10^{-192}:\\
\;\;\;\;c \cdot \frac{-0.5}{b_2}\\
\mathbf{elif}\;b_2 \leq 120000000:\\
\;\;\;\;\frac{\left(-b_2\right) - t_0}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\
\end{array}
\end{array}
if b_2 < -7.4999999999999998e-23Initial program 12.4%
Taylor expanded in b_2 around -inf 98.9%
if -7.4999999999999998e-23 < b_2 < -1.7999999999999999e-160Initial program 51.4%
add-cube-cbrt50.3%
sqrt-prod50.4%
pow250.4%
Applied egg-rr50.4%
unpow250.4%
rem-sqrt-square50.4%
rem-square-sqrt50.2%
unpow1/250.2%
unpow1/250.2%
fabs-sqr50.2%
pow-sqr50.4%
metadata-eval50.4%
unpow150.4%
*-commutative50.4%
*-commutative50.4%
Simplified50.4%
flip--50.4%
frac-2neg50.4%
Applied egg-rr51.5%
neg-sub051.5%
associate--r-75.3%
+-inverses75.3%
associate--r+75.3%
metadata-eval75.3%
neg-sub075.3%
distribute-rgt-neg-in75.3%
Simplified75.3%
if -1.7999999999999999e-160 < b_2 < -9.00000000000000048e-192Initial program 32.8%
add-cube-cbrt32.8%
sqrt-prod33.0%
pow233.0%
Applied egg-rr33.0%
unpow233.0%
rem-sqrt-square33.0%
rem-square-sqrt32.7%
unpow1/232.7%
unpow1/232.7%
fabs-sqr32.7%
pow-sqr33.0%
metadata-eval33.0%
unpow133.0%
*-commutative33.0%
*-commutative33.0%
Simplified33.0%
Taylor expanded in b_2 around -inf 63.1%
metadata-eval63.1%
times-frac63.1%
*-commutative63.1%
times-frac63.1%
/-rgt-identity63.1%
Simplified63.1%
if -9.00000000000000048e-192 < b_2 < 1.2e8Initial program 90.9%
if 1.2e8 < b_2 Initial program 85.6%
Taylor expanded in b_2 around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification93.4%
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -9e-192)
(* -0.5 (/ c b_2))
(if (<= b_2 120000000.0)
(/ (- (- 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 <= -9e-192) {
tmp = -0.5 * (c / b_2);
} else if (b_2 <= 120000000.0) {
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 <= (-9d-192)) then
tmp = (-0.5d0) * (c / b_2)
else if (b_2 <= 120000000.0d0) 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 <= -9e-192) {
tmp = -0.5 * (c / b_2);
} else if (b_2 <= 120000000.0) {
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 <= -9e-192: tmp = -0.5 * (c / b_2) elif b_2 <= 120000000.0: 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 <= -9e-192) tmp = Float64(-0.5 * Float64(c / b_2)); elseif (b_2 <= 120000000.0) 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 <= -9e-192) tmp = -0.5 * (c / b_2); elseif (b_2 <= 120000000.0) 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, -9e-192], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 120000000.0], 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 -9 \cdot 10^{-192}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 120000000:\\
\;\;\;\;\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 < -9.00000000000000048e-192Initial program 22.3%
Taylor expanded in b_2 around -inf 86.8%
if -9.00000000000000048e-192 < b_2 < 1.2e8Initial program 90.9%
if 1.2e8 < b_2 Initial program 85.6%
Taylor expanded in b_2 around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification91.4%
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -9e-192)
(* -0.5 (/ c b_2))
(if (<= b_2 6.3e-108)
(/ (- b_2 (sqrt (- (* b_2 b_2) (* c a)))) a)
(+ (* -2.0 (/ b_2 a)) (* (/ c b_2) 0.5)))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -9e-192) {
tmp = -0.5 * (c / b_2);
} else if (b_2 <= 6.3e-108) {
tmp = (b_2 - sqrt(((b_2 * b_2) - (c * a)))) / a;
} else {
tmp = (-2.0 * (b_2 / a)) + ((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 <= (-9d-192)) then
tmp = (-0.5d0) * (c / b_2)
else if (b_2 <= 6.3d-108) then
tmp = (b_2 - sqrt(((b_2 * b_2) - (c * a)))) / a
else
tmp = ((-2.0d0) * (b_2 / a)) + ((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 <= -9e-192) {
tmp = -0.5 * (c / b_2);
} else if (b_2 <= 6.3e-108) {
tmp = (b_2 - Math.sqrt(((b_2 * b_2) - (c * a)))) / a;
} else {
tmp = (-2.0 * (b_2 / a)) + ((c / b_2) * 0.5);
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -9e-192: tmp = -0.5 * (c / b_2) elif b_2 <= 6.3e-108: tmp = (b_2 - math.sqrt(((b_2 * b_2) - (c * a)))) / a else: tmp = (-2.0 * (b_2 / a)) + ((c / b_2) * 0.5) return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -9e-192) tmp = Float64(-0.5 * Float64(c / b_2)); elseif (b_2 <= 6.3e-108) tmp = 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(Float64(c / b_2) * 0.5)); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -9e-192) tmp = -0.5 * (c / b_2); elseif (b_2 <= 6.3e-108) tmp = (b_2 - sqrt(((b_2 * b_2) - (c * a)))) / a; else tmp = (-2.0 * (b_2 / a)) + ((c / b_2) * 0.5); end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -9e-192], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 6.3e-108], 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[(N[(c / b$95$2), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -9 \cdot 10^{-192}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 6.3 \cdot 10^{-108}:\\
\;\;\;\;\frac{b_2 - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + \frac{c}{b_2} \cdot 0.5\\
\end{array}
\end{array}
if b_2 < -9.00000000000000048e-192Initial program 22.3%
Taylor expanded in b_2 around -inf 86.8%
if -9.00000000000000048e-192 < b_2 < 6.2999999999999997e-108Initial program 83.9%
sub-neg83.9%
+-commutative83.9%
add-sqr-sqrt83.5%
distribute-rgt-neg-in83.5%
add-sqr-sqrt24.1%
sqrt-unprod75.9%
sqr-neg75.9%
sqrt-prod51.4%
add-sqr-sqrt75.9%
fma-def75.9%
Applied egg-rr76.0%
fma-udef76.0%
+-commutative76.0%
distribute-rgt-neg-out76.0%
pow-sqr76.1%
metadata-eval76.1%
exp-to-pow71.9%
unsub-neg71.9%
exp-to-pow76.1%
unpow1/276.1%
*-commutative76.1%
Simplified76.1%
if 6.2999999999999997e-108 < b_2 Initial program 90.7%
Taylor expanded in b_2 around inf 88.7%
Final simplification85.7%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -4e-310) (* -0.5 (/ c b_2)) (/ (+ (* b_2 -2.0) (* 0.5 (/ (* c a) 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 * -2.0) + (0.5 * ((c * a) / 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 * (-2.0d0)) + (0.5d0 * ((c * a) / 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 * -2.0) + (0.5 * ((c * a) / 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 * -2.0) + (0.5 * ((c * a) / b_2))) / a return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -4e-310) tmp = Float64(-0.5 * Float64(c / b_2)); else tmp = Float64(Float64(Float64(b_2 * -2.0) + Float64(0.5 * Float64(Float64(c * a) / 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 * -2.0) + (0.5 * ((c * a) / b_2))) / a; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -4e-310], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b$95$2 * -2.0), $MachinePrecision] + N[(0.5 * N[(N[(c * a), $MachinePrecision] / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -4 \cdot 10^{-310}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{b_2 \cdot -2 + 0.5 \cdot \frac{c \cdot a}{b_2}}{a}\\
\end{array}
\end{array}
if b_2 < -3.999999999999988e-310Initial program 28.2%
Taylor expanded in b_2 around -inf 78.6%
if -3.999999999999988e-310 < b_2 Initial program 89.9%
Taylor expanded in b_2 around inf 72.4%
Final simplification75.5%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -4e-310) (* -0.5 (/ c b_2)) (+ (* -2.0 (/ b_2 a)) (* (/ c b_2) 0.5))))
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)) + ((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 <= (-4d-310)) then
tmp = (-0.5d0) * (c / b_2)
else
tmp = ((-2.0d0) * (b_2 / a)) + ((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 <= -4e-310) {
tmp = -0.5 * (c / b_2);
} else {
tmp = (-2.0 * (b_2 / a)) + ((c / b_2) * 0.5);
}
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)) + ((c / b_2) * 0.5) return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -4e-310) tmp = Float64(-0.5 * Float64(c / b_2)); else tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + 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 <= -4e-310) tmp = -0.5 * (c / b_2); else tmp = (-2.0 * (b_2 / a)) + ((c / b_2) * 0.5); end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -4e-310], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b$95$2), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -4 \cdot 10^{-310}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + \frac{c}{b_2} \cdot 0.5\\
\end{array}
\end{array}
if b_2 < -3.999999999999988e-310Initial program 28.2%
Taylor expanded in b_2 around -inf 78.6%
if -3.999999999999988e-310 < b_2 Initial program 89.9%
Taylor expanded in b_2 around inf 72.4%
Final simplification75.5%
(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(-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 <= -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[(-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 -4 \cdot 10^{-310}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-b_2}{a}\\
\end{array}
\end{array}
if b_2 < -3.999999999999988e-310Initial program 28.2%
Taylor expanded in b_2 around -inf 78.6%
if -3.999999999999988e-310 < b_2 Initial program 89.9%
add-sqr-sqrt89.6%
pow289.6%
pow1/289.6%
sqrt-pow189.7%
metadata-eval89.7%
Applied egg-rr89.7%
Taylor expanded in b_2 around inf 33.8%
mul-1-neg33.8%
Simplified33.8%
Final simplification56.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(-0.5 * Float64(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[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $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}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\
\end{array}
\end{array}
if b_2 < -3.999999999999988e-310Initial program 28.2%
Taylor expanded in b_2 around -inf 78.6%
if -3.999999999999988e-310 < b_2 Initial program 89.9%
Taylor expanded in b_2 around inf 72.3%
*-commutative72.3%
Simplified72.3%
Final simplification75.4%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.1e-160) (/ 0.0 a) (/ (- b_2) a)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.1e-160) {
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 <= (-2.1d-160)) 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 <= -2.1e-160) {
tmp = 0.0 / a;
} else {
tmp = -b_2 / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.1e-160: tmp = 0.0 / a else: tmp = -b_2 / a return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.1e-160) 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 <= -2.1e-160) 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, -2.1e-160], N[(0.0 / a), $MachinePrecision], N[((-b$95$2) / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.1 \cdot 10^{-160}:\\
\;\;\;\;\frac{0}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-b_2}{a}\\
\end{array}
\end{array}
if b_2 < -2.1e-160Initial program 21.6%
add-sqr-sqrt17.4%
pow217.4%
pow1/217.4%
sqrt-pow117.5%
metadata-eval17.5%
Applied egg-rr17.5%
Taylor expanded in b_2 around -inf 20.4%
distribute-lft1-in20.4%
metadata-eval20.4%
mul0-lft20.4%
Simplified20.4%
if -2.1e-160 < b_2 Initial program 86.0%
add-sqr-sqrt85.7%
pow285.7%
pow1/285.7%
sqrt-pow185.7%
metadata-eval85.7%
Applied egg-rr85.7%
Taylor expanded in b_2 around inf 29.5%
mul-1-neg29.5%
Simplified29.5%
Final simplification25.7%
(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 59.3%
add-sqr-sqrt57.4%
pow257.4%
pow1/257.4%
sqrt-pow157.5%
metadata-eval57.5%
Applied egg-rr57.5%
Taylor expanded in b_2 around -inf 9.8%
distribute-lft1-in9.8%
metadata-eval9.8%
mul0-lft9.8%
Simplified9.8%
Final simplification9.8%
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))