
(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 13 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 -8.8e+38)
(+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2)))
(if (<= b_2 9.8e-60)
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
(/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -8.8e+38) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 9.8e-60) {
tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
} else {
tmp = (c * -0.5) / 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 <= (-8.8d+38)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 9.8d-60) then
tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -8.8e+38) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 9.8e-60) {
tmp = (Math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -8.8e+38: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 9.8e-60: tmp = (math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -8.8e+38) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 9.8e-60) tmp = Float64(Float64(sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c))) - b_2) / a); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -8.8e+38) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 9.8e-60) tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a; else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -8.8e+38], 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.8e-60], 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 * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -8.8 \cdot 10^{+38}:\\
\;\;\;\;-2 \cdot \frac{b\_2}{a} + 0.5 \cdot \frac{c}{b\_2}\\
\mathbf{elif}\;b\_2 \leq 9.8 \cdot 10^{-60}:\\
\;\;\;\;\frac{\sqrt{b\_2 \cdot b\_2 - a \cdot c} - b\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b\_2}\\
\end{array}
\end{array}
if b_2 < -8.80000000000000026e38Initial program 62.6%
+-commutative62.6%
unsub-neg62.6%
Simplified62.6%
Taylor expanded in b_2 around -inf 90.6%
associate-*r*90.6%
neg-mul-190.6%
associate-/l*92.9%
Simplified92.9%
Taylor expanded in a around inf 93.3%
if -8.80000000000000026e38 < b_2 < 9.79999999999999977e-60Initial program 79.8%
if 9.79999999999999977e-60 < b_2 Initial program 19.3%
+-commutative19.3%
unsub-neg19.3%
Simplified19.3%
Taylor expanded in b_2 around inf 89.3%
associate-*r/89.3%
*-commutative89.3%
Simplified89.3%
Final simplification87.2%
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -8.8e+38)
(+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2)))
(if (<= b_2 1.3e-56)
(/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
(/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -8.8e+38) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 1.3e-56) {
tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
} else {
tmp = (c * -0.5) / 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 <= (-8.8d+38)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 1.3d-56) then
tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -8.8e+38) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 1.3e-56) {
tmp = (Math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -8.8e+38: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 1.3e-56: tmp = (math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -8.8e+38) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 1.3e-56) tmp = Float64(Float64(sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c))) - b_2) / a); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -8.8e+38) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 1.3e-56) tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a; else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -8.8e+38], 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, 1.3e-56], 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 * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -8.8 \cdot 10^{+38}:\\
\;\;\;\;-2 \cdot \frac{b\_2}{a} + 0.5 \cdot \frac{c}{b\_2}\\
\mathbf{elif}\;b\_2 \leq 1.3 \cdot 10^{-56}:\\
\;\;\;\;\frac{\sqrt{b\_2 \cdot b\_2 - a \cdot c} - b\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b\_2}\\
\end{array}
\end{array}
if b_2 < -8.80000000000000026e38Initial program 62.6%
+-commutative62.6%
unsub-neg62.6%
Simplified62.6%
Taylor expanded in b_2 around -inf 90.6%
associate-*r*90.6%
neg-mul-190.6%
associate-/l*92.9%
Simplified92.9%
Taylor expanded in a around inf 93.3%
if -8.80000000000000026e38 < b_2 < 1.29999999999999998e-56Initial program 79.8%
+-commutative79.8%
unsub-neg79.8%
Simplified79.8%
if 1.29999999999999998e-56 < b_2 Initial program 19.3%
+-commutative19.3%
unsub-neg19.3%
Simplified19.3%
Taylor expanded in b_2 around inf 89.3%
associate-*r/89.3%
*-commutative89.3%
Simplified89.3%
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -4.1e-82)
(+ (* -2.0 (/ b_2 a)) (/ 0.5 (/ b_2 c)))
(if (<= b_2 1.25e-56)
(- (/ (sqrt (* a (- c))) a) (/ b_2 a))
(/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -4.1e-82) {
tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c));
} else if (b_2 <= 1.25e-56) {
tmp = (sqrt((a * -c)) / a) - (b_2 / a);
} else {
tmp = (c * -0.5) / 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 <= (-4.1d-82)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 / (b_2 / c))
else if (b_2 <= 1.25d-56) then
tmp = (sqrt((a * -c)) / a) - (b_2 / a)
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -4.1e-82) {
tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c));
} else if (b_2 <= 1.25e-56) {
tmp = (Math.sqrt((a * -c)) / a) - (b_2 / a);
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -4.1e-82: tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c)) elif b_2 <= 1.25e-56: tmp = (math.sqrt((a * -c)) / a) - (b_2 / a) else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -4.1e-82) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 / Float64(b_2 / c))); elseif (b_2 <= 1.25e-56) tmp = Float64(Float64(sqrt(Float64(a * Float64(-c))) / a) - Float64(b_2 / a)); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -4.1e-82) tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c)); elseif (b_2 <= 1.25e-56) tmp = (sqrt((a * -c)) / a) - (b_2 / a); else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -4.1e-82], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 / N[(b$95$2 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 1.25e-56], N[(N[(N[Sqrt[N[(a * (-c)), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision] - N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -4.1 \cdot 10^{-82}:\\
\;\;\;\;-2 \cdot \frac{b\_2}{a} + \frac{0.5}{\frac{b\_2}{c}}\\
\mathbf{elif}\;b\_2 \leq 1.25 \cdot 10^{-56}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(-c\right)}}{a} - \frac{b\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b\_2}\\
\end{array}
\end{array}
if b_2 < -4.09999999999999996e-82Initial program 71.0%
+-commutative71.0%
unsub-neg71.0%
Simplified71.0%
Taylor expanded in b_2 around -inf 84.7%
associate-*r*84.7%
neg-mul-184.7%
associate-/l*86.4%
Simplified86.4%
Taylor expanded in a around inf 86.7%
clear-num86.7%
un-div-inv86.7%
Applied egg-rr86.7%
if -4.09999999999999996e-82 < b_2 < 1.24999999999999999e-56Initial program 72.5%
+-commutative72.5%
unsub-neg72.5%
Simplified72.5%
prod-diff71.9%
*-commutative71.9%
fma-neg71.9%
prod-diff71.9%
*-commutative71.9%
fma-neg71.9%
associate-+l+71.9%
pow271.9%
*-commutative71.9%
fma-undefine71.9%
distribute-lft-neg-in71.9%
*-commutative71.9%
distribute-rgt-neg-in71.9%
fma-define71.9%
*-commutative71.9%
fma-undefine71.9%
distribute-lft-neg-in71.9%
*-commutative71.9%
distribute-rgt-neg-in71.9%
Applied egg-rr71.9%
associate-+l-71.9%
count-271.9%
Simplified71.9%
Taylor expanded in b_2 around 0 71.8%
+-commutative71.8%
mul-1-neg71.8%
unsub-neg71.8%
associate-*l/71.9%
*-lft-identity71.9%
distribute-lft1-in71.9%
metadata-eval71.9%
mul0-lft72.5%
metadata-eval72.5%
neg-sub072.5%
distribute-rgt-neg-out72.5%
Simplified72.5%
if 1.24999999999999999e-56 < b_2 Initial program 19.3%
+-commutative19.3%
unsub-neg19.3%
Simplified19.3%
Taylor expanded in b_2 around inf 89.3%
associate-*r/89.3%
*-commutative89.3%
Simplified89.3%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.15e-85) (+ (* -2.0 (/ b_2 a)) (/ 0.5 (/ b_2 c))) (if (<= b_2 2.5e-55) (/ (- (sqrt (* a (- c))) b_2) a) (/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.15e-85) {
tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c));
} else if (b_2 <= 2.5e-55) {
tmp = (sqrt((a * -c)) - b_2) / a;
} else {
tmp = (c * -0.5) / 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 <= (-2.15d-85)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 / (b_2 / c))
else if (b_2 <= 2.5d-55) then
tmp = (sqrt((a * -c)) - b_2) / a
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.15e-85) {
tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c));
} else if (b_2 <= 2.5e-55) {
tmp = (Math.sqrt((a * -c)) - b_2) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.15e-85: tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c)) elif b_2 <= 2.5e-55: tmp = (math.sqrt((a * -c)) - b_2) / a else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.15e-85) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 / Float64(b_2 / c))); elseif (b_2 <= 2.5e-55) tmp = Float64(Float64(sqrt(Float64(a * Float64(-c))) - b_2) / a); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -2.15e-85) tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c)); elseif (b_2 <= 2.5e-55) tmp = (sqrt((a * -c)) - b_2) / a; else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.15e-85], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 / N[(b$95$2 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 2.5e-55], N[(N[(N[Sqrt[N[(a * (-c)), $MachinePrecision]], $MachinePrecision] - b$95$2), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -2.15 \cdot 10^{-85}:\\
\;\;\;\;-2 \cdot \frac{b\_2}{a} + \frac{0.5}{\frac{b\_2}{c}}\\
\mathbf{elif}\;b\_2 \leq 2.5 \cdot 10^{-55}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(-c\right)} - b\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b\_2}\\
\end{array}
\end{array}
if b_2 < -2.14999999999999999e-85Initial program 71.0%
+-commutative71.0%
unsub-neg71.0%
Simplified71.0%
Taylor expanded in b_2 around -inf 84.7%
associate-*r*84.7%
neg-mul-184.7%
associate-/l*86.4%
Simplified86.4%
Taylor expanded in a around inf 86.7%
clear-num86.7%
un-div-inv86.7%
Applied egg-rr86.7%
if -2.14999999999999999e-85 < b_2 < 2.5000000000000001e-55Initial program 72.5%
+-commutative72.5%
unsub-neg72.5%
Simplified72.5%
Taylor expanded in b_2 around 0 72.4%
associate-*r*72.4%
neg-mul-172.4%
*-commutative72.4%
Simplified72.4%
if 2.5000000000000001e-55 < b_2 Initial program 19.3%
+-commutative19.3%
unsub-neg19.3%
Simplified19.3%
Taylor expanded in b_2 around inf 89.3%
associate-*r/89.3%
*-commutative89.3%
Simplified89.3%
Final simplification84.0%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -5e-83) (+ (* -2.0 (/ b_2 a)) (/ 0.5 (/ b_2 c))) (if (<= b_2 1.05e-60) (/ (sqrt (* a (- c))) a) (/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-83) {
tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c));
} else if (b_2 <= 1.05e-60) {
tmp = sqrt((a * -c)) / a;
} else {
tmp = (c * -0.5) / 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-83)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 / (b_2 / c))
else if (b_2 <= 1.05d-60) then
tmp = sqrt((a * -c)) / a
else
tmp = (c * (-0.5d0)) / 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-83) {
tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c));
} else if (b_2 <= 1.05e-60) {
tmp = Math.sqrt((a * -c)) / a;
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -5e-83: tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c)) elif b_2 <= 1.05e-60: tmp = math.sqrt((a * -c)) / a else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -5e-83) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 / Float64(b_2 / c))); elseif (b_2 <= 1.05e-60) tmp = Float64(sqrt(Float64(a * Float64(-c))) / a); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -5e-83) tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c)); elseif (b_2 <= 1.05e-60) tmp = sqrt((a * -c)) / a; else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -5e-83], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 / N[(b$95$2 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 1.05e-60], N[(N[Sqrt[N[(a * (-c)), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -5 \cdot 10^{-83}:\\
\;\;\;\;-2 \cdot \frac{b\_2}{a} + \frac{0.5}{\frac{b\_2}{c}}\\
\mathbf{elif}\;b\_2 \leq 1.05 \cdot 10^{-60}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(-c\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b\_2}\\
\end{array}
\end{array}
if b_2 < -5e-83Initial program 71.0%
+-commutative71.0%
unsub-neg71.0%
Simplified71.0%
Taylor expanded in b_2 around -inf 84.7%
associate-*r*84.7%
neg-mul-184.7%
associate-/l*86.4%
Simplified86.4%
Taylor expanded in a around inf 86.7%
clear-num86.7%
un-div-inv86.7%
Applied egg-rr86.7%
if -5e-83 < b_2 < 1.04999999999999996e-60Initial program 72.5%
+-commutative72.5%
unsub-neg72.5%
Simplified72.5%
prod-diff71.9%
*-commutative71.9%
fma-neg71.9%
prod-diff71.9%
*-commutative71.9%
fma-neg71.9%
associate-+l+71.9%
pow271.9%
*-commutative71.9%
fma-undefine71.9%
distribute-lft-neg-in71.9%
*-commutative71.9%
distribute-rgt-neg-in71.9%
fma-define71.9%
*-commutative71.9%
fma-undefine71.9%
distribute-lft-neg-in71.9%
*-commutative71.9%
distribute-rgt-neg-in71.9%
Applied egg-rr71.9%
associate-+l-71.9%
count-271.9%
Simplified71.9%
Taylor expanded in c around inf 71.3%
associate-*l/71.4%
*-lft-identity71.4%
distribute-rgt1-in71.4%
metadata-eval71.4%
mul0-lft71.4%
metadata-eval71.4%
neg-sub071.4%
Simplified71.4%
if 1.04999999999999996e-60 < b_2 Initial program 19.3%
+-commutative19.3%
unsub-neg19.3%
Simplified19.3%
Taylor expanded in b_2 around inf 89.3%
associate-*r/89.3%
*-commutative89.3%
Simplified89.3%
Final simplification83.7%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -7.6e-81) (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))) (if (<= b_2 2.7e-144) (sqrt (/ c (- a))) (/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -7.6e-81) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 2.7e-144) {
tmp = sqrt((c / -a));
} else {
tmp = (c * -0.5) / 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 <= (-7.6d-81)) then
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else if (b_2 <= 2.7d-144) then
tmp = sqrt((c / -a))
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -7.6e-81) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else if (b_2 <= 2.7e-144) {
tmp = Math.sqrt((c / -a));
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -7.6e-81: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) elif b_2 <= 2.7e-144: tmp = math.sqrt((c / -a)) else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -7.6e-81) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); elseif (b_2 <= 2.7e-144) tmp = sqrt(Float64(c / Float64(-a))); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -7.6e-81) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); elseif (b_2 <= 2.7e-144) tmp = sqrt((c / -a)); else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -7.6e-81], 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, 2.7e-144], N[Sqrt[N[(c / (-a)), $MachinePrecision]], $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -7.6 \cdot 10^{-81}:\\
\;\;\;\;-2 \cdot \frac{b\_2}{a} + 0.5 \cdot \frac{c}{b\_2}\\
\mathbf{elif}\;b\_2 \leq 2.7 \cdot 10^{-144}:\\
\;\;\;\;\sqrt{\frac{c}{-a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b\_2}\\
\end{array}
\end{array}
if b_2 < -7.5999999999999997e-81Initial program 71.6%
+-commutative71.6%
unsub-neg71.6%
Simplified71.6%
Taylor expanded in b_2 around -inf 85.4%
associate-*r*85.4%
neg-mul-185.4%
associate-/l*87.1%
Simplified87.1%
Taylor expanded in a around inf 87.5%
if -7.5999999999999997e-81 < b_2 < 2.69999999999999975e-144Initial program 76.4%
+-commutative76.4%
unsub-neg76.4%
Simplified76.4%
prod-diff75.8%
*-commutative75.8%
fma-neg75.8%
prod-diff75.8%
*-commutative75.8%
fma-neg75.8%
associate-+l+75.7%
pow275.7%
*-commutative75.7%
fma-undefine75.8%
distribute-lft-neg-in75.8%
*-commutative75.8%
distribute-rgt-neg-in75.8%
fma-define75.7%
*-commutative75.7%
fma-undefine75.8%
distribute-lft-neg-in75.8%
*-commutative75.8%
distribute-rgt-neg-in75.8%
Applied egg-rr75.7%
associate-+l-75.7%
count-275.7%
Simplified75.7%
Taylor expanded in a around inf 39.5%
div-sub39.5%
distribute-rgt1-in39.5%
metadata-eval39.5%
mul0-lft39.5%
mul0-lft39.5%
metadata-eval39.5%
distribute-rgt1-in39.5%
distribute-rgt1-in39.5%
metadata-eval39.5%
mul0-lft39.5%
metadata-eval39.5%
div-sub39.5%
neg-sub039.5%
neg-mul-139.5%
associate-/l*39.5%
mul-1-neg39.5%
Simplified39.5%
if 2.69999999999999975e-144 < b_2 Initial program 24.9%
+-commutative24.9%
unsub-neg24.9%
Simplified24.9%
Taylor expanded in b_2 around inf 80.1%
associate-*r/80.2%
*-commutative80.2%
Simplified80.2%
Final simplification75.4%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -5e-310) (+ (* -2.0 (/ b_2 a)) (/ 0.5 (/ b_2 c))) (/ (* c -0.5) b_2)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c));
} else {
tmp = (c * -0.5) / 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 = ((-2.0d0) * (b_2 / a)) + (0.5d0 / (b_2 / c))
else
tmp = (c * (-0.5d0)) / 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 = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c));
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -5e-310: tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c)) else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -5e-310) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 / Float64(b_2 / c))); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -5e-310) tmp = (-2.0 * (b_2 / a)) + (0.5 / (b_2 / c)); else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -5e-310], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 / N[(b$95$2 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \frac{b\_2}{a} + \frac{0.5}{\frac{b\_2}{c}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b\_2}\\
\end{array}
\end{array}
if b_2 < -4.999999999999985e-310Initial program 73.0%
+-commutative73.0%
unsub-neg73.0%
Simplified73.0%
Taylor expanded in b_2 around -inf 65.8%
associate-*r*65.8%
neg-mul-165.8%
associate-/l*67.1%
Simplified67.1%
Taylor expanded in a around inf 68.2%
clear-num68.2%
un-div-inv68.2%
Applied egg-rr68.2%
if -4.999999999999985e-310 < b_2 Initial program 31.6%
+-commutative31.6%
unsub-neg31.6%
Simplified31.6%
Taylor expanded in b_2 around inf 69.8%
associate-*r/69.9%
*-commutative69.9%
Simplified69.9%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -5e-310) (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))) (/ (* c -0.5) b_2)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -5e-310) {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else {
tmp = (c * -0.5) / 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 = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
else
tmp = (c * (-0.5d0)) / 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 = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -5e-310: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -5e-310) tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2))); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -5e-310) tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -5e-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 * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \frac{b\_2}{a} + 0.5 \cdot \frac{c}{b\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b\_2}\\
\end{array}
\end{array}
if b_2 < -4.999999999999985e-310Initial program 73.0%
+-commutative73.0%
unsub-neg73.0%
Simplified73.0%
Taylor expanded in b_2 around -inf 65.8%
associate-*r*65.8%
neg-mul-165.8%
associate-/l*67.1%
Simplified67.1%
Taylor expanded in a around inf 68.2%
if -4.999999999999985e-310 < b_2 Initial program 31.6%
+-commutative31.6%
unsub-neg31.6%
Simplified31.6%
Taylor expanded in b_2 around inf 69.8%
associate-*r/69.9%
*-commutative69.9%
Simplified69.9%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 2.6e-308) (* -2.0 (/ b_2 a)) (/ (* c -0.5) b_2)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 2.6e-308) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = (c * -0.5) / 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 <= 2.6d-308) then
tmp = (-2.0d0) * (b_2 / a)
else
tmp = (c * (-0.5d0)) / b_2
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 2.6e-308) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = (c * -0.5) / b_2;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= 2.6e-308: tmp = -2.0 * (b_2 / a) else: tmp = (c * -0.5) / b_2 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= 2.6e-308) tmp = Float64(-2.0 * Float64(b_2 / a)); else tmp = Float64(Float64(c * -0.5) / b_2); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= 2.6e-308) tmp = -2.0 * (b_2 / a); else tmp = (c * -0.5) / b_2; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, 2.6e-308], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq 2.6 \cdot 10^{-308}:\\
\;\;\;\;-2 \cdot \frac{b\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b\_2}\\
\end{array}
\end{array}
if b_2 < 2.6e-308Initial program 73.2%
+-commutative73.2%
unsub-neg73.2%
Simplified73.2%
Taylor expanded in b_2 around -inf 67.5%
if 2.6e-308 < b_2 Initial program 31.0%
+-commutative31.0%
unsub-neg31.0%
Simplified31.0%
Taylor expanded in b_2 around inf 70.4%
associate-*r/70.5%
*-commutative70.5%
Simplified70.5%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 2.6e-308) (* -2.0 (/ b_2 a)) (* c (/ -0.5 b_2))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 2.6e-308) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = c * (-0.5 / 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 <= 2.6d-308) then
tmp = (-2.0d0) * (b_2 / a)
else
tmp = c * ((-0.5d0) / b_2)
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 2.6e-308) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = c * (-0.5 / b_2);
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= 2.6e-308: tmp = -2.0 * (b_2 / a) else: tmp = c * (-0.5 / b_2) return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= 2.6e-308) tmp = Float64(-2.0 * Float64(b_2 / a)); else tmp = Float64(c * Float64(-0.5 / b_2)); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= 2.6e-308) tmp = -2.0 * (b_2 / a); else tmp = c * (-0.5 / b_2); end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, 2.6e-308], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b$95$2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq 2.6 \cdot 10^{-308}:\\
\;\;\;\;-2 \cdot \frac{b\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b\_2}\\
\end{array}
\end{array}
if b_2 < 2.6e-308Initial program 73.2%
+-commutative73.2%
unsub-neg73.2%
Simplified73.2%
Taylor expanded in b_2 around -inf 67.5%
if 2.6e-308 < b_2 Initial program 31.0%
+-commutative31.0%
unsub-neg31.0%
Simplified31.0%
div-sub29.8%
add-sqr-sqrt25.9%
associate-/l*26.1%
fma-neg23.8%
pow1/223.8%
sqrt-pow123.8%
pow223.8%
metadata-eval23.8%
pow1/223.8%
sqrt-pow123.8%
pow223.8%
metadata-eval23.8%
Applied egg-rr23.8%
distribute-neg-frac223.8%
Simplified23.8%
Taylor expanded in b_2 around inf 70.4%
associate-*r/70.5%
associate-*l/70.2%
*-commutative70.2%
Simplified70.2%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 2.6e-308) (* -2.0 (/ b_2 a)) 0.0))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 2.6e-308) {
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.6d-308) 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.6e-308) {
tmp = -2.0 * (b_2 / a);
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= 2.6e-308: 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.6e-308) 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.6e-308) 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.6e-308], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq 2.6 \cdot 10^{-308}:\\
\;\;\;\;-2 \cdot \frac{b\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b_2 < 2.6e-308Initial program 73.2%
+-commutative73.2%
unsub-neg73.2%
Simplified73.2%
Taylor expanded in b_2 around -inf 67.5%
if 2.6e-308 < b_2 Initial program 31.0%
+-commutative31.0%
unsub-neg31.0%
Simplified31.0%
div-sub29.8%
add-sqr-sqrt25.9%
associate-/l*26.1%
fma-neg23.8%
pow1/223.8%
sqrt-pow123.8%
pow223.8%
metadata-eval23.8%
pow1/223.8%
sqrt-pow123.8%
pow223.8%
metadata-eval23.8%
Applied egg-rr23.8%
distribute-neg-frac223.8%
Simplified23.8%
Taylor expanded in c around 0 21.3%
distribute-lft1-in21.3%
metadata-eval21.3%
mul0-lft25.4%
Simplified25.4%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 2.6e-308) (- (/ b_2 a)) 0.0))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= 2.6e-308) {
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.6d-308) 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.6e-308) {
tmp = -(b_2 / a);
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= 2.6e-308: tmp = -(b_2 / a) else: tmp = 0.0 return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= 2.6e-308) 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.6e-308) 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.6e-308], (-N[(b$95$2 / a), $MachinePrecision]), 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq 2.6 \cdot 10^{-308}:\\
\;\;\;\;-\frac{b\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if b_2 < 2.6e-308Initial program 73.2%
+-commutative73.2%
unsub-neg73.2%
Simplified73.2%
prod-diff72.9%
*-commutative72.9%
fma-neg72.9%
prod-diff72.9%
*-commutative72.9%
fma-neg72.9%
associate-+l+72.9%
pow272.9%
*-commutative72.9%
fma-undefine72.9%
distribute-lft-neg-in72.9%
*-commutative72.9%
distribute-rgt-neg-in72.9%
fma-define72.9%
*-commutative72.9%
fma-undefine72.9%
distribute-lft-neg-in72.9%
*-commutative72.9%
distribute-rgt-neg-in72.9%
Applied egg-rr72.9%
associate-+l-72.9%
count-272.9%
Simplified72.9%
Taylor expanded in b_2 around 0 39.7%
+-commutative39.7%
mul-1-neg39.7%
unsub-neg39.7%
associate-*l/39.7%
*-lft-identity39.7%
distribute-lft1-in39.7%
metadata-eval39.7%
mul0-lft40.0%
metadata-eval40.0%
neg-sub040.0%
distribute-rgt-neg-out40.0%
Simplified40.0%
Taylor expanded in b_2 around inf 28.0%
associate-*r/28.0%
neg-mul-128.0%
Simplified28.0%
if 2.6e-308 < b_2 Initial program 31.0%
+-commutative31.0%
unsub-neg31.0%
Simplified31.0%
div-sub29.8%
add-sqr-sqrt25.9%
associate-/l*26.1%
fma-neg23.8%
pow1/223.8%
sqrt-pow123.8%
pow223.8%
metadata-eval23.8%
pow1/223.8%
sqrt-pow123.8%
pow223.8%
metadata-eval23.8%
Applied egg-rr23.8%
distribute-neg-frac223.8%
Simplified23.8%
Taylor expanded in c around 0 21.3%
distribute-lft1-in21.3%
metadata-eval21.3%
mul0-lft25.4%
Simplified25.4%
Final simplification26.9%
(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.2%
+-commutative55.2%
unsub-neg55.2%
Simplified55.2%
div-sub54.7%
add-sqr-sqrt52.9%
associate-/l*53.0%
fma-neg52.1%
pow1/252.1%
sqrt-pow152.1%
pow252.1%
metadata-eval52.1%
pow1/252.1%
sqrt-pow152.1%
pow252.1%
metadata-eval52.1%
Applied egg-rr52.1%
distribute-neg-frac252.1%
Simplified52.1%
Taylor expanded in c around 0 10.4%
distribute-lft1-in10.4%
metadata-eval10.4%
mul0-lft12.3%
Simplified12.3%
(FPCore (a b_2 c)
:precision binary64
(let* ((t_0 (* (sqrt (fabs a)) (sqrt (fabs c))))
(t_1
(if (== (copysign a c) a)
(* (sqrt (- (fabs b_2) t_0)) (sqrt (+ (fabs b_2) t_0)))
(hypot b_2 t_0))))
(if (< b_2 0.0) (/ (- t_1 b_2) a) (/ (- c) (+ b_2 t_1)))))
double code(double a, double b_2, double c) {
double t_0 = sqrt(fabs(a)) * sqrt(fabs(c));
double tmp;
if (copysign(a, c) == a) {
tmp = sqrt((fabs(b_2) - t_0)) * sqrt((fabs(b_2) + t_0));
} else {
tmp = hypot(b_2, t_0);
}
double t_1 = tmp;
double tmp_1;
if (b_2 < 0.0) {
tmp_1 = (t_1 - b_2) / a;
} else {
tmp_1 = -c / (b_2 + t_1);
}
return tmp_1;
}
public static double code(double a, double b_2, double c) {
double t_0 = Math.sqrt(Math.abs(a)) * Math.sqrt(Math.abs(c));
double tmp;
if (Math.copySign(a, c) == a) {
tmp = Math.sqrt((Math.abs(b_2) - t_0)) * Math.sqrt((Math.abs(b_2) + t_0));
} else {
tmp = Math.hypot(b_2, t_0);
}
double t_1 = tmp;
double tmp_1;
if (b_2 < 0.0) {
tmp_1 = (t_1 - b_2) / a;
} else {
tmp_1 = -c / (b_2 + t_1);
}
return tmp_1;
}
def code(a, b_2, c): t_0 = math.sqrt(math.fabs(a)) * math.sqrt(math.fabs(c)) tmp = 0 if math.copysign(a, c) == a: tmp = math.sqrt((math.fabs(b_2) - t_0)) * math.sqrt((math.fabs(b_2) + t_0)) else: tmp = math.hypot(b_2, t_0) t_1 = tmp tmp_1 = 0 if b_2 < 0.0: tmp_1 = (t_1 - b_2) / a else: tmp_1 = -c / (b_2 + t_1) return tmp_1
function code(a, b_2, c) t_0 = Float64(sqrt(abs(a)) * sqrt(abs(c))) tmp = 0.0 if (copysign(a, c) == a) tmp = Float64(sqrt(Float64(abs(b_2) - t_0)) * sqrt(Float64(abs(b_2) + t_0))); else tmp = hypot(b_2, t_0); end t_1 = tmp tmp_1 = 0.0 if (b_2 < 0.0) tmp_1 = Float64(Float64(t_1 - b_2) / a); else tmp_1 = Float64(Float64(-c) / Float64(b_2 + t_1)); end return tmp_1 end
function tmp_3 = code(a, b_2, c) t_0 = sqrt(abs(a)) * sqrt(abs(c)); tmp = 0.0; if ((sign(c) * abs(a)) == a) tmp = sqrt((abs(b_2) - t_0)) * sqrt((abs(b_2) + t_0)); else tmp = hypot(b_2, t_0); end t_1 = tmp; tmp_2 = 0.0; if (b_2 < 0.0) tmp_2 = (t_1 - b_2) / a; else tmp_2 = -c / (b_2 + t_1); end tmp_3 = tmp_2; end
code[a_, b$95$2_, c_] := Block[{t$95$0 = N[(N[Sqrt[N[Abs[a], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Abs[c], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = If[Equal[N[With[{TMP1 = Abs[a], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], a], N[(N[Sqrt[N[(N[Abs[b$95$2], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(N[Abs[b$95$2], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[b$95$2 ^ 2 + t$95$0 ^ 2], $MachinePrecision]]}, If[Less[b$95$2, 0.0], N[(N[(t$95$1 - b$95$2), $MachinePrecision] / a), $MachinePrecision], N[((-c) / N[(b$95$2 + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\left|a\right|} \cdot \sqrt{\left|c\right|}\\
t_1 := \begin{array}{l}
\mathbf{if}\;\mathsf{copysign}\left(a, c\right) = a:\\
\;\;\;\;\sqrt{\left|b\_2\right| - t\_0} \cdot \sqrt{\left|b\_2\right| + t\_0}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(b\_2, t\_0\right)\\
\end{array}\\
\mathbf{if}\;b\_2 < 0:\\
\;\;\;\;\frac{t\_1 - b\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-c}{b\_2 + t\_1}\\
\end{array}
\end{array}
herbie shell --seed 2024103
(FPCore (a b_2 c)
:name "quad2p (problem 3.2.1, positive)"
:precision binary64
:herbie-expected 10
:alt
(if (< b_2 0.0) (/ (- (if (== (copysign a c) a) (* (sqrt (- (fabs b_2) (* (sqrt (fabs a)) (sqrt (fabs c))))) (sqrt (+ (fabs b_2) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (hypot b_2 (* (sqrt (fabs a)) (sqrt (fabs c))))) b_2) a) (/ (- c) (+ b_2 (if (== (copysign a c) a) (* (sqrt (- (fabs b_2) (* (sqrt (fabs a)) (sqrt (fabs c))))) (sqrt (+ (fabs b_2) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (hypot b_2 (* (sqrt (fabs a)) (sqrt (fabs c))))))))
(/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))