
(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 17 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 -2e+152)
(* (/ b 3.0) (/ -2.0 a))
(if (<= b 9.2e-10)
(/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e+152) {
tmp = (b / 3.0) * (-2.0 / a);
} else if (b <= 9.2e-10) {
tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / 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+152)) then
tmp = (b / 3.0d0) * ((-2.0d0) / a)
else if (b <= 9.2d-10) then
tmp = (sqrt(((b * b) - ((3.0d0 * a) * c))) - b) / (3.0d0 * a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2e+152) {
tmp = (b / 3.0) * (-2.0 / a);
} else if (b <= 9.2e-10) {
tmp = (Math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e+152: tmp = (b / 3.0) * (-2.0 / a) elif b <= 9.2e-10: tmp = (math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e+152) tmp = Float64(Float64(b / 3.0) * Float64(-2.0 / a)); elseif (b <= 9.2e-10) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2e+152) tmp = (b / 3.0) * (-2.0 / a); elseif (b <= 9.2e-10) tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e+152], N[(N[(b / 3.0), $MachinePrecision] * N[(-2.0 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9.2e-10], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{+152}:\\
\;\;\;\;\frac{b}{3} \cdot \frac{-2}{a}\\
\mathbf{elif}\;b \leq 9.2 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -2.0000000000000001e152Initial program 49.6%
Taylor expanded in b around -inf 99.8%
*-commutative99.8%
Simplified99.8%
times-frac99.8%
Applied egg-rr99.8%
if -2.0000000000000001e152 < b < 9.20000000000000028e-10Initial program 80.7%
if 9.20000000000000028e-10 < b Initial program 8.0%
Taylor expanded in b around inf 93.9%
Final simplification88.3%
(FPCore (a b c)
:precision binary64
(if (<= b -2.8e+151)
(* (/ b 3.0) (/ -2.0 a))
(if (<= b 9.2e-10)
(* -0.3333333333333333 (/ (- b (sqrt (- (* b b) (* 3.0 (* a c))))) a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.8e+151) {
tmp = (b / 3.0) * (-2.0 / a);
} else if (b <= 9.2e-10) {
tmp = -0.3333333333333333 * ((b - sqrt(((b * b) - (3.0 * (a * c))))) / a);
} else {
tmp = -0.5 * (c / 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 <= (-2.8d+151)) then
tmp = (b / 3.0d0) * ((-2.0d0) / a)
else if (b <= 9.2d-10) then
tmp = (-0.3333333333333333d0) * ((b - sqrt(((b * b) - (3.0d0 * (a * c))))) / a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.8e+151) {
tmp = (b / 3.0) * (-2.0 / a);
} else if (b <= 9.2e-10) {
tmp = -0.3333333333333333 * ((b - Math.sqrt(((b * b) - (3.0 * (a * c))))) / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.8e+151: tmp = (b / 3.0) * (-2.0 / a) elif b <= 9.2e-10: tmp = -0.3333333333333333 * ((b - math.sqrt(((b * b) - (3.0 * (a * c))))) / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.8e+151) tmp = Float64(Float64(b / 3.0) * Float64(-2.0 / a)); elseif (b <= 9.2e-10) tmp = Float64(-0.3333333333333333 * Float64(Float64(b - sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c))))) / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.8e+151) tmp = (b / 3.0) * (-2.0 / a); elseif (b <= 9.2e-10) tmp = -0.3333333333333333 * ((b - sqrt(((b * b) - (3.0 * (a * c))))) / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.8e+151], N[(N[(b / 3.0), $MachinePrecision] * N[(-2.0 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9.2e-10], N[(-0.3333333333333333 * N[(N[(b - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.8 \cdot 10^{+151}:\\
\;\;\;\;\frac{b}{3} \cdot \frac{-2}{a}\\
\mathbf{elif}\;b \leq 9.2 \cdot 10^{-10}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -2.79999999999999987e151Initial program 49.6%
Taylor expanded in b around -inf 99.8%
*-commutative99.8%
Simplified99.8%
times-frac99.8%
Applied egg-rr99.8%
if -2.79999999999999987e151 < b < 9.20000000000000028e-10Initial program 80.7%
/-rgt-identity80.7%
metadata-eval80.7%
associate-/l*80.7%
associate-*r/80.6%
*-commutative80.6%
associate-*l/80.7%
associate-*r/80.7%
metadata-eval80.7%
metadata-eval80.7%
times-frac80.7%
neg-mul-180.7%
distribute-rgt-neg-in80.7%
times-frac80.5%
metadata-eval80.5%
neg-mul-180.5%
Simplified80.5%
fma-udef80.5%
associate-*r*80.5%
*-commutative80.5%
metadata-eval80.5%
cancel-sign-sub-inv80.5%
Applied egg-rr80.5%
if 9.20000000000000028e-10 < b Initial program 8.0%
Taylor expanded in b around inf 93.9%
Final simplification88.3%
(FPCore (a b c)
:precision binary64
(if (<= b -7.8e+146)
(/ (* b -2.0) (* 3.0 a))
(if (<= b 7.5e-10)
(* (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (/ 0.3333333333333333 a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.8e+146) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 7.5e-10) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) * (0.3333333333333333 / a);
} else {
tmp = -0.5 * (c / 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.8d+146)) then
tmp = (b * (-2.0d0)) / (3.0d0 * a)
else if (b <= 7.5d-10) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) * (0.3333333333333333d0 / a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -7.8e+146) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 7.5e-10) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) * (0.3333333333333333 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7.8e+146: tmp = (b * -2.0) / (3.0 * a) elif b <= 7.5e-10: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) * (0.3333333333333333 / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7.8e+146) tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a)); elseif (b <= 7.5e-10) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) * Float64(0.3333333333333333 / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -7.8e+146) tmp = (b * -2.0) / (3.0 * a); elseif (b <= 7.5e-10) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) * (0.3333333333333333 / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7.8e+146], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.5e-10], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.8 \cdot 10^{+146}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq 7.5 \cdot 10^{-10}:\\
\;\;\;\;\left(\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -7.8e146Initial program 50.6%
Taylor expanded in b around -inf 99.8%
*-commutative99.8%
Simplified99.8%
if -7.8e146 < b < 7.49999999999999995e-10Initial program 80.6%
neg-sub080.6%
associate-+l-80.6%
sub0-neg80.6%
neg-mul-180.6%
associate-*r/80.6%
*-commutative80.6%
metadata-eval80.6%
metadata-eval80.6%
times-frac80.6%
*-commutative80.6%
times-frac80.4%
Simplified80.4%
fma-udef80.4%
associate-*r*80.4%
*-commutative80.4%
metadata-eval80.4%
cancel-sign-sub-inv80.4%
Applied egg-rr80.4%
if 7.49999999999999995e-10 < b Initial program 8.0%
Taylor expanded in b around inf 93.9%
Final simplification88.3%
(FPCore (a b c)
:precision binary64
(if (<= b -2.7e+151)
(* (/ b 3.0) (/ -2.0 a))
(if (<= b 7e-10)
(/ (* (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) 0.3333333333333333) a)
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.7e+151) {
tmp = (b / 3.0) * (-2.0 / a);
} else if (b <= 7e-10) {
tmp = ((sqrt(((b * b) - (3.0 * (a * c)))) - b) * 0.3333333333333333) / a;
} else {
tmp = -0.5 * (c / 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 <= (-2.7d+151)) then
tmp = (b / 3.0d0) * ((-2.0d0) / a)
else if (b <= 7d-10) then
tmp = ((sqrt(((b * b) - (3.0d0 * (a * c)))) - b) * 0.3333333333333333d0) / a
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.7e+151) {
tmp = (b / 3.0) * (-2.0 / a);
} else if (b <= 7e-10) {
tmp = ((Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) * 0.3333333333333333) / a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.7e+151: tmp = (b / 3.0) * (-2.0 / a) elif b <= 7e-10: tmp = ((math.sqrt(((b * b) - (3.0 * (a * c)))) - b) * 0.3333333333333333) / a else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.7e+151) tmp = Float64(Float64(b / 3.0) * Float64(-2.0 / a)); elseif (b <= 7e-10) tmp = Float64(Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) * 0.3333333333333333) / a); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.7e+151) tmp = (b / 3.0) * (-2.0 / a); elseif (b <= 7e-10) tmp = ((sqrt(((b * b) - (3.0 * (a * c)))) - b) * 0.3333333333333333) / a; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.7e+151], N[(N[(b / 3.0), $MachinePrecision] * N[(-2.0 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-10], N[(N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] / a), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.7 \cdot 10^{+151}:\\
\;\;\;\;\frac{b}{3} \cdot \frac{-2}{a}\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-10}:\\
\;\;\;\;\frac{\left(\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b\right) \cdot 0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -2.7000000000000001e151Initial program 49.6%
Taylor expanded in b around -inf 99.8%
*-commutative99.8%
Simplified99.8%
times-frac99.8%
Applied egg-rr99.8%
if -2.7000000000000001e151 < b < 6.99999999999999961e-10Initial program 80.7%
neg-sub080.7%
associate-+l-80.7%
sub0-neg80.7%
neg-mul-180.7%
associate-*r/80.7%
*-commutative80.7%
metadata-eval80.7%
metadata-eval80.7%
times-frac80.7%
*-commutative80.7%
times-frac80.6%
Simplified80.5%
fma-udef80.5%
associate-*r*80.5%
*-commutative80.5%
metadata-eval80.5%
cancel-sign-sub-inv80.5%
Applied egg-rr80.5%
associate-*r/80.6%
Applied egg-rr80.6%
if 6.99999999999999961e-10 < b Initial program 8.0%
Taylor expanded in b around inf 93.9%
Final simplification88.3%
(FPCore (a b c)
:precision binary64
(if (<= b -6.4e+151)
(* (/ b 3.0) (/ -2.0 a))
(if (<= b 6e-9)
(/ (- (sqrt (+ (* b b) (* a (* c -3.0)))) b) (* 3.0 a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.4e+151) {
tmp = (b / 3.0) * (-2.0 / a);
} else if (b <= 6e-9) {
tmp = (sqrt(((b * b) + (a * (c * -3.0)))) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / 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 <= (-6.4d+151)) then
tmp = (b / 3.0d0) * ((-2.0d0) / a)
else if (b <= 6d-9) then
tmp = (sqrt(((b * b) + (a * (c * (-3.0d0))))) - b) / (3.0d0 * a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -6.4e+151) {
tmp = (b / 3.0) * (-2.0 / a);
} else if (b <= 6e-9) {
tmp = (Math.sqrt(((b * b) + (a * (c * -3.0)))) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.4e+151: tmp = (b / 3.0) * (-2.0 / a) elif b <= 6e-9: tmp = (math.sqrt(((b * b) + (a * (c * -3.0)))) - b) / (3.0 * a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.4e+151) tmp = Float64(Float64(b / 3.0) * Float64(-2.0 / a)); elseif (b <= 6e-9) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(a * Float64(c * -3.0)))) - b) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6.4e+151) tmp = (b / 3.0) * (-2.0 / a); elseif (b <= 6e-9) tmp = (sqrt(((b * b) + (a * (c * -3.0)))) - b) / (3.0 * a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.4e+151], N[(N[(b / 3.0), $MachinePrecision] * N[(-2.0 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6e-9], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.4 \cdot 10^{+151}:\\
\;\;\;\;\frac{b}{3} \cdot \frac{-2}{a}\\
\mathbf{elif}\;b \leq 6 \cdot 10^{-9}:\\
\;\;\;\;\frac{\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -6.39999999999999988e151Initial program 49.6%
Taylor expanded in b around -inf 99.8%
*-commutative99.8%
Simplified99.8%
times-frac99.8%
Applied egg-rr99.8%
if -6.39999999999999988e151 < b < 5.99999999999999996e-9Initial program 80.7%
associate-*r*80.6%
cancel-sign-sub-inv80.6%
metadata-eval80.6%
*-commutative80.6%
associate-*r*80.6%
Applied egg-rr80.6%
if 5.99999999999999996e-9 < b Initial program 8.0%
Taylor expanded in b around inf 93.9%
Final simplification88.3%
(FPCore (a b c)
:precision binary64
(if (<= b -8.5e+152)
(* (/ b 3.0) (/ -2.0 a))
(if (<= b 8e-10)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* 3.0 a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -8.5e+152) {
tmp = (b / 3.0) * (-2.0 / a);
} else if (b <= 8e-10) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / 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 <= (-8.5d+152)) then
tmp = (b / 3.0d0) * ((-2.0d0) / a)
else if (b <= 8d-10) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (3.0d0 * a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -8.5e+152) {
tmp = (b / 3.0) * (-2.0 / a);
} else if (b <= 8e-10) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -8.5e+152: tmp = (b / 3.0) * (-2.0 / a) elif b <= 8e-10: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -8.5e+152) tmp = Float64(Float64(b / 3.0) * Float64(-2.0 / a)); elseif (b <= 8e-10) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -8.5e+152) tmp = (b / 3.0) * (-2.0 / a); elseif (b <= 8e-10) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -8.5e+152], N[(N[(b / 3.0), $MachinePrecision] * N[(-2.0 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8e-10], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{b}{3} \cdot \frac{-2}{a}\\
\mathbf{elif}\;b \leq 8 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -8.4999999999999993e152Initial program 49.6%
Taylor expanded in b around -inf 99.8%
*-commutative99.8%
Simplified99.8%
times-frac99.8%
Applied egg-rr99.8%
if -8.4999999999999993e152 < b < 8.00000000000000029e-10Initial program 80.7%
neg-sub080.7%
associate-+l-80.7%
sub0-neg80.7%
neg-mul-180.7%
associate-*r/80.7%
metadata-eval80.7%
metadata-eval80.7%
times-frac80.7%
*-commutative80.7%
times-frac80.6%
associate-*l/80.7%
Simplified80.6%
if 8.00000000000000029e-10 < b Initial program 8.0%
Taylor expanded in b around inf 93.9%
Final simplification88.3%
(FPCore (a b c)
:precision binary64
(if (<= b -1.62e-74)
(+ (/ (* b -0.6666666666666666) a) (* (/ c b) 0.5))
(if (<= b 7.2e-10)
(* 0.3333333333333333 (/ (- (sqrt (* c (* a -3.0))) b) a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.62e-74) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 7.2e-10) {
tmp = 0.3333333333333333 * ((sqrt((c * (a * -3.0))) - b) / a);
} else {
tmp = -0.5 * (c / 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.62d-74)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + ((c / b) * 0.5d0)
else if (b <= 7.2d-10) then
tmp = 0.3333333333333333d0 * ((sqrt((c * (a * (-3.0d0)))) - b) / a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.62e-74) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 7.2e-10) {
tmp = 0.3333333333333333 * ((Math.sqrt((c * (a * -3.0))) - b) / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.62e-74: tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5) elif b <= 7.2e-10: tmp = 0.3333333333333333 * ((math.sqrt((c * (a * -3.0))) - b) / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.62e-74) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(Float64(c / b) * 0.5)); elseif (b <= 7.2e-10) tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.62e-74) tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5); elseif (b <= 7.2e-10) tmp = 0.3333333333333333 * ((sqrt((c * (a * -3.0))) - b) / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.62e-74], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.2e-10], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.62 \cdot 10^{-74}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-10}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.62000000000000007e-74Initial program 70.5%
Taylor expanded in b around -inf 90.5%
associate-*r/90.6%
Applied egg-rr90.6%
if -1.62000000000000007e-74 < b < 7.2e-10Initial program 74.0%
Taylor expanded in b around 0 67.8%
*-commutative67.8%
*-commutative67.8%
*-commutative67.8%
associate-*l*68.0%
Simplified68.0%
pow1/268.0%
*-commutative68.0%
unpow-prod-down47.8%
pow1/247.8%
pow1/247.8%
Applied egg-rr47.8%
clear-num47.8%
inv-pow47.8%
neg-mul-147.8%
fma-def47.8%
sqrt-unprod67.9%
Applied egg-rr67.9%
unpow-167.9%
associate-/l*67.8%
associate-/r/67.8%
metadata-eval67.8%
fma-udef67.8%
*-commutative67.8%
fma-def67.8%
*-commutative67.8%
Simplified67.8%
div-inv67.8%
Applied egg-rr67.8%
associate-*r/67.8%
*-rgt-identity67.8%
fma-udef67.8%
*-commutative67.8%
neg-mul-167.8%
+-commutative67.8%
unsub-neg67.8%
Simplified67.8%
if 7.2e-10 < b Initial program 8.0%
Taylor expanded in b around inf 93.9%
Final simplification84.0%
(FPCore (a b c)
:precision binary64
(if (<= b -1.45e-74)
(+ (/ (* b -0.6666666666666666) a) (* (/ c b) 0.5))
(if (<= b 7e-10)
(* (/ 0.3333333333333333 a) (- (sqrt (* c (* a -3.0))) b))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.45e-74) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 7e-10) {
tmp = (0.3333333333333333 / a) * (sqrt((c * (a * -3.0))) - b);
} else {
tmp = -0.5 * (c / 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.45d-74)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + ((c / b) * 0.5d0)
else if (b <= 7d-10) then
tmp = (0.3333333333333333d0 / a) * (sqrt((c * (a * (-3.0d0)))) - b)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.45e-74) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 7e-10) {
tmp = (0.3333333333333333 / a) * (Math.sqrt((c * (a * -3.0))) - b);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.45e-74: tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5) elif b <= 7e-10: tmp = (0.3333333333333333 / a) * (math.sqrt((c * (a * -3.0))) - b) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.45e-74) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(Float64(c / b) * 0.5)); elseif (b <= 7e-10) tmp = Float64(Float64(0.3333333333333333 / a) * Float64(sqrt(Float64(c * Float64(a * -3.0))) - b)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.45e-74) tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5); elseif (b <= 7e-10) tmp = (0.3333333333333333 / a) * (sqrt((c * (a * -3.0))) - b); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.45e-74], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-10], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.45 \cdot 10^{-74}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-10}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(\sqrt{c \cdot \left(a \cdot -3\right)} - b\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.45e-74Initial program 70.5%
Taylor expanded in b around -inf 90.5%
associate-*r/90.6%
Applied egg-rr90.6%
if -1.45e-74 < b < 6.99999999999999961e-10Initial program 74.0%
Taylor expanded in b around 0 67.8%
*-commutative67.8%
*-commutative67.8%
*-commutative67.8%
associate-*l*68.0%
Simplified68.0%
pow1/268.0%
*-commutative68.0%
unpow-prod-down47.8%
pow1/247.8%
pow1/247.8%
Applied egg-rr47.8%
clear-num47.8%
inv-pow47.8%
neg-mul-147.8%
fma-def47.8%
sqrt-unprod67.9%
Applied egg-rr67.9%
unpow-167.9%
associate-/l*67.8%
associate-/r/67.8%
metadata-eval67.8%
fma-udef67.8%
*-commutative67.8%
fma-def67.8%
*-commutative67.8%
Simplified67.8%
associate-*r/67.8%
Applied egg-rr67.8%
associate-/l*67.9%
associate-/r/67.8%
fma-udef67.8%
*-commutative67.8%
neg-mul-167.8%
+-commutative67.8%
unsub-neg67.8%
Simplified67.8%
if 6.99999999999999961e-10 < b Initial program 8.0%
Taylor expanded in b around inf 93.9%
Final simplification84.0%
(FPCore (a b c)
:precision binary64
(if (<= b -1.62e-74)
(+ (/ (* b -0.6666666666666666) a) (* (/ c b) 0.5))
(if (<= b 7.2e-10)
(/ (- (sqrt (* (* a c) -3.0)) b) (* 3.0 a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.62e-74) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 7.2e-10) {
tmp = (sqrt(((a * c) * -3.0)) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / 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.62d-74)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + ((c / b) * 0.5d0)
else if (b <= 7.2d-10) then
tmp = (sqrt(((a * c) * (-3.0d0))) - b) / (3.0d0 * a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.62e-74) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 7.2e-10) {
tmp = (Math.sqrt(((a * c) * -3.0)) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.62e-74: tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5) elif b <= 7.2e-10: tmp = (math.sqrt(((a * c) * -3.0)) - b) / (3.0 * a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.62e-74) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(Float64(c / b) * 0.5)); elseif (b <= 7.2e-10) tmp = Float64(Float64(sqrt(Float64(Float64(a * c) * -3.0)) - b) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.62e-74) tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5); elseif (b <= 7.2e-10) tmp = (sqrt(((a * c) * -3.0)) - b) / (3.0 * a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.62e-74], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.2e-10], N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.62 \cdot 10^{-74}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.62000000000000007e-74Initial program 70.5%
Taylor expanded in b around -inf 90.5%
associate-*r/90.6%
Applied egg-rr90.6%
if -1.62000000000000007e-74 < b < 7.2e-10Initial program 74.0%
Taylor expanded in b around 0 67.8%
if 7.2e-10 < b Initial program 8.0%
Taylor expanded in b around inf 93.9%
Final simplification84.0%
(FPCore (a b c)
:precision binary64
(if (<= b -1.62e-74)
(+ (/ (* b -0.6666666666666666) a) (* (/ c b) 0.5))
(if (<= b 7e-10)
(/ (- (sqrt (* c (* a -3.0))) b) (* 3.0 a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.62e-74) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 7e-10) {
tmp = (sqrt((c * (a * -3.0))) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / 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.62d-74)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + ((c / b) * 0.5d0)
else if (b <= 7d-10) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (3.0d0 * a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.62e-74) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 7e-10) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.62e-74: tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5) elif b <= 7e-10: tmp = (math.sqrt((c * (a * -3.0))) - b) / (3.0 * a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.62e-74) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(Float64(c / b) * 0.5)); elseif (b <= 7e-10) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.62e-74) tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5); elseif (b <= 7e-10) tmp = (sqrt((c * (a * -3.0))) - b) / (3.0 * a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.62e-74], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-10], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.62 \cdot 10^{-74}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.62000000000000007e-74Initial program 70.5%
Taylor expanded in b around -inf 90.5%
associate-*r/90.6%
Applied egg-rr90.6%
if -1.62000000000000007e-74 < b < 6.99999999999999961e-10Initial program 74.0%
Taylor expanded in b around 0 67.8%
*-commutative67.8%
*-commutative67.8%
*-commutative67.8%
associate-*l*68.0%
Simplified68.0%
if 6.99999999999999961e-10 < b Initial program 8.0%
Taylor expanded in b around inf 93.9%
Final simplification84.1%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (+ (* (/ c b) 0.5) (* -0.6666666666666666 (/ b a))) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = ((c / b) * 0.5) + (-0.6666666666666666 * (b / a));
} else {
tmp = -0.5 * (c / 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-310)) then
tmp = ((c / b) * 0.5d0) + ((-0.6666666666666666d0) * (b / a))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = ((c / b) * 0.5) + (-0.6666666666666666 * (b / a));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = ((c / b) * 0.5) + (-0.6666666666666666 * (b / a)) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(Float64(c / b) * 0.5) + Float64(-0.6666666666666666 * Float64(b / a))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = ((c / b) * 0.5) + (-0.6666666666666666 * (b / a)); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision] + N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{c}{b} \cdot 0.5 + -0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 74.9%
Taylor expanded in b around -inf 68.3%
if -4.999999999999985e-310 < b Initial program 29.8%
Taylor expanded in b around inf 67.9%
Final simplification68.1%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (+ (/ (* b -0.6666666666666666) a) (* (/ c b) 0.5)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else {
tmp = -0.5 * (c / 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-310)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + ((c / b) * 0.5d0)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(Float64(c / b) * 0.5)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 74.9%
Taylor expanded in b around -inf 68.3%
associate-*r/68.4%
Applied egg-rr68.4%
if -4.999999999999985e-310 < b Initial program 29.8%
Taylor expanded in b around inf 67.9%
Final simplification68.1%
(FPCore (a b c) :precision binary64 (if (<= b 6e-267) (/ (* b -2.0) (* 3.0 a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 6e-267) {
tmp = (b * -2.0) / (3.0 * a);
} else {
tmp = -0.5 * (c / 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-267) then
tmp = (b * (-2.0d0)) / (3.0d0 * a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 6e-267) {
tmp = (b * -2.0) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 6e-267: tmp = (b * -2.0) / (3.0 * a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 6e-267) tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 6e-267) tmp = (b * -2.0) / (3.0 * a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 6e-267], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 6 \cdot 10^{-267}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 5.9999999999999999e-267Initial program 75.8%
Taylor expanded in b around -inf 65.6%
*-commutative65.6%
Simplified65.6%
if 5.9999999999999999e-267 < b Initial program 26.9%
Taylor expanded in b around inf 70.6%
Final simplification68.0%
(FPCore (a b c) :precision binary64 (if (<= b 6e-267) (* b (/ -0.6666666666666666 a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 6e-267) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = -0.5 * (c / 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-267) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 6e-267) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 6e-267: tmp = b * (-0.6666666666666666 / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 6e-267) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 6e-267) tmp = b * (-0.6666666666666666 / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 6e-267], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 6 \cdot 10^{-267}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 5.9999999999999999e-267Initial program 75.8%
Taylor expanded in b around -inf 65.6%
*-commutative65.6%
Simplified65.6%
div-inv65.5%
Applied egg-rr65.5%
associate-*l*65.5%
associate-/r*65.5%
metadata-eval65.5%
associate-*r/65.5%
metadata-eval65.5%
Simplified65.5%
if 5.9999999999999999e-267 < b Initial program 26.9%
Taylor expanded in b around inf 70.6%
Final simplification67.9%
(FPCore (a b c) :precision binary64 (if (<= b 6e-267) (/ b (/ a -0.6666666666666666)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 6e-267) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = -0.5 * (c / 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-267) then
tmp = b / (a / (-0.6666666666666666d0))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 6e-267) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 6e-267: tmp = b / (a / -0.6666666666666666) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 6e-267) tmp = Float64(b / Float64(a / -0.6666666666666666)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 6e-267) tmp = b / (a / -0.6666666666666666); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 6e-267], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 6 \cdot 10^{-267}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 5.9999999999999999e-267Initial program 75.8%
neg-sub075.8%
associate-+l-75.8%
sub0-neg75.8%
neg-mul-175.8%
associate-*r/75.8%
*-commutative75.8%
metadata-eval75.8%
metadata-eval75.8%
times-frac75.8%
*-commutative75.8%
times-frac75.7%
Simplified75.7%
fma-udef75.7%
associate-*r*75.6%
*-commutative75.6%
metadata-eval75.6%
cancel-sign-sub-inv75.6%
Applied egg-rr75.6%
Taylor expanded in b around -inf 65.5%
*-commutative65.5%
associate-/r/65.6%
Simplified65.6%
if 5.9999999999999999e-267 < b Initial program 26.9%
Taylor expanded in b around inf 70.6%
Final simplification67.9%
(FPCore (a b c) :precision binary64 (if (<= b 6e-267) (/ (* b -0.6666666666666666) a) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 6e-267) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = -0.5 * (c / 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-267) then
tmp = (b * (-0.6666666666666666d0)) / a
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 6e-267) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 6e-267: tmp = (b * -0.6666666666666666) / a else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 6e-267) tmp = Float64(Float64(b * -0.6666666666666666) / a); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 6e-267) tmp = (b * -0.6666666666666666) / a; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 6e-267], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 6 \cdot 10^{-267}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 5.9999999999999999e-267Initial program 75.8%
associate-*r*75.7%
cancel-sign-sub-inv75.7%
metadata-eval75.7%
*-commutative75.7%
associate-*r*75.7%
Applied egg-rr75.7%
Taylor expanded in b around -inf 65.5%
associate-*r/65.6%
*-commutative65.6%
Simplified65.6%
if 5.9999999999999999e-267 < b Initial program 26.9%
Taylor expanded in b around inf 70.6%
Final simplification67.9%
(FPCore (a b c) :precision binary64 (* -0.5 (/ c b)))
double code(double a, double b, double c) {
return -0.5 * (c / b);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-0.5d0) * (c / b)
end function
public static double code(double a, double b, double c) {
return -0.5 * (c / b);
}
def code(a, b, c): return -0.5 * (c / b)
function code(a, b, c) return Float64(-0.5 * Float64(c / b)) end
function tmp = code(a, b, c) tmp = -0.5 * (c / b); end
code[a_, b_, c_] := N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \frac{c}{b}
\end{array}
Initial program 52.9%
Taylor expanded in b around inf 34.2%
Final simplification34.2%
herbie shell --seed 2023199
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))