
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b -6e+153)
(/ (/ (* b -2.0) a) 3.0)
(if (<= b 4.2e-57)
(/ (/ (- (sqrt (+ (* b b) (* a (* -3.0 c)))) b) 3.0) a)
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6e+153) {
tmp = ((b * -2.0) / a) / 3.0;
} else if (b <= 4.2e-57) {
tmp = ((sqrt(((b * b) + (a * (-3.0 * c)))) - b) / 3.0) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-6d+153)) then
tmp = ((b * (-2.0d0)) / a) / 3.0d0
else if (b <= 4.2d-57) then
tmp = ((sqrt(((b * b) + (a * ((-3.0d0) * c)))) - b) / 3.0d0) / a
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -6e+153) {
tmp = ((b * -2.0) / a) / 3.0;
} else if (b <= 4.2e-57) {
tmp = ((Math.sqrt(((b * b) + (a * (-3.0 * c)))) - b) / 3.0) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6e+153: tmp = ((b * -2.0) / a) / 3.0 elif b <= 4.2e-57: tmp = ((math.sqrt(((b * b) + (a * (-3.0 * c)))) - b) / 3.0) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6e+153) tmp = Float64(Float64(Float64(b * -2.0) / a) / 3.0); elseif (b <= 4.2e-57) tmp = Float64(Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(a * Float64(-3.0 * c)))) - b) / 3.0) / a); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6e+153) tmp = ((b * -2.0) / a) / 3.0; elseif (b <= 4.2e-57) tmp = ((sqrt(((b * b) + (a * (-3.0 * c)))) - b) / 3.0) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6e+153], N[(N[(N[(b * -2.0), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 4.2e-57], N[(N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(a * N[(-3.0 * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / 3.0), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6 \cdot 10^{+153}:\\
\;\;\;\;\frac{\frac{b \cdot -2}{a}}{3}\\
\mathbf{elif}\;b \leq 4.2 \cdot 10^{-57}:\\
\;\;\;\;\frac{\frac{\sqrt{b \cdot b + a \cdot \left(-3 \cdot c\right)} - b}{3}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -6.00000000000000037e153Initial program 46.5%
Simplified0
Taylor expanded in b around -inf 0
Simplified0
if -6.00000000000000037e153 < b < 4.1999999999999999e-57Initial program 86.1%
Simplified0
Applied egg-rr0
Applied egg-rr0
if 4.1999999999999999e-57 < b Initial program 8.7%
Taylor expanded in b around inf 0
Simplified0
Applied egg-rr0
(FPCore (a b c)
:precision binary64
(if (<= b -5e+157)
(/ (/ (* b -2.0) a) 3.0)
(if (<= b 3.3e-55)
(/ (- (sqrt (+ (* b b) (* -3.0 (* a c)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e+157) {
tmp = ((b * -2.0) / a) / 3.0;
} else if (b <= 3.3e-55) {
tmp = (sqrt(((b * b) + (-3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d+157)) then
tmp = ((b * (-2.0d0)) / a) / 3.0d0
else if (b <= 3.3d-55) then
tmp = (sqrt(((b * b) + ((-3.0d0) * (a * c)))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e+157) {
tmp = ((b * -2.0) / a) / 3.0;
} else if (b <= 3.3e-55) {
tmp = (Math.sqrt(((b * b) + (-3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e+157: tmp = ((b * -2.0) / a) / 3.0 elif b <= 3.3e-55: tmp = (math.sqrt(((b * b) + (-3.0 * (a * c)))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e+157) tmp = Float64(Float64(Float64(b * -2.0) / a) / 3.0); elseif (b <= 3.3e-55) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(-3.0 * Float64(a * c)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e+157) tmp = ((b * -2.0) / a) / 3.0; elseif (b <= 3.3e-55) tmp = (sqrt(((b * b) + (-3.0 * (a * c)))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e+157], N[(N[(N[(b * -2.0), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 3.3e-55], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{+157}:\\
\;\;\;\;\frac{\frac{b \cdot -2}{a}}{3}\\
\mathbf{elif}\;b \leq 3.3 \cdot 10^{-55}:\\
\;\;\;\;\frac{\sqrt{b \cdot b + -3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.99999999999999976e157Initial program 46.5%
Simplified0
Taylor expanded in b around -inf 0
Simplified0
if -4.99999999999999976e157 < b < 3.2999999999999999e-55Initial program 86.1%
Simplified0
Applied egg-rr0
Applied egg-rr0
Applied egg-rr0
if 3.2999999999999999e-55 < b Initial program 8.7%
Taylor expanded in b around inf 0
Simplified0
Applied egg-rr0
(FPCore (a b c)
:precision binary64
(if (<= b -5e+151)
(/ (/ (* b -2.0) a) 3.0)
(if (<= b 1.7e-54)
(/ 0.3333333333333333 (/ a (- (sqrt (+ (* b b) (* a (* -3.0 c)))) b)))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e+151) {
tmp = ((b * -2.0) / a) / 3.0;
} else if (b <= 1.7e-54) {
tmp = 0.3333333333333333 / (a / (sqrt(((b * b) + (a * (-3.0 * c)))) - b));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d+151)) then
tmp = ((b * (-2.0d0)) / a) / 3.0d0
else if (b <= 1.7d-54) then
tmp = 0.3333333333333333d0 / (a / (sqrt(((b * b) + (a * ((-3.0d0) * c)))) - b))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e+151) {
tmp = ((b * -2.0) / a) / 3.0;
} else if (b <= 1.7e-54) {
tmp = 0.3333333333333333 / (a / (Math.sqrt(((b * b) + (a * (-3.0 * c)))) - b));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e+151: tmp = ((b * -2.0) / a) / 3.0 elif b <= 1.7e-54: tmp = 0.3333333333333333 / (a / (math.sqrt(((b * b) + (a * (-3.0 * c)))) - b)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e+151) tmp = Float64(Float64(Float64(b * -2.0) / a) / 3.0); elseif (b <= 1.7e-54) tmp = Float64(0.3333333333333333 / Float64(a / Float64(sqrt(Float64(Float64(b * b) + Float64(a * Float64(-3.0 * c)))) - b))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e+151) tmp = ((b * -2.0) / a) / 3.0; elseif (b <= 1.7e-54) tmp = 0.3333333333333333 / (a / (sqrt(((b * b) + (a * (-3.0 * c)))) - b)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e+151], N[(N[(N[(b * -2.0), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], If[LessEqual[b, 1.7e-54], N[(0.3333333333333333 / N[(a / N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(a * N[(-3.0 * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{+151}:\\
\;\;\;\;\frac{\frac{b \cdot -2}{a}}{3}\\
\mathbf{elif}\;b \leq 1.7 \cdot 10^{-54}:\\
\;\;\;\;\frac{0.3333333333333333}{\frac{a}{\sqrt{b \cdot b + a \cdot \left(-3 \cdot c\right)} - b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -5.0000000000000002e151Initial program 46.5%
Simplified0
Taylor expanded in b around -inf 0
Simplified0
if -5.0000000000000002e151 < b < 1.69999999999999994e-54Initial program 86.1%
Simplified0
Applied egg-rr0
Applied egg-rr0
if 1.69999999999999994e-54 < b Initial program 8.7%
Taylor expanded in b around inf 0
Simplified0
Applied egg-rr0
(FPCore (a b c)
:precision binary64
(if (<= b -7.5e-127)
(- (+ (/ b (/ a 0.6666666666666666)) (/ (/ c b) -2.0)))
(if (<= b 1.15e-57)
(/ (- (sqrt (* (* a c) -3.0)) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.5e-127) {
tmp = -((b / (a / 0.6666666666666666)) + ((c / b) / -2.0));
} else if (b <= 1.15e-57) {
tmp = (sqrt(((a * c) * -3.0)) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-7.5d-127)) then
tmp = -((b / (a / 0.6666666666666666d0)) + ((c / b) / (-2.0d0)))
else if (b <= 1.15d-57) then
tmp = (sqrt(((a * c) * (-3.0d0))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -7.5e-127) {
tmp = -((b / (a / 0.6666666666666666)) + ((c / b) / -2.0));
} else if (b <= 1.15e-57) {
tmp = (Math.sqrt(((a * c) * -3.0)) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7.5e-127: tmp = -((b / (a / 0.6666666666666666)) + ((c / b) / -2.0)) elif b <= 1.15e-57: tmp = (math.sqrt(((a * c) * -3.0)) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7.5e-127) tmp = Float64(-Float64(Float64(b / Float64(a / 0.6666666666666666)) + Float64(Float64(c / b) / -2.0))); elseif (b <= 1.15e-57) tmp = Float64(Float64(sqrt(Float64(Float64(a * c) * -3.0)) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -7.5e-127) tmp = -((b / (a / 0.6666666666666666)) + ((c / b) / -2.0)); elseif (b <= 1.15e-57) tmp = (sqrt(((a * c) * -3.0)) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7.5e-127], (-N[(N[(b / N[(a / 0.6666666666666666), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] / -2.0), $MachinePrecision]), $MachinePrecision]), If[LessEqual[b, 1.15e-57], N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.5 \cdot 10^{-127}:\\
\;\;\;\;-\left(\frac{b}{\frac{a}{0.6666666666666666}} + \frac{\frac{c}{b}}{-2}\right)\\
\mathbf{elif}\;b \leq 1.15 \cdot 10^{-57}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -7.5000000000000004e-127Initial program 80.0%
Taylor expanded in b around -inf 0
Simplified0
Applied egg-rr0
Applied egg-rr0
if -7.5000000000000004e-127 < b < 1.15e-57Initial program 75.5%
Simplified0
Applied egg-rr0
Applied egg-rr0
Applied egg-rr0
Taylor expanded in b around 0 0
Simplified0
if 1.15e-57 < b Initial program 8.7%
Taylor expanded in b around inf 0
Simplified0
Applied egg-rr0
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (- (+ (/ b (/ a 0.6666666666666666)) (/ (/ c b) -2.0))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = -((b / (a / 0.6666666666666666)) + ((c / b) / -2.0));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-2d-310)) then
tmp = -((b / (a / 0.6666666666666666d0)) + ((c / b) / (-2.0d0)))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = -((b / (a / 0.6666666666666666)) + ((c / b) / -2.0));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e-310: tmp = -((b / (a / 0.6666666666666666)) + ((c / b) / -2.0)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e-310) tmp = Float64(-Float64(Float64(b / Float64(a / 0.6666666666666666)) + Float64(Float64(c / b) / -2.0))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2e-310) tmp = -((b / (a / 0.6666666666666666)) + ((c / b) / -2.0)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], (-N[(N[(b / N[(a / 0.6666666666666666), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] / -2.0), $MachinePrecision]), $MachinePrecision]), N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-\left(\frac{b}{\frac{a}{0.6666666666666666}} + \frac{\frac{c}{b}}{-2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 79.0%
Taylor expanded in b around -inf 0
Simplified0
Applied egg-rr0
Applied egg-rr0
if -1.999999999999994e-310 < b Initial program 29.1%
Taylor expanded in b around inf 0
Simplified0
Applied egg-rr0
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (+ (/ (* b -0.6666666666666666) a) (/ (* c 0.5) b)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = ((b * -0.6666666666666666) / a) + ((c * 0.5) / b);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-2d-310)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + ((c * 0.5d0) / b)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = ((b * -0.6666666666666666) / a) + ((c * 0.5) / b);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e-310: tmp = ((b * -0.6666666666666666) / a) + ((c * 0.5) / b) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e-310) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(Float64(c * 0.5) / b)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2e-310) tmp = ((b * -0.6666666666666666) / a) + ((c * 0.5) / b); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(N[(c * 0.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + \frac{c \cdot 0.5}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 79.0%
Taylor expanded in b around -inf 0
Simplified0
Applied egg-rr0
Taylor expanded in a around inf 0
Simplified0
if -1.999999999999994e-310 < b Initial program 29.1%
Taylor expanded in b around inf 0
Simplified0
Applied egg-rr0
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (+ (* (/ b a) -0.6666666666666666) (/ (* c 0.5) b)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = ((b / a) * -0.6666666666666666) + ((c * 0.5) / b);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-2d-310)) then
tmp = ((b / a) * (-0.6666666666666666d0)) + ((c * 0.5d0) / b)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = ((b / a) * -0.6666666666666666) + ((c * 0.5) / b);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e-310: tmp = ((b / a) * -0.6666666666666666) + ((c * 0.5) / b) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e-310) tmp = Float64(Float64(Float64(b / a) * -0.6666666666666666) + Float64(Float64(c * 0.5) / b)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2e-310) tmp = ((b / a) * -0.6666666666666666) + ((c * 0.5) / b); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[(N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision] + N[(N[(c * 0.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666 + \frac{c \cdot 0.5}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 79.0%
Taylor expanded in b around -inf 0
Simplified0
Taylor expanded in c around 0 0
Simplified0
if -1.999999999999994e-310 < b Initial program 29.1%
Taylor expanded in b around inf 0
Simplified0
Applied egg-rr0
(FPCore (a b c) :precision binary64 (if (<= b 1.85e-290) (/ (/ (* b -2.0) a) 3.0) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.85e-290) {
tmp = ((b * -2.0) / a) / 3.0;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 1.85d-290) then
tmp = ((b * (-2.0d0)) / a) / 3.0d0
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.85e-290) {
tmp = ((b * -2.0) / a) / 3.0;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.85e-290: tmp = ((b * -2.0) / a) / 3.0 else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.85e-290) tmp = Float64(Float64(Float64(b * -2.0) / a) / 3.0); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.85e-290) tmp = ((b * -2.0) / a) / 3.0; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.85e-290], N[(N[(N[(b * -2.0), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.85 \cdot 10^{-290}:\\
\;\;\;\;\frac{\frac{b \cdot -2}{a}}{3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.84999999999999989e-290Initial program 79.7%
Simplified0
Taylor expanded in b around -inf 0
Simplified0
if 1.84999999999999989e-290 < b Initial program 27.0%
Taylor expanded in b around inf 0
Simplified0
Applied egg-rr0
(FPCore (a b c) :precision binary64 (if (<= b 1.85e-290) (/ b (/ a -0.6666666666666666)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.85e-290) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 1.85d-290) then
tmp = b / (a / (-0.6666666666666666d0))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.85e-290) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.85e-290: tmp = b / (a / -0.6666666666666666) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.85e-290) tmp = Float64(b / Float64(a / -0.6666666666666666)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.85e-290) tmp = b / (a / -0.6666666666666666); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.85e-290], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.85 \cdot 10^{-290}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.84999999999999989e-290Initial program 79.7%
Taylor expanded in b around -inf 0
Simplified0
Applied egg-rr0
if 1.84999999999999989e-290 < b Initial program 27.0%
Taylor expanded in b around inf 0
Simplified0
Applied egg-rr0
(FPCore (a b c) :precision binary64 (if (<= b 1.85e-290) (/ b (/ a -0.6666666666666666)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.85e-290) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 1.85d-290) then
tmp = b / (a / (-0.6666666666666666d0))
else
tmp = c * ((-0.5d0) / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.85e-290) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.85e-290: tmp = b / (a / -0.6666666666666666) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.85e-290) tmp = Float64(b / Float64(a / -0.6666666666666666)); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.85e-290) tmp = b / (a / -0.6666666666666666); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.85e-290], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.85 \cdot 10^{-290}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 1.84999999999999989e-290Initial program 79.7%
Taylor expanded in b around -inf 0
Simplified0
Applied egg-rr0
if 1.84999999999999989e-290 < b Initial program 27.0%
Taylor expanded in b around inf 0
Simplified0
(FPCore (a b c) :precision binary64 (if (<= b 1.85e-290) (* (/ b a) -0.6666666666666666) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.85e-290) {
tmp = (b / a) * -0.6666666666666666;
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 1.85d-290) then
tmp = (b / a) * (-0.6666666666666666d0)
else
tmp = c * ((-0.5d0) / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.85e-290) {
tmp = (b / a) * -0.6666666666666666;
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.85e-290: tmp = (b / a) * -0.6666666666666666 else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.85e-290) tmp = Float64(Float64(b / a) * -0.6666666666666666); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.85e-290) tmp = (b / a) * -0.6666666666666666; else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.85e-290], N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.85 \cdot 10^{-290}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 1.84999999999999989e-290Initial program 79.7%
Taylor expanded in b around -inf 0
Simplified0
if 1.84999999999999989e-290 < b Initial program 27.0%
Taylor expanded in b around inf 0
Simplified0
(FPCore (a b c) :precision binary64 (if (<= b 1.85e-290) (* b (/ -0.6666666666666666 a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.85e-290) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 1.85d-290) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = c * ((-0.5d0) / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.85e-290) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.85e-290: tmp = b * (-0.6666666666666666 / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.85e-290) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.85e-290) tmp = b * (-0.6666666666666666 / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.85e-290], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.85 \cdot 10^{-290}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 1.84999999999999989e-290Initial program 79.7%
Taylor expanded in b around -inf 0
Simplified0
Applied egg-rr0
if 1.84999999999999989e-290 < b Initial program 27.0%
Taylor expanded in b around inf 0
Simplified0
(FPCore (a b c) :precision binary64 (* b (/ -0.6666666666666666 a)))
double code(double a, double b, double c) {
return b * (-0.6666666666666666 / a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = b * ((-0.6666666666666666d0) / a)
end function
public static double code(double a, double b, double c) {
return b * (-0.6666666666666666 / a);
}
def code(a, b, c): return b * (-0.6666666666666666 / a)
function code(a, b, c) return Float64(b * Float64(-0.6666666666666666 / a)) end
function tmp = code(a, b, c) tmp = b * (-0.6666666666666666 / a); end
code[a_, b_, c_] := N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
b \cdot \frac{-0.6666666666666666}{a}
\end{array}
Initial program 52.1%
Taylor expanded in b around -inf 0
Simplified0
Applied egg-rr0
herbie shell --seed 2024111
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))