
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b_2 c) :precision binary64 (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
double code(double a, double b_2, double c) {
return (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
code = (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a
end function
public static double code(double a, double b_2, double c) {
return (-b_2 - Math.sqrt(((b_2 * b_2) - (a * c)))) / a;
}
def code(a, b_2, c): return (-b_2 - math.sqrt(((b_2 * b_2) - (a * c)))) / a
function code(a, b_2, c) return Float64(Float64(Float64(-b_2) - sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))) / a) end
function tmp = code(a, b_2, c) tmp = (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a; end
code[a_, b$95$2_, c_] := N[(N[((-b$95$2) - N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\_2\right) - \sqrt{b\_2 \cdot b\_2 - a \cdot c}}{a}
\end{array}
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -3.2e-70)
(/ (* -0.5 c) b_2)
(if (<= b_2 -1.65e-260)
(/ (sqrt (* c (- a))) (- a))
(if (<= b_2 -2.5e-307)
(- (sqrt (/ c (- a))))
(if (<= b_2 1.4e+26)
(/ (- (- b_2) (pow (- (pow b_2 2.0) (* c a)) 0.5)) a)
(/ (* b_2 -2.0) a))))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -3.2e-70) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= -1.65e-260) {
tmp = sqrt((c * -a)) / -a;
} else if (b_2 <= -2.5e-307) {
tmp = -sqrt((c / -a));
} else if (b_2 <= 1.4e+26) {
tmp = (-b_2 - pow((pow(b_2, 2.0) - (c * a)), 0.5)) / 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 <= (-3.2d-70)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= (-1.65d-260)) then
tmp = sqrt((c * -a)) / -a
else if (b_2 <= (-2.5d-307)) then
tmp = -sqrt((c / -a))
else if (b_2 <= 1.4d+26) then
tmp = (-b_2 - (((b_2 ** 2.0d0) - (c * a)) ** 0.5d0)) / 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 <= -3.2e-70) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= -1.65e-260) {
tmp = Math.sqrt((c * -a)) / -a;
} else if (b_2 <= -2.5e-307) {
tmp = -Math.sqrt((c / -a));
} else if (b_2 <= 1.4e+26) {
tmp = (-b_2 - Math.pow((Math.pow(b_2, 2.0) - (c * a)), 0.5)) / a;
} else {
tmp = (b_2 * -2.0) / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -3.2e-70: tmp = (-0.5 * c) / b_2 elif b_2 <= -1.65e-260: tmp = math.sqrt((c * -a)) / -a elif b_2 <= -2.5e-307: tmp = -math.sqrt((c / -a)) elif b_2 <= 1.4e+26: tmp = (-b_2 - math.pow((math.pow(b_2, 2.0) - (c * a)), 0.5)) / a else: tmp = (b_2 * -2.0) / a return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -3.2e-70) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= -1.65e-260) tmp = Float64(sqrt(Float64(c * Float64(-a))) / Float64(-a)); elseif (b_2 <= -2.5e-307) tmp = Float64(-sqrt(Float64(c / Float64(-a)))); elseif (b_2 <= 1.4e+26) tmp = Float64(Float64(Float64(-b_2) - (Float64((b_2 ^ 2.0) - Float64(c * a)) ^ 0.5)) / 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 <= -3.2e-70) tmp = (-0.5 * c) / b_2; elseif (b_2 <= -1.65e-260) tmp = sqrt((c * -a)) / -a; elseif (b_2 <= -2.5e-307) tmp = -sqrt((c / -a)); elseif (b_2 <= 1.4e+26) tmp = (-b_2 - (((b_2 ^ 2.0) - (c * a)) ^ 0.5)) / a; else tmp = (b_2 * -2.0) / a; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -3.2e-70], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, -1.65e-260], N[(N[Sqrt[N[(c * (-a)), $MachinePrecision]], $MachinePrecision] / (-a)), $MachinePrecision], If[LessEqual[b$95$2, -2.5e-307], (-N[Sqrt[N[(c / (-a)), $MachinePrecision]], $MachinePrecision]), If[LessEqual[b$95$2, 1.4e+26], N[(N[((-b$95$2) - N[Power[N[(N[Power[b$95$2, 2.0], $MachinePrecision] - N[(c * a), $MachinePrecision]), $MachinePrecision], 0.5], $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 -3.2 \cdot 10^{-70}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b\_2}\\
\mathbf{elif}\;b\_2 \leq -1.65 \cdot 10^{-260}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(-a\right)}}{-a}\\
\mathbf{elif}\;b\_2 \leq -2.5 \cdot 10^{-307}:\\
\;\;\;\;-\sqrt{\frac{c}{-a}}\\
\mathbf{elif}\;b\_2 \leq 1.4 \cdot 10^{+26}:\\
\;\;\;\;\frac{\left(-b\_2\right) - {\left({b\_2}^{2} - c \cdot a\right)}^{0.5}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b\_2 \cdot -2}{a}\\
\end{array}
\end{array}
if b_2 < -3.1999999999999997e-70Initial program 14.5%
Taylor expanded in b_2 around -inf 86.3%
associate-*r/86.3%
Simplified86.3%
if -3.1999999999999997e-70 < b_2 < -1.6499999999999999e-260Initial program 74.5%
prod-diff74.1%
*-commutative74.1%
fma-neg74.1%
prod-diff74.1%
*-commutative74.1%
fma-neg74.1%
associate-+l+74.0%
pow274.0%
*-commutative74.0%
fma-undefine74.1%
distribute-lft-neg-in74.1%
*-commutative74.1%
distribute-rgt-neg-in74.1%
fma-define74.0%
*-commutative74.0%
fma-undefine74.1%
distribute-lft-neg-in74.1%
*-commutative74.1%
distribute-rgt-neg-in74.1%
Applied egg-rr74.0%
count-274.0%
Simplified74.0%
Taylor expanded in b_2 around 0 74.5%
mul-1-neg74.5%
associate-*l/74.6%
*-lft-identity74.6%
distribute-neg-frac274.6%
distribute-lft1-in74.6%
metadata-eval74.6%
mul0-lft75.1%
metadata-eval75.1%
neg-sub075.1%
distribute-rgt-neg-in75.1%
Simplified75.1%
if -1.6499999999999999e-260 < b_2 < -2.50000000000000007e-307Initial program 26.5%
prod-diff25.4%
*-commutative25.4%
fma-neg25.4%
prod-diff25.4%
*-commutative25.4%
fma-neg25.4%
associate-+l+25.6%
pow225.6%
*-commutative25.6%
fma-undefine25.4%
distribute-lft-neg-in25.4%
*-commutative25.4%
distribute-rgt-neg-in25.4%
fma-define25.6%
*-commutative25.6%
fma-undefine25.4%
distribute-lft-neg-in25.4%
*-commutative25.4%
distribute-rgt-neg-in25.4%
Applied egg-rr25.6%
count-225.6%
Simplified25.6%
Taylor expanded in a around inf 87.3%
mul-1-neg87.3%
distribute-rgt1-in87.3%
metadata-eval87.3%
mul0-lft87.3%
metadata-eval87.3%
neg-sub087.3%
Simplified87.3%
if -2.50000000000000007e-307 < b_2 < 1.4e26Initial program 83.2%
pow1/283.2%
pow283.2%
Applied egg-rr83.2%
if 1.4e26 < b_2 Initial program 70.2%
Taylor expanded in b_2 around inf 94.8%
*-commutative94.8%
Simplified94.8%
Final simplification87.1%
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -1.5e-69)
(/ (* -0.5 c) b_2)
(if (<= b_2 -1.8e-260)
(/ (sqrt (* c (- a))) (- a))
(if (<= b_2 1.05e-304)
(- (sqrt (/ c (- a))))
(if (<= b_2 1.4e+26)
(/ (- (- 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.5e-69) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= -1.8e-260) {
tmp = sqrt((c * -a)) / -a;
} else if (b_2 <= 1.05e-304) {
tmp = -sqrt((c / -a));
} else if (b_2 <= 1.4e+26) {
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.5d-69)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= (-1.8d-260)) then
tmp = sqrt((c * -a)) / -a
else if (b_2 <= 1.05d-304) then
tmp = -sqrt((c / -a))
else if (b_2 <= 1.4d+26) 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.5e-69) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= -1.8e-260) {
tmp = Math.sqrt((c * -a)) / -a;
} else if (b_2 <= 1.05e-304) {
tmp = -Math.sqrt((c / -a));
} else if (b_2 <= 1.4e+26) {
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.5e-69: tmp = (-0.5 * c) / b_2 elif b_2 <= -1.8e-260: tmp = math.sqrt((c * -a)) / -a elif b_2 <= 1.05e-304: tmp = -math.sqrt((c / -a)) elif b_2 <= 1.4e+26: 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.5e-69) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= -1.8e-260) tmp = Float64(sqrt(Float64(c * Float64(-a))) / Float64(-a)); elseif (b_2 <= 1.05e-304) tmp = Float64(-sqrt(Float64(c / Float64(-a)))); elseif (b_2 <= 1.4e+26) 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.5e-69) tmp = (-0.5 * c) / b_2; elseif (b_2 <= -1.8e-260) tmp = sqrt((c * -a)) / -a; elseif (b_2 <= 1.05e-304) tmp = -sqrt((c / -a)); elseif (b_2 <= 1.4e+26) 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.5e-69], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, -1.8e-260], N[(N[Sqrt[N[(c * (-a)), $MachinePrecision]], $MachinePrecision] / (-a)), $MachinePrecision], If[LessEqual[b$95$2, 1.05e-304], (-N[Sqrt[N[(c / (-a)), $MachinePrecision]], $MachinePrecision]), If[LessEqual[b$95$2, 1.4e+26], 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.5 \cdot 10^{-69}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b\_2}\\
\mathbf{elif}\;b\_2 \leq -1.8 \cdot 10^{-260}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(-a\right)}}{-a}\\
\mathbf{elif}\;b\_2 \leq 1.05 \cdot 10^{-304}:\\
\;\;\;\;-\sqrt{\frac{c}{-a}}\\
\mathbf{elif}\;b\_2 \leq 1.4 \cdot 10^{+26}:\\
\;\;\;\;\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.49999999999999995e-69Initial program 14.5%
Taylor expanded in b_2 around -inf 86.3%
associate-*r/86.3%
Simplified86.3%
if -1.49999999999999995e-69 < b_2 < -1.8e-260Initial program 74.5%
prod-diff74.1%
*-commutative74.1%
fma-neg74.1%
prod-diff74.1%
*-commutative74.1%
fma-neg74.1%
associate-+l+74.0%
pow274.0%
*-commutative74.0%
fma-undefine74.1%
distribute-lft-neg-in74.1%
*-commutative74.1%
distribute-rgt-neg-in74.1%
fma-define74.0%
*-commutative74.0%
fma-undefine74.1%
distribute-lft-neg-in74.1%
*-commutative74.1%
distribute-rgt-neg-in74.1%
Applied egg-rr74.0%
count-274.0%
Simplified74.0%
Taylor expanded in b_2 around 0 74.5%
mul-1-neg74.5%
associate-*l/74.6%
*-lft-identity74.6%
distribute-neg-frac274.6%
distribute-lft1-in74.6%
metadata-eval74.6%
mul0-lft75.1%
metadata-eval75.1%
neg-sub075.1%
distribute-rgt-neg-in75.1%
Simplified75.1%
if -1.8e-260 < b_2 < 1.05000000000000004e-304Initial program 34.5%
prod-diff33.5%
*-commutative33.5%
fma-neg33.5%
prod-diff33.5%
*-commutative33.5%
fma-neg33.5%
associate-+l+33.9%
pow233.9%
*-commutative33.9%
fma-undefine33.5%
distribute-lft-neg-in33.5%
*-commutative33.5%
distribute-rgt-neg-in33.5%
fma-define33.9%
*-commutative33.9%
fma-undefine33.5%
distribute-lft-neg-in33.5%
*-commutative33.5%
distribute-rgt-neg-in33.5%
Applied egg-rr33.9%
count-233.9%
Simplified33.9%
Taylor expanded in a around inf 88.7%
mul-1-neg88.7%
distribute-rgt1-in88.7%
metadata-eval88.7%
mul0-lft88.7%
metadata-eval88.7%
neg-sub088.7%
Simplified88.7%
if 1.05000000000000004e-304 < b_2 < 1.4e26Initial program 82.9%
if 1.4e26 < b_2 Initial program 70.2%
Taylor expanded in b_2 around inf 94.8%
*-commutative94.8%
Simplified94.8%
Final simplification87.1%
(FPCore (a b_2 c)
:precision binary64
(let* ((t_0 (/ (sqrt (* c (- a))) (- a))))
(if (<= b_2 -3.6e-70)
(/ (* -0.5 c) b_2)
(if (<= b_2 -2.1e-260)
t_0
(if (<= b_2 1e-304)
(- (sqrt (/ c (- a))))
(if (<= b_2 4.5e-30) (- t_0 (/ b_2 a)) (/ (* b_2 -2.0) a)))))))
double code(double a, double b_2, double c) {
double t_0 = sqrt((c * -a)) / -a;
double tmp;
if (b_2 <= -3.6e-70) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= -2.1e-260) {
tmp = t_0;
} else if (b_2 <= 1e-304) {
tmp = -sqrt((c / -a));
} else if (b_2 <= 4.5e-30) {
tmp = t_0 - (b_2 / 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((c * -a)) / -a
if (b_2 <= (-3.6d-70)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= (-2.1d-260)) then
tmp = t_0
else if (b_2 <= 1d-304) then
tmp = -sqrt((c / -a))
else if (b_2 <= 4.5d-30) then
tmp = t_0 - (b_2 / 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((c * -a)) / -a;
double tmp;
if (b_2 <= -3.6e-70) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= -2.1e-260) {
tmp = t_0;
} else if (b_2 <= 1e-304) {
tmp = -Math.sqrt((c / -a));
} else if (b_2 <= 4.5e-30) {
tmp = t_0 - (b_2 / a);
} else {
tmp = (b_2 * -2.0) / a;
}
return tmp;
}
def code(a, b_2, c): t_0 = math.sqrt((c * -a)) / -a tmp = 0 if b_2 <= -3.6e-70: tmp = (-0.5 * c) / b_2 elif b_2 <= -2.1e-260: tmp = t_0 elif b_2 <= 1e-304: tmp = -math.sqrt((c / -a)) elif b_2 <= 4.5e-30: tmp = t_0 - (b_2 / a) else: tmp = (b_2 * -2.0) / a return tmp
function code(a, b_2, c) t_0 = Float64(sqrt(Float64(c * Float64(-a))) / Float64(-a)) tmp = 0.0 if (b_2 <= -3.6e-70) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= -2.1e-260) tmp = t_0; elseif (b_2 <= 1e-304) tmp = Float64(-sqrt(Float64(c / Float64(-a)))); elseif (b_2 <= 4.5e-30) tmp = Float64(t_0 - Float64(b_2 / 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((c * -a)) / -a; tmp = 0.0; if (b_2 <= -3.6e-70) tmp = (-0.5 * c) / b_2; elseif (b_2 <= -2.1e-260) tmp = t_0; elseif (b_2 <= 1e-304) tmp = -sqrt((c / -a)); elseif (b_2 <= 4.5e-30) tmp = t_0 - (b_2 / 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[Sqrt[N[(c * (-a)), $MachinePrecision]], $MachinePrecision] / (-a)), $MachinePrecision]}, If[LessEqual[b$95$2, -3.6e-70], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, -2.1e-260], t$95$0, If[LessEqual[b$95$2, 1e-304], (-N[Sqrt[N[(c / (-a)), $MachinePrecision]], $MachinePrecision]), If[LessEqual[b$95$2, 4.5e-30], N[(t$95$0 - N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sqrt{c \cdot \left(-a\right)}}{-a}\\
\mathbf{if}\;b\_2 \leq -3.6 \cdot 10^{-70}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b\_2}\\
\mathbf{elif}\;b\_2 \leq -2.1 \cdot 10^{-260}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b\_2 \leq 10^{-304}:\\
\;\;\;\;-\sqrt{\frac{c}{-a}}\\
\mathbf{elif}\;b\_2 \leq 4.5 \cdot 10^{-30}:\\
\;\;\;\;t\_0 - \frac{b\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b\_2 \cdot -2}{a}\\
\end{array}
\end{array}
if b_2 < -3.6000000000000002e-70Initial program 14.5%
Taylor expanded in b_2 around -inf 86.3%
associate-*r/86.3%
Simplified86.3%
if -3.6000000000000002e-70 < b_2 < -2.10000000000000005e-260Initial program 74.5%
prod-diff74.1%
*-commutative74.1%
fma-neg74.1%
prod-diff74.1%
*-commutative74.1%
fma-neg74.1%
associate-+l+74.0%
pow274.0%
*-commutative74.0%
fma-undefine74.1%
distribute-lft-neg-in74.1%
*-commutative74.1%
distribute-rgt-neg-in74.1%
fma-define74.0%
*-commutative74.0%
fma-undefine74.1%
distribute-lft-neg-in74.1%
*-commutative74.1%
distribute-rgt-neg-in74.1%
Applied egg-rr74.0%
count-274.0%
Simplified74.0%
Taylor expanded in b_2 around 0 74.5%
mul-1-neg74.5%
associate-*l/74.6%
*-lft-identity74.6%
distribute-neg-frac274.6%
distribute-lft1-in74.6%
metadata-eval74.6%
mul0-lft75.1%
metadata-eval75.1%
neg-sub075.1%
distribute-rgt-neg-in75.1%
Simplified75.1%
if -2.10000000000000005e-260 < b_2 < 9.99999999999999971e-305Initial program 34.5%
prod-diff33.5%
*-commutative33.5%
fma-neg33.5%
prod-diff33.5%
*-commutative33.5%
fma-neg33.5%
associate-+l+33.9%
pow233.9%
*-commutative33.9%
fma-undefine33.5%
distribute-lft-neg-in33.5%
*-commutative33.5%
distribute-rgt-neg-in33.5%
fma-define33.9%
*-commutative33.9%
fma-undefine33.5%
distribute-lft-neg-in33.5%
*-commutative33.5%
distribute-rgt-neg-in33.5%
Applied egg-rr33.9%
count-233.9%
Simplified33.9%
Taylor expanded in a around inf 88.7%
mul-1-neg88.7%
distribute-rgt1-in88.7%
metadata-eval88.7%
mul0-lft88.7%
metadata-eval88.7%
neg-sub088.7%
Simplified88.7%
if 9.99999999999999971e-305 < b_2 < 4.49999999999999967e-30Initial program 76.0%
prod-diff75.3%
*-commutative75.3%
fma-neg75.3%
prod-diff75.3%
*-commutative75.3%
fma-neg75.3%
associate-+l+75.3%
pow275.3%
*-commutative75.3%
fma-undefine75.3%
distribute-lft-neg-in75.3%
*-commutative75.3%
distribute-rgt-neg-in75.3%
fma-define75.3%
*-commutative75.3%
fma-undefine75.3%
distribute-lft-neg-in75.3%
*-commutative75.3%
distribute-rgt-neg-in75.3%
Applied egg-rr75.3%
count-275.3%
Simplified75.3%
Taylor expanded in b_2 around 0 62.9%
+-commutative62.9%
mul-1-neg62.9%
unsub-neg62.9%
mul-1-neg62.9%
distribute-neg-frac262.9%
associate-*l/63.0%
*-lft-identity63.0%
distribute-lft1-in63.0%
metadata-eval63.0%
mul0-lft63.7%
metadata-eval63.7%
neg-sub063.7%
distribute-rgt-neg-in63.7%
Simplified63.7%
if 4.49999999999999967e-30 < b_2 Initial program 75.3%
Taylor expanded in b_2 around inf 91.4%
*-commutative91.4%
Simplified91.4%
Final simplification83.9%
(FPCore (a b_2 c)
:precision binary64
(let* ((t_0 (sqrt (* c (- a)))))
(if (<= b_2 -5.5e-70)
(/ (* -0.5 c) b_2)
(if (<= b_2 -1.65e-260)
(/ t_0 (- a))
(if (<= b_2 1e-304)
(- (sqrt (/ c (- a))))
(if (<= b_2 3.2e-33) (/ (- (- b_2) t_0) a) (/ (* b_2 -2.0) a)))))))
double code(double a, double b_2, double c) {
double t_0 = sqrt((c * -a));
double tmp;
if (b_2 <= -5.5e-70) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= -1.65e-260) {
tmp = t_0 / -a;
} else if (b_2 <= 1e-304) {
tmp = -sqrt((c / -a));
} else if (b_2 <= 3.2e-33) {
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((c * -a))
if (b_2 <= (-5.5d-70)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= (-1.65d-260)) then
tmp = t_0 / -a
else if (b_2 <= 1d-304) then
tmp = -sqrt((c / -a))
else if (b_2 <= 3.2d-33) 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((c * -a));
double tmp;
if (b_2 <= -5.5e-70) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= -1.65e-260) {
tmp = t_0 / -a;
} else if (b_2 <= 1e-304) {
tmp = -Math.sqrt((c / -a));
} else if (b_2 <= 3.2e-33) {
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((c * -a)) tmp = 0 if b_2 <= -5.5e-70: tmp = (-0.5 * c) / b_2 elif b_2 <= -1.65e-260: tmp = t_0 / -a elif b_2 <= 1e-304: tmp = -math.sqrt((c / -a)) elif b_2 <= 3.2e-33: 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(c * Float64(-a))) tmp = 0.0 if (b_2 <= -5.5e-70) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= -1.65e-260) tmp = Float64(t_0 / Float64(-a)); elseif (b_2 <= 1e-304) tmp = Float64(-sqrt(Float64(c / Float64(-a)))); elseif (b_2 <= 3.2e-33) 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((c * -a)); tmp = 0.0; if (b_2 <= -5.5e-70) tmp = (-0.5 * c) / b_2; elseif (b_2 <= -1.65e-260) tmp = t_0 / -a; elseif (b_2 <= 1e-304) tmp = -sqrt((c / -a)); elseif (b_2 <= 3.2e-33) 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[(c * (-a)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b$95$2, -5.5e-70], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, -1.65e-260], N[(t$95$0 / (-a)), $MachinePrecision], If[LessEqual[b$95$2, 1e-304], (-N[Sqrt[N[(c / (-a)), $MachinePrecision]], $MachinePrecision]), If[LessEqual[b$95$2, 3.2e-33], 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{c \cdot \left(-a\right)}\\
\mathbf{if}\;b\_2 \leq -5.5 \cdot 10^{-70}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b\_2}\\
\mathbf{elif}\;b\_2 \leq -1.65 \cdot 10^{-260}:\\
\;\;\;\;\frac{t\_0}{-a}\\
\mathbf{elif}\;b\_2 \leq 10^{-304}:\\
\;\;\;\;-\sqrt{\frac{c}{-a}}\\
\mathbf{elif}\;b\_2 \leq 3.2 \cdot 10^{-33}:\\
\;\;\;\;\frac{\left(-b\_2\right) - t\_0}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b\_2 \cdot -2}{a}\\
\end{array}
\end{array}
if b_2 < -5.5000000000000001e-70Initial program 14.5%
Taylor expanded in b_2 around -inf 86.3%
associate-*r/86.3%
Simplified86.3%
if -5.5000000000000001e-70 < b_2 < -1.6499999999999999e-260Initial program 74.5%
prod-diff74.1%
*-commutative74.1%
fma-neg74.1%
prod-diff74.1%
*-commutative74.1%
fma-neg74.1%
associate-+l+74.0%
pow274.0%
*-commutative74.0%
fma-undefine74.1%
distribute-lft-neg-in74.1%
*-commutative74.1%
distribute-rgt-neg-in74.1%
fma-define74.0%
*-commutative74.0%
fma-undefine74.1%
distribute-lft-neg-in74.1%
*-commutative74.1%
distribute-rgt-neg-in74.1%
Applied egg-rr74.0%
count-274.0%
Simplified74.0%
Taylor expanded in b_2 around 0 74.5%
mul-1-neg74.5%
associate-*l/74.6%
*-lft-identity74.6%
distribute-neg-frac274.6%
distribute-lft1-in74.6%
metadata-eval74.6%
mul0-lft75.1%
metadata-eval75.1%
neg-sub075.1%
distribute-rgt-neg-in75.1%
Simplified75.1%
if -1.6499999999999999e-260 < b_2 < 9.99999999999999971e-305Initial program 34.5%
prod-diff33.5%
*-commutative33.5%
fma-neg33.5%
prod-diff33.5%
*-commutative33.5%
fma-neg33.5%
associate-+l+33.9%
pow233.9%
*-commutative33.9%
fma-undefine33.5%
distribute-lft-neg-in33.5%
*-commutative33.5%
distribute-rgt-neg-in33.5%
fma-define33.9%
*-commutative33.9%
fma-undefine33.5%
distribute-lft-neg-in33.5%
*-commutative33.5%
distribute-rgt-neg-in33.5%
Applied egg-rr33.9%
count-233.9%
Simplified33.9%
Taylor expanded in a around inf 88.7%
mul-1-neg88.7%
distribute-rgt1-in88.7%
metadata-eval88.7%
mul0-lft88.7%
metadata-eval88.7%
neg-sub088.7%
Simplified88.7%
if 9.99999999999999971e-305 < b_2 < 3.19999999999999977e-33Initial program 76.0%
Taylor expanded in b_2 around 0 63.6%
mul-1-neg63.6%
distribute-rgt-neg-out63.6%
Simplified63.6%
if 3.19999999999999977e-33 < b_2 Initial program 75.3%
Taylor expanded in b_2 around inf 91.4%
*-commutative91.4%
Simplified91.4%
Final simplification83.9%
(FPCore (a b_2 c)
:precision binary64
(let* ((t_0 (/ (sqrt (* c (- a))) (- a))))
(if (<= b_2 -8.5e-70)
(/ (* -0.5 c) b_2)
(if (<= b_2 -1.65e-260)
t_0
(if (<= b_2 1e-304)
(- (sqrt (/ c (- a))))
(if (<= b_2 6.5e-33) t_0 (/ (* b_2 -2.0) a)))))))
double code(double a, double b_2, double c) {
double t_0 = sqrt((c * -a)) / -a;
double tmp;
if (b_2 <= -8.5e-70) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= -1.65e-260) {
tmp = t_0;
} else if (b_2 <= 1e-304) {
tmp = -sqrt((c / -a));
} else if (b_2 <= 6.5e-33) {
tmp = t_0;
} 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((c * -a)) / -a
if (b_2 <= (-8.5d-70)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= (-1.65d-260)) then
tmp = t_0
else if (b_2 <= 1d-304) then
tmp = -sqrt((c / -a))
else if (b_2 <= 6.5d-33) then
tmp = t_0
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((c * -a)) / -a;
double tmp;
if (b_2 <= -8.5e-70) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= -1.65e-260) {
tmp = t_0;
} else if (b_2 <= 1e-304) {
tmp = -Math.sqrt((c / -a));
} else if (b_2 <= 6.5e-33) {
tmp = t_0;
} else {
tmp = (b_2 * -2.0) / a;
}
return tmp;
}
def code(a, b_2, c): t_0 = math.sqrt((c * -a)) / -a tmp = 0 if b_2 <= -8.5e-70: tmp = (-0.5 * c) / b_2 elif b_2 <= -1.65e-260: tmp = t_0 elif b_2 <= 1e-304: tmp = -math.sqrt((c / -a)) elif b_2 <= 6.5e-33: tmp = t_0 else: tmp = (b_2 * -2.0) / a return tmp
function code(a, b_2, c) t_0 = Float64(sqrt(Float64(c * Float64(-a))) / Float64(-a)) tmp = 0.0 if (b_2 <= -8.5e-70) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= -1.65e-260) tmp = t_0; elseif (b_2 <= 1e-304) tmp = Float64(-sqrt(Float64(c / Float64(-a)))); elseif (b_2 <= 6.5e-33) tmp = t_0; else tmp = Float64(Float64(b_2 * -2.0) / a); end return tmp end
function tmp_2 = code(a, b_2, c) t_0 = sqrt((c * -a)) / -a; tmp = 0.0; if (b_2 <= -8.5e-70) tmp = (-0.5 * c) / b_2; elseif (b_2 <= -1.65e-260) tmp = t_0; elseif (b_2 <= 1e-304) tmp = -sqrt((c / -a)); elseif (b_2 <= 6.5e-33) tmp = t_0; else tmp = (b_2 * -2.0) / a; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := Block[{t$95$0 = N[(N[Sqrt[N[(c * (-a)), $MachinePrecision]], $MachinePrecision] / (-a)), $MachinePrecision]}, If[LessEqual[b$95$2, -8.5e-70], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, -1.65e-260], t$95$0, If[LessEqual[b$95$2, 1e-304], (-N[Sqrt[N[(c / (-a)), $MachinePrecision]], $MachinePrecision]), If[LessEqual[b$95$2, 6.5e-33], t$95$0, N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sqrt{c \cdot \left(-a\right)}}{-a}\\
\mathbf{if}\;b\_2 \leq -8.5 \cdot 10^{-70}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b\_2}\\
\mathbf{elif}\;b\_2 \leq -1.65 \cdot 10^{-260}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b\_2 \leq 10^{-304}:\\
\;\;\;\;-\sqrt{\frac{c}{-a}}\\
\mathbf{elif}\;b\_2 \leq 6.5 \cdot 10^{-33}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b\_2 \cdot -2}{a}\\
\end{array}
\end{array}
if b_2 < -8.5000000000000002e-70Initial program 14.5%
Taylor expanded in b_2 around -inf 86.3%
associate-*r/86.3%
Simplified86.3%
if -8.5000000000000002e-70 < b_2 < -1.6499999999999999e-260 or 9.99999999999999971e-305 < b_2 < 6.4999999999999993e-33Initial program 75.4%
prod-diff74.8%
*-commutative74.8%
fma-neg74.8%
prod-diff74.8%
*-commutative74.8%
fma-neg74.8%
associate-+l+74.8%
pow274.8%
*-commutative74.8%
fma-undefine74.8%
distribute-lft-neg-in74.8%
*-commutative74.8%
distribute-rgt-neg-in74.8%
fma-define74.8%
*-commutative74.8%
fma-undefine74.8%
distribute-lft-neg-in74.8%
*-commutative74.8%
distribute-rgt-neg-in74.8%
Applied egg-rr74.8%
count-274.8%
Simplified74.8%
Taylor expanded in b_2 around 0 65.8%
mul-1-neg65.8%
associate-*l/65.9%
*-lft-identity65.9%
distribute-neg-frac265.9%
distribute-lft1-in65.9%
metadata-eval65.9%
mul0-lft66.5%
metadata-eval66.5%
neg-sub066.5%
distribute-rgt-neg-in66.5%
Simplified66.5%
if -1.6499999999999999e-260 < b_2 < 9.99999999999999971e-305Initial program 34.5%
prod-diff33.5%
*-commutative33.5%
fma-neg33.5%
prod-diff33.5%
*-commutative33.5%
fma-neg33.5%
associate-+l+33.9%
pow233.9%
*-commutative33.9%
fma-undefine33.5%
distribute-lft-neg-in33.5%
*-commutative33.5%
distribute-rgt-neg-in33.5%
fma-define33.9%
*-commutative33.9%
fma-undefine33.5%
distribute-lft-neg-in33.5%
*-commutative33.5%
distribute-rgt-neg-in33.5%
Applied egg-rr33.9%
count-233.9%
Simplified33.9%
Taylor expanded in a around inf 88.7%
mul-1-neg88.7%
distribute-rgt1-in88.7%
metadata-eval88.7%
mul0-lft88.7%
metadata-eval88.7%
neg-sub088.7%
Simplified88.7%
if 6.4999999999999993e-33 < b_2 Initial program 75.3%
Taylor expanded in b_2 around inf 91.4%
*-commutative91.4%
Simplified91.4%
Final simplification83.5%
(FPCore (a b_2 c)
:precision binary64
(if (<= b_2 -1e-145)
(/ (* -0.5 c) b_2)
(if (<= b_2 3.5e-165)
(- (sqrt (/ c (- a))))
(+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -1e-145) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 3.5e-165) {
tmp = -sqrt((c / -a));
} else {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-1d-145)) then
tmp = ((-0.5d0) * c) / b_2
else if (b_2 <= 3.5d-165) then
tmp = -sqrt((c / -a))
else
tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -1e-145) {
tmp = (-0.5 * c) / b_2;
} else if (b_2 <= 3.5e-165) {
tmp = -Math.sqrt((c / -a));
} else {
tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -1e-145: tmp = (-0.5 * c) / b_2 elif b_2 <= 3.5e-165: tmp = -math.sqrt((c / -a)) else: tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)) return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -1e-145) tmp = Float64(Float64(-0.5 * c) / b_2); elseif (b_2 <= 3.5e-165) tmp = Float64(-sqrt(Float64(c / Float64(-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 <= -1e-145) tmp = (-0.5 * c) / b_2; elseif (b_2 <= 3.5e-165) tmp = -sqrt((c / -a)); else tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2)); end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -1e-145], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 3.5e-165], (-N[Sqrt[N[(c / (-a)), $MachinePrecision]], $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 \cdot 10^{-145}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b\_2}\\
\mathbf{elif}\;b\_2 \leq 3.5 \cdot 10^{-165}:\\
\;\;\;\;-\sqrt{\frac{c}{-a}}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b\_2}{a} + 0.5 \cdot \frac{c}{b\_2}\\
\end{array}
\end{array}
if b_2 < -9.99999999999999915e-146Initial program 17.6%
Taylor expanded in b_2 around -inf 80.9%
associate-*r/81.0%
Simplified81.0%
if -9.99999999999999915e-146 < b_2 < 3.5000000000000002e-165Initial program 74.2%
prod-diff73.6%
*-commutative73.6%
fma-neg73.6%
prod-diff73.6%
*-commutative73.6%
fma-neg73.6%
associate-+l+73.6%
pow273.6%
*-commutative73.6%
fma-undefine73.6%
distribute-lft-neg-in73.6%
*-commutative73.6%
distribute-rgt-neg-in73.6%
fma-define73.6%
*-commutative73.6%
fma-undefine73.6%
distribute-lft-neg-in73.6%
*-commutative73.6%
distribute-rgt-neg-in73.6%
Applied egg-rr73.6%
count-273.6%
Simplified73.6%
Taylor expanded in a around inf 53.7%
mul-1-neg53.7%
distribute-rgt1-in53.7%
metadata-eval53.7%
mul0-lft53.7%
metadata-eval53.7%
neg-sub053.7%
Simplified53.7%
if 3.5000000000000002e-165 < b_2 Initial program 75.3%
Taylor expanded in c around 0 83.6%
Final simplification77.5%
(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 25.6%
Taylor expanded in b_2 around -inf 69.5%
associate-*r/69.5%
Simplified69.5%
if -1.999999999999994e-310 < b_2 Initial program 75.7%
Taylor expanded in c around 0 69.4%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.4e-295) (/ (* -0.5 c) b_2) (/ (* b_2 -2.0) a)))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.4e-295) {
tmp = (-0.5 * c) / b_2;
} else {
tmp = (b_2 * -2.0) / a;
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-2.4d-295)) then
tmp = ((-0.5d0) * c) / b_2
else
tmp = (b_2 * (-2.0d0)) / a
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.4e-295) {
tmp = (-0.5 * c) / b_2;
} else {
tmp = (b_2 * -2.0) / a;
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.4e-295: tmp = (-0.5 * c) / b_2 else: tmp = (b_2 * -2.0) / a return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.4e-295) tmp = Float64(Float64(-0.5 * c) / b_2); else tmp = Float64(Float64(b_2 * -2.0) / a); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -2.4e-295) tmp = (-0.5 * c) / b_2; else tmp = (b_2 * -2.0) / a; end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.4e-295], 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.4 \cdot 10^{-295}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{b\_2 \cdot -2}{a}\\
\end{array}
\end{array}
if b_2 < -2.3999999999999998e-295Initial program 25.2%
Taylor expanded in b_2 around -inf 70.5%
associate-*r/70.5%
Simplified70.5%
if -2.3999999999999998e-295 < b_2 Initial program 75.3%
Taylor expanded in b_2 around inf 68.3%
*-commutative68.3%
Simplified68.3%
(FPCore (a b_2 c) :precision binary64 (if (<= b_2 -2.4e-295) (/ (* -0.5 c) b_2) (* b_2 (/ -2.0 a))))
double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.4e-295) {
tmp = (-0.5 * c) / b_2;
} else {
tmp = b_2 * (-2.0 / a);
}
return tmp;
}
real(8) function code(a, b_2, c)
real(8), intent (in) :: a
real(8), intent (in) :: b_2
real(8), intent (in) :: c
real(8) :: tmp
if (b_2 <= (-2.4d-295)) then
tmp = ((-0.5d0) * c) / b_2
else
tmp = b_2 * ((-2.0d0) / a)
end if
code = tmp
end function
public static double code(double a, double b_2, double c) {
double tmp;
if (b_2 <= -2.4e-295) {
tmp = (-0.5 * c) / b_2;
} else {
tmp = b_2 * (-2.0 / a);
}
return tmp;
}
def code(a, b_2, c): tmp = 0 if b_2 <= -2.4e-295: tmp = (-0.5 * c) / b_2 else: tmp = b_2 * (-2.0 / a) return tmp
function code(a, b_2, c) tmp = 0.0 if (b_2 <= -2.4e-295) tmp = Float64(Float64(-0.5 * c) / b_2); else tmp = Float64(b_2 * Float64(-2.0 / a)); end return tmp end
function tmp_2 = code(a, b_2, c) tmp = 0.0; if (b_2 <= -2.4e-295) tmp = (-0.5 * c) / b_2; else tmp = b_2 * (-2.0 / a); end tmp_2 = tmp; end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.4e-295], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], N[(b$95$2 * N[(-2.0 / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b\_2 \leq -2.4 \cdot 10^{-295}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b\_2}\\
\mathbf{else}:\\
\;\;\;\;b\_2 \cdot \frac{-2}{a}\\
\end{array}
\end{array}
if b_2 < -2.3999999999999998e-295Initial program 25.2%
Taylor expanded in b_2 around -inf 70.5%
associate-*r/70.5%
Simplified70.5%
if -2.3999999999999998e-295 < b_2 Initial program 75.3%
prod-diff75.0%
*-commutative75.0%
fma-neg75.0%
prod-diff75.0%
*-commutative75.0%
fma-neg75.0%
associate-+l+75.0%
pow275.0%
*-commutative75.0%
fma-undefine75.0%
distribute-lft-neg-in75.0%
*-commutative75.0%
distribute-rgt-neg-in75.0%
fma-define75.0%
*-commutative75.0%
fma-undefine75.0%
distribute-lft-neg-in75.0%
*-commutative75.0%
distribute-rgt-neg-in75.0%
Applied egg-rr75.0%
count-275.0%
Simplified75.0%
Taylor expanded in b_2 around inf 68.3%
associate-*r/68.3%
*-commutative68.3%
associate-/l*68.1%
Simplified68.1%
(FPCore (a b_2 c) :precision binary64 (* b_2 (/ -2.0 a)))
double code(double a, double b_2, double c) {
return b_2 * (-2.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 = b_2 * ((-2.0d0) / a)
end function
public static double code(double a, double b_2, double c) {
return b_2 * (-2.0 / a);
}
def code(a, b_2, c): return b_2 * (-2.0 / a)
function code(a, b_2, c) return Float64(b_2 * Float64(-2.0 / a)) end
function tmp = code(a, b_2, c) tmp = b_2 * (-2.0 / a); end
code[a_, b$95$2_, c_] := N[(b$95$2 * N[(-2.0 / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
b\_2 \cdot \frac{-2}{a}
\end{array}
Initial program 49.7%
prod-diff49.4%
*-commutative49.4%
fma-neg49.4%
prod-diff49.4%
*-commutative49.4%
fma-neg49.4%
associate-+l+49.4%
pow249.4%
*-commutative49.4%
fma-undefine49.4%
distribute-lft-neg-in49.4%
*-commutative49.4%
distribute-rgt-neg-in49.4%
fma-define49.4%
*-commutative49.4%
fma-undefine49.4%
distribute-lft-neg-in49.4%
*-commutative49.4%
distribute-rgt-neg-in49.4%
Applied egg-rr49.4%
count-249.4%
Simplified49.4%
Taylor expanded in b_2 around inf 34.7%
associate-*r/34.7%
*-commutative34.7%
associate-/l*34.6%
Simplified34.6%
(FPCore (a b_2 c) :precision binary64 (/ b_2 (- a)))
double code(double a, double b_2, double c) {
return b_2 / -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 / -a
end function
public static double code(double a, double b_2, double c) {
return b_2 / -a;
}
def code(a, b_2, c): return b_2 / -a
function code(a, b_2, c) return Float64(b_2 / Float64(-a)) end
function tmp = code(a, b_2, c) tmp = b_2 / -a; end
code[a_, b$95$2_, c_] := N[(b$95$2 / (-a)), $MachinePrecision]
\begin{array}{l}
\\
\frac{b\_2}{-a}
\end{array}
Initial program 49.7%
Taylor expanded in b_2 around inf 37.0%
mul-1-neg37.0%
unsub-neg37.0%
associate-/l*36.4%
Simplified36.4%
Taylor expanded in b_2 around 0 31.2%
associate-*r*31.2%
mul-1-neg31.2%
Simplified31.2%
Taylor expanded in b_2 around inf 15.9%
mul-1-neg15.9%
distribute-frac-neg15.9%
Simplified15.9%
Final simplification15.9%
(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) (/ c (- t_1 b_2)) (/ (+ b_2 t_1) (- a)))))
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 = c / (t_1 - b_2);
} else {
tmp_1 = (b_2 + t_1) / -a;
}
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 = c / (t_1 - b_2);
} else {
tmp_1 = (b_2 + t_1) / -a;
}
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 = c / (t_1 - b_2) else: tmp_1 = (b_2 + t_1) / -a 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(c / Float64(t_1 - b_2)); else tmp_1 = Float64(Float64(b_2 + t_1) / Float64(-a)); 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 = c / (t_1 - b_2); else tmp_2 = (b_2 + t_1) / -a; 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[(c / N[(t$95$1 - b$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(b$95$2 + t$95$1), $MachinePrecision] / (-a)), $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{c}{t\_1 - b\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{b\_2 + t\_1}{-a}\\
\end{array}
\end{array}
herbie shell --seed 2024108
(FPCore (a b_2 c)
:name "quad2m (problem 3.2.1, negative)"
:precision binary64
:herbie-expected 10
:alt
(if (< b_2 0.0) (/ c (- (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)) (/ (+ 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)))))) (- a)))
(/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))