
(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 -1.85e+167)
(+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2)))
(if (<= b_2 6.5e+67)
(/ (- (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 <= -1.85e+167) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 6.5e+67) {
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 <= (-1.85d+167)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 6.5d+67) 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 <= -1.85e+167) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 6.5e+67) {
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 <= -1.85e+167: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 6.5e+67: 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 <= -1.85e+167) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 6.5e+67) 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 <= -1.85e+167) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 6.5e+67) 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, -1.85e+167], 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.5e+67], 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 -1.85 \cdot 10^{+167}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 6.5 \cdot 10^{+67}:\\
\;\;\;\;\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 < -1.85e167Initial program 36.1%
+-commutative36.1%
unsub-neg36.1%
Simplified36.1%
Taylor expanded in b_2 around -inf 98.2%
if -1.85e167 < b_2 < 6.4999999999999995e67Initial program 83.6%
+-commutative83.6%
unsub-neg83.6%
Simplified83.6%
if 6.4999999999999995e67 < b_2 Initial program 12.9%
+-commutative12.9%
unsub-neg12.9%
Simplified12.9%
Taylor expanded in b_2 around inf 91.6%
Final simplification88.6%
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -9e-128)
(+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2)))
(if (<= b_2 9.5e-24)
(/ (- (sqrt (/ c (/ -1.0 a))) b_2) a)
(* (/ c b_2) -0.5))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -9e-128) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 9.5e-24) {
tmp = (sqrt((c / (-1.0 / 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 <= (-9d-128)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 9.5d-24) then
tmp = (sqrt((c / ((-1.0d0) / 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 <= -9e-128) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 9.5e-24) {
tmp = (Math.sqrt((c / (-1.0 / a))) - b_2) / a;
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -9e-128: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 9.5e-24: tmp = (math.sqrt((c / (-1.0 / 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 <= -9e-128) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 9.5e-24) tmp = Float64(Float64(sqrt(Float64(c / Float64(-1.0 / a))) - 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 <= -9e-128) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 9.5e-24) tmp = (sqrt((c / (-1.0 / 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, -9e-128], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 9.5e-24], N[(N[(N[Sqrt[N[(c / N[(-1.0 / a), $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 -9 \cdot 10^{-128}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 9.5 \cdot 10^{-24}:\\
\;\;\;\;\frac{\sqrt{\frac{c}{\frac{-1}{a}}} - b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < -8.9999999999999998e-128Initial program 68.6%
+-commutative68.6%
unsub-neg68.6%
Simplified68.6%
Taylor expanded in b_2 around -inf 90.9%
if -8.9999999999999998e-128 < b_2 < 9.50000000000000029e-24Initial program 77.7%
+-commutative77.7%
unsub-neg77.7%
Simplified77.7%
pow1/277.7%
pow-to-exp73.3%
fma-neg73.3%
*-commutative73.3%
distribute-rgt-neg-in73.3%
Applied egg-rr73.3%
Taylor expanded in a around -inf 39.0%
mul-1-neg39.0%
unsub-neg39.0%
Simplified39.0%
exp-prod34.9%
unpow1/234.9%
diff-log72.6%
add-exp-log77.0%
Applied egg-rr77.0%
if 9.50000000000000029e-24 < b_2 Initial program 20.8%
+-commutative20.8%
unsub-neg20.8%
Simplified20.8%
Taylor expanded in b_2 around inf 84.9%
Final simplification85.6%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -9e-128) (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))) (if (<= b_2 7.9e-25) (/ (- (sqrt (* c (- a))) b_2) a) (* (/ c b_2) -0.5))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -9e-128) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 7.9e-25) {
tmp = (sqrt((c * -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 <= (-9d-128)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 7.9d-25) then
tmp = (sqrt((c * -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 <= -9e-128) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 7.9e-25) {
tmp = (Math.sqrt((c * -a)) - b_2) / a;
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -9e-128: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 7.9e-25: tmp = (math.sqrt((c * -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 <= -9e-128) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 7.9e-25) tmp = Float64(Float64(sqrt(Float64(c * Float64(-a))) - 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 <= -9e-128) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 7.9e-25) tmp = (sqrt((c * -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, -9e-128], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 7.9e-25], N[(N[(N[Sqrt[N[(c * (-a)), $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 \cdot 10^{-128}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 7.9 \cdot 10^{-25}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(-a\right)} - b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < -8.9999999999999998e-128Initial program 68.6%
+-commutative68.6%
unsub-neg68.6%
Simplified68.6%
Taylor expanded in b_2 around -inf 90.9%
if -8.9999999999999998e-128 < b_2 < 7.8999999999999997e-25Initial program 77.7%
+-commutative77.7%
unsub-neg77.7%
Simplified77.7%
Taylor expanded in b_2 around 0 77.0%
mul-1-neg77.0%
distribute-rgt-neg-out77.0%
Simplified77.0%
if 7.8999999999999997e-25 < b_2 Initial program 20.8%
+-commutative20.8%
unsub-neg20.8%
Simplified20.8%
Taylor expanded in b_2 around inf 84.9%
Final simplification85.6%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -8.6e-128) (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))) (if (<= b_2 7e-25) (/ (sqrt (* a (/ c -1.0))) a) (* (/ c b_2) -0.5))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -8.6e-128) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 7e-25) {
tmp = sqrt((a * (c / -1.0))) / 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 <= (-8.6d-128)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 7d-25) then
tmp = sqrt((a * (c / (-1.0d0)))) / 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 <= -8.6e-128) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 7e-25) {
tmp = Math.sqrt((a * (c / -1.0))) / a;
} else {
tmp = (c / b_2) * -0.5;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -8.6e-128: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 7e-25: tmp = math.sqrt((a * (c / -1.0))) / a else: tmp = (c / b_2) * -0.5 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -8.6e-128) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 7e-25) tmp = Float64(sqrt(Float64(a * Float64(c / -1.0))) / 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 <= -8.6e-128) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 7e-25) tmp = sqrt((a * (c / -1.0))) / a; else tmp = (c / b_2) * -0.5; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -8.6e-128], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 7e-25], N[(N[Sqrt[N[(a * N[(c / -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision], N[(N[(c / b$95$2), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -8.6 \cdot 10^{-128}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\
\mathbf{elif}\;b_2 \leq 7 \cdot 10^{-25}:\\
\;\;\;\;\frac{\sqrt{a \cdot \frac{c}{-1}}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < -8.59999999999999988e-128Initial program 68.6%
+-commutative68.6%
unsub-neg68.6%
Simplified68.6%
Taylor expanded in b_2 around -inf 90.9%
if -8.59999999999999988e-128 < b_2 < 7.0000000000000004e-25Initial program 77.7%
+-commutative77.7%
unsub-neg77.7%
Simplified77.7%
pow1/277.7%
pow-to-exp73.3%
fma-neg73.3%
*-commutative73.3%
distribute-rgt-neg-in73.3%
Applied egg-rr73.3%
Taylor expanded in a around -inf 39.0%
mul-1-neg39.0%
unsub-neg39.0%
Simplified39.0%
Taylor expanded in b_2 around 0 38.7%
log-div0.0%
sub-neg0.0%
log-rec0.0%
log-rec0.0%
sub-neg0.0%
remove-double-neg0.0%
log-rec0.0%
mul-1-neg0.0%
log-div38.7%
Simplified76.5%
if 7.0000000000000004e-25 < b_2 Initial program 20.8%
+-commutative20.8%
unsub-neg20.8%
Simplified20.8%
Taylor expanded in b_2 around inf 84.9%
Final simplification85.5%
(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 72.1%
+-commutative72.1%
unsub-neg72.1%
Simplified72.1%
Taylor expanded in b_2 around -inf 78.0%
if -1.999999999999994e-310 < b_2 Initial program 38.1%
+-commutative38.1%
unsub-neg38.1%
Simplified38.1%
Taylor expanded in b_2 around inf 62.8%
Final simplification70.7%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.25e-269) (* -2.0 (/ b_2 a)) 0.0))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.25e-269) {
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 <= (-2.25d-269)) 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 <= -2.25e-269) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.25e-269: tmp = -2.0 * (b_2 / a) else: tmp = 0.0 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.25e-269) 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 <= -2.25e-269) 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, -2.25e-269], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.25 \cdot 10^{-269}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b_2 < -2.2500000000000001e-269Initial program 71.2%
+-commutative71.2%
unsub-neg71.2%
Simplified71.2%
Taylor expanded in b_2 around -inf 80.0%
if -2.2500000000000001e-269 < b_2 Initial program 40.1%
+-commutative40.1%
unsub-neg40.1%
Simplified40.1%
div-sub39.0%
add-sqr-sqrt38.0%
*-un-lft-identity38.0%
times-frac35.7%
fma-neg34.8%
Applied egg-rr34.8%
Taylor expanded in b_2 around inf 11.7%
distribute-rgt1-in11.7%
metadata-eval11.7%
mul0-lft19.2%
Simplified19.2%
Final simplification50.1%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 1.5e-239) (* -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.5e-239) {
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.5d-239) 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.5e-239) {
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.5e-239: 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.5e-239) 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.5e-239) 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.5e-239], 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.5 \cdot 10^{-239}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\
\end{array}
\end{array}
if b_2 < 1.4999999999999999e-239Initial program 73.0%
+-commutative73.0%
unsub-neg73.0%
Simplified73.0%
Taylor expanded in b_2 around -inf 72.1%
if 1.4999999999999999e-239 < b_2 Initial program 33.6%
+-commutative33.6%
unsub-neg33.6%
Simplified33.6%
Taylor expanded in b_2 around inf 68.6%
Final simplification70.6%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.25e-269) (/ (- b_2) a) 0.0))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.25e-269) {
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 <= (-2.25d-269)) 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 <= -2.25e-269) {
tmp = -b_2 / a;
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.25e-269: tmp = -b_2 / a else: tmp = 0.0 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.25e-269) 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 <= -2.25e-269) tmp = -b_2 / a; else tmp = 0.0; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.25e-269], N[((-b$95$2) / a), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.25 \cdot 10^{-269}:\\
\;\;\;\;\frac{-b_2}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b_2 < -2.2500000000000001e-269Initial program 71.2%
+-commutative71.2%
unsub-neg71.2%
Simplified71.2%
div-sub71.2%
add-sqr-sqrt71.0%
*-un-lft-identity71.0%
times-frac71.0%
fma-neg71.0%
Applied egg-rr71.2%
Taylor expanded in b_2 around inf 32.2%
associate-*r/32.2%
neg-mul-132.2%
Simplified32.2%
if -2.2500000000000001e-269 < b_2 Initial program 40.1%
+-commutative40.1%
unsub-neg40.1%
Simplified40.1%
div-sub39.0%
add-sqr-sqrt38.0%
*-un-lft-identity38.0%
times-frac35.7%
fma-neg34.8%
Applied egg-rr34.8%
Taylor expanded in b_2 around inf 11.7%
distribute-rgt1-in11.7%
metadata-eval11.7%
mul0-lft19.2%
Simplified19.2%
Final simplification25.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 55.9%
+-commutative55.9%
unsub-neg55.9%
Simplified55.9%
div-sub55.4%
add-sqr-sqrt54.8%
*-un-lft-identity54.8%
times-frac53.6%
fma-neg53.2%
Applied egg-rr53.3%
Taylor expanded in b_2 around inf 6.9%
distribute-rgt1-in6.9%
metadata-eval6.9%
mul0-lft10.8%
Simplified10.8%
Final simplification10.8%
herbie shell --seed 2023221
(FPCore (a b_2 c)
:name "quad2p (problem 3.2.1, positive)"
:precision binary64
(/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))