
(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 -1e+153)
(* (/ b a) -0.6666666666666666)
(if (<= b 6e-36)
(/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
(/ 1.0 (fma 1.5 (/ a b) (* b (/ -2.0 c)))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e+153) {
tmp = (b / a) * -0.6666666666666666;
} else if (b <= 6e-36) {
tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = 1.0 / fma(1.5, (a / b), (b * (-2.0 / c)));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -1e+153) tmp = Float64(Float64(b / a) * -0.6666666666666666); elseif (b <= 6e-36) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0)); else tmp = Float64(1.0 / fma(1.5, Float64(a / b), Float64(b * Float64(-2.0 / c)))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -1e+153], N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision], If[LessEqual[b, 6e-36], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * 3.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.5 * N[(a / b), $MachinePrecision] + N[(b * N[(-2.0 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+153}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{elif}\;b \leq 6 \cdot 10^{-36}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(1.5, \frac{a}{b}, b \cdot \frac{-2}{c}\right)}\\
\end{array}
\end{array}
if b < -1e153Initial program 36.3%
sqr-neg36.3%
sqr-neg36.3%
associate-*l*36.3%
Simplified36.3%
Taylor expanded in b around -inf 95.1%
*-commutative95.1%
Simplified95.1%
if -1e153 < b < 6.0000000000000003e-36Initial program 77.8%
if 6.0000000000000003e-36 < b Initial program 17.6%
sqr-neg17.6%
sqr-neg17.6%
associate-*l*17.6%
Simplified17.6%
frac-2neg17.6%
div-inv17.5%
Applied egg-rr17.5%
un-div-inv17.6%
associate-/r*17.6%
fma-undefine17.6%
add-sqr-sqrt14.8%
hypot-define23.5%
Applied egg-rr23.5%
clear-num23.5%
inv-pow23.5%
Applied egg-rr23.5%
unpow-123.5%
associate-/r/23.5%
Simplified23.5%
Taylor expanded in a around 0 0.0%
fma-define0.0%
*-commutative0.0%
associate-*l/0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt88.0%
associate-/r*88.1%
metadata-eval88.1%
Simplified88.1%
Final simplification84.5%
(FPCore (a b c)
:precision binary64
(if (<= b -2e+153)
(* (/ b a) -0.6666666666666666)
(if (<= b 1.05e-32)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
(/ 1.0 (fma 1.5 (/ a b) (* b (/ -2.0 c)))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e+153) {
tmp = (b / a) * -0.6666666666666666;
} else if (b <= 1.05e-32) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = 1.0 / fma(1.5, (a / b), (b * (-2.0 / c)));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2e+153) tmp = Float64(Float64(b / a) * -0.6666666666666666); elseif (b <= 1.05e-32) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0)); else tmp = Float64(1.0 / fma(1.5, Float64(a / b), Float64(b * Float64(-2.0 / c)))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2e+153], N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision], If[LessEqual[b, 1.05e-32], 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[(1.0 / N[(1.5 * N[(a / b), $MachinePrecision] + N[(b * N[(-2.0 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{+153}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{elif}\;b \leq 1.05 \cdot 10^{-32}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(1.5, \frac{a}{b}, b \cdot \frac{-2}{c}\right)}\\
\end{array}
\end{array}
if b < -2e153Initial program 36.3%
sqr-neg36.3%
sqr-neg36.3%
associate-*l*36.3%
Simplified36.3%
Taylor expanded in b around -inf 95.1%
*-commutative95.1%
Simplified95.1%
if -2e153 < b < 1.05e-32Initial program 77.8%
sqr-neg77.8%
sqr-neg77.8%
associate-*l*77.6%
Simplified77.6%
if 1.05e-32 < b Initial program 17.6%
sqr-neg17.6%
sqr-neg17.6%
associate-*l*17.6%
Simplified17.6%
frac-2neg17.6%
div-inv17.5%
Applied egg-rr17.5%
un-div-inv17.6%
associate-/r*17.6%
fma-undefine17.6%
add-sqr-sqrt14.8%
hypot-define23.5%
Applied egg-rr23.5%
clear-num23.5%
inv-pow23.5%
Applied egg-rr23.5%
unpow-123.5%
associate-/r/23.5%
Simplified23.5%
Taylor expanded in a around 0 0.0%
fma-define0.0%
*-commutative0.0%
associate-*l/0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt88.0%
associate-/r*88.1%
metadata-eval88.1%
Simplified88.1%
Final simplification84.4%
(FPCore (a b c)
:precision binary64
(if (<= b -0.0003)
(* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
(if (<= b 7e-36)
(* (- b (sqrt (* c (* a -3.0)))) (/ 1.0 (* a -3.0)))
(/ 1.0 (fma 1.5 (/ a b) (* b (/ -2.0 c)))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -0.0003) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else if (b <= 7e-36) {
tmp = (b - sqrt((c * (a * -3.0)))) * (1.0 / (a * -3.0));
} else {
tmp = 1.0 / fma(1.5, (a / b), (b * (-2.0 / c)));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -0.0003) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); elseif (b <= 7e-36) tmp = Float64(Float64(b - sqrt(Float64(c * Float64(a * -3.0)))) * Float64(1.0 / Float64(a * -3.0))); else tmp = Float64(1.0 / fma(1.5, Float64(a / b), Float64(b * Float64(-2.0 / c)))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -0.0003], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-36], N[(N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.5 * N[(a / b), $MachinePrecision] + N[(b * N[(-2.0 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0003:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-36}:\\
\;\;\;\;\left(b - \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{1}{a \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(1.5, \frac{a}{b}, b \cdot \frac{-2}{c}\right)}\\
\end{array}
\end{array}
if b < -2.99999999999999974e-4Initial program 56.0%
sqr-neg56.0%
sqr-neg56.0%
associate-*l*56.0%
Simplified56.0%
Taylor expanded in b around -inf 90.2%
if -2.99999999999999974e-4 < b < 6.9999999999999999e-36Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.4%
Simplified74.4%
frac-2neg74.4%
div-inv74.4%
Applied egg-rr74.6%
Taylor expanded in b around 0 66.3%
associate-*r*66.4%
*-commutative66.4%
*-commutative66.4%
Simplified66.4%
if 6.9999999999999999e-36 < b Initial program 17.6%
sqr-neg17.6%
sqr-neg17.6%
associate-*l*17.6%
Simplified17.6%
frac-2neg17.6%
div-inv17.5%
Applied egg-rr17.5%
un-div-inv17.6%
associate-/r*17.6%
fma-undefine17.6%
add-sqr-sqrt14.8%
hypot-define23.5%
Applied egg-rr23.5%
clear-num23.5%
inv-pow23.5%
Applied egg-rr23.5%
unpow-123.5%
associate-/r/23.5%
Simplified23.5%
Taylor expanded in a around 0 0.0%
fma-define0.0%
*-commutative0.0%
associate-*l/0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt88.0%
associate-/r*88.1%
metadata-eval88.1%
Simplified88.1%
Final simplification80.8%
(FPCore (a b c)
:precision binary64
(if (<= b -0.0003)
(/ -0.6666666666666666 (/ a b))
(if (<= b 4.2e-36)
(* (- b (sqrt (* c (* a -3.0)))) (/ 1.0 (* a -3.0)))
(/ 1.0 (fma 1.5 (/ a b) (* b (/ -2.0 c)))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -0.0003) {
tmp = -0.6666666666666666 / (a / b);
} else if (b <= 4.2e-36) {
tmp = (b - sqrt((c * (a * -3.0)))) * (1.0 / (a * -3.0));
} else {
tmp = 1.0 / fma(1.5, (a / b), (b * (-2.0 / c)));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -0.0003) tmp = Float64(-0.6666666666666666 / Float64(a / b)); elseif (b <= 4.2e-36) tmp = Float64(Float64(b - sqrt(Float64(c * Float64(a * -3.0)))) * Float64(1.0 / Float64(a * -3.0))); else tmp = Float64(1.0 / fma(1.5, Float64(a / b), Float64(b * Float64(-2.0 / c)))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -0.0003], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.2e-36], N[(N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.5 * N[(a / b), $MachinePrecision] + N[(b * N[(-2.0 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0003:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{elif}\;b \leq 4.2 \cdot 10^{-36}:\\
\;\;\;\;\left(b - \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{1}{a \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(1.5, \frac{a}{b}, b \cdot \frac{-2}{c}\right)}\\
\end{array}
\end{array}
if b < -2.99999999999999974e-4Initial program 56.0%
sqr-neg56.0%
sqr-neg56.0%
associate-*l*56.0%
Simplified56.0%
Taylor expanded in b around -inf 89.8%
*-commutative89.8%
Simplified89.8%
*-commutative89.8%
clear-num89.7%
un-div-inv89.9%
Applied egg-rr89.9%
if -2.99999999999999974e-4 < b < 4.19999999999999982e-36Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.4%
Simplified74.4%
frac-2neg74.4%
div-inv74.4%
Applied egg-rr74.6%
Taylor expanded in b around 0 66.3%
associate-*r*66.4%
*-commutative66.4%
*-commutative66.4%
Simplified66.4%
if 4.19999999999999982e-36 < b Initial program 17.6%
sqr-neg17.6%
sqr-neg17.6%
associate-*l*17.6%
Simplified17.6%
frac-2neg17.6%
div-inv17.5%
Applied egg-rr17.5%
un-div-inv17.6%
associate-/r*17.6%
fma-undefine17.6%
add-sqr-sqrt14.8%
hypot-define23.5%
Applied egg-rr23.5%
clear-num23.5%
inv-pow23.5%
Applied egg-rr23.5%
unpow-123.5%
associate-/r/23.5%
Simplified23.5%
Taylor expanded in a around 0 0.0%
fma-define0.0%
*-commutative0.0%
associate-*l/0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt88.0%
associate-/r*88.1%
metadata-eval88.1%
Simplified88.1%
(FPCore (a b c)
:precision binary64
(if (<= b -0.0003)
(/ -0.6666666666666666 (/ a b))
(if (<= b 1.55e-35)
(/ (- b (sqrt (* c (* a -3.0)))) (* a -3.0))
(/ 1.0 (fma 1.5 (/ a b) (* b (/ -2.0 c)))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -0.0003) {
tmp = -0.6666666666666666 / (a / b);
} else if (b <= 1.55e-35) {
tmp = (b - sqrt((c * (a * -3.0)))) / (a * -3.0);
} else {
tmp = 1.0 / fma(1.5, (a / b), (b * (-2.0 / c)));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -0.0003) tmp = Float64(-0.6666666666666666 / Float64(a / b)); elseif (b <= 1.55e-35) tmp = Float64(Float64(b - sqrt(Float64(c * Float64(a * -3.0)))) / Float64(a * -3.0)); else tmp = Float64(1.0 / fma(1.5, Float64(a / b), Float64(b * Float64(-2.0 / c)))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -0.0003], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.55e-35], N[(N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(a * -3.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.5 * N[(a / b), $MachinePrecision] + N[(b * N[(-2.0 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0003:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{elif}\;b \leq 1.55 \cdot 10^{-35}:\\
\;\;\;\;\frac{b - \sqrt{c \cdot \left(a \cdot -3\right)}}{a \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(1.5, \frac{a}{b}, b \cdot \frac{-2}{c}\right)}\\
\end{array}
\end{array}
if b < -2.99999999999999974e-4Initial program 56.0%
sqr-neg56.0%
sqr-neg56.0%
associate-*l*56.0%
Simplified56.0%
Taylor expanded in b around -inf 89.8%
*-commutative89.8%
Simplified89.8%
*-commutative89.8%
clear-num89.7%
un-div-inv89.9%
Applied egg-rr89.9%
if -2.99999999999999974e-4 < b < 1.55000000000000006e-35Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.4%
Simplified74.4%
frac-2neg74.4%
div-inv74.4%
Applied egg-rr74.6%
Taylor expanded in b around 0 66.3%
associate-*r*66.4%
*-commutative66.4%
*-commutative66.4%
Simplified66.4%
un-div-inv66.4%
Applied egg-rr66.4%
if 1.55000000000000006e-35 < b Initial program 17.6%
sqr-neg17.6%
sqr-neg17.6%
associate-*l*17.6%
Simplified17.6%
frac-2neg17.6%
div-inv17.5%
Applied egg-rr17.5%
un-div-inv17.6%
associate-/r*17.6%
fma-undefine17.6%
add-sqr-sqrt14.8%
hypot-define23.5%
Applied egg-rr23.5%
clear-num23.5%
inv-pow23.5%
Applied egg-rr23.5%
unpow-123.5%
associate-/r/23.5%
Simplified23.5%
Taylor expanded in a around 0 0.0%
fma-define0.0%
*-commutative0.0%
associate-*l/0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt88.0%
associate-/r*88.1%
metadata-eval88.1%
Simplified88.1%
(FPCore (a b c)
:precision binary64
(if (<= b -0.0003)
(/ -0.6666666666666666 (/ a b))
(if (<= b 8e-36)
(* (- b (sqrt (* c (* a -3.0)))) (/ -0.3333333333333333 a))
(/ 1.0 (fma 1.5 (/ a b) (* b (/ -2.0 c)))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -0.0003) {
tmp = -0.6666666666666666 / (a / b);
} else if (b <= 8e-36) {
tmp = (b - sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a);
} else {
tmp = 1.0 / fma(1.5, (a / b), (b * (-2.0 / c)));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -0.0003) tmp = Float64(-0.6666666666666666 / Float64(a / b)); elseif (b <= 8e-36) tmp = Float64(Float64(b - sqrt(Float64(c * Float64(a * -3.0)))) * Float64(-0.3333333333333333 / a)); else tmp = Float64(1.0 / fma(1.5, Float64(a / b), Float64(b * Float64(-2.0 / c)))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -0.0003], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8e-36], N[(N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.5 * N[(a / b), $MachinePrecision] + N[(b * N[(-2.0 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0003:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{elif}\;b \leq 8 \cdot 10^{-36}:\\
\;\;\;\;\left(b - \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{-0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(1.5, \frac{a}{b}, b \cdot \frac{-2}{c}\right)}\\
\end{array}
\end{array}
if b < -2.99999999999999974e-4Initial program 56.0%
sqr-neg56.0%
sqr-neg56.0%
associate-*l*56.0%
Simplified56.0%
Taylor expanded in b around -inf 89.8%
*-commutative89.8%
Simplified89.8%
*-commutative89.8%
clear-num89.7%
un-div-inv89.9%
Applied egg-rr89.9%
if -2.99999999999999974e-4 < b < 7.9999999999999995e-36Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.4%
Simplified74.4%
frac-2neg74.4%
div-inv74.4%
Applied egg-rr74.6%
Taylor expanded in b around 0 66.3%
associate-*r*66.4%
*-commutative66.4%
*-commutative66.4%
Simplified66.4%
Taylor expanded in a around 0 66.3%
if 7.9999999999999995e-36 < b Initial program 17.6%
sqr-neg17.6%
sqr-neg17.6%
associate-*l*17.6%
Simplified17.6%
frac-2neg17.6%
div-inv17.5%
Applied egg-rr17.5%
un-div-inv17.6%
associate-/r*17.6%
fma-undefine17.6%
add-sqr-sqrt14.8%
hypot-define23.5%
Applied egg-rr23.5%
clear-num23.5%
inv-pow23.5%
Applied egg-rr23.5%
unpow-123.5%
associate-/r/23.5%
Simplified23.5%
Taylor expanded in a around 0 0.0%
fma-define0.0%
*-commutative0.0%
associate-*l/0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt88.0%
associate-/r*88.1%
metadata-eval88.1%
Simplified88.1%
(FPCore (a b c)
:precision binary64
(if (<= b -0.0003)
(/ -0.6666666666666666 (/ a b))
(if (<= b 4.6e-36)
(* (- b (sqrt (* c (* a -3.0)))) (/ -0.3333333333333333 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -0.0003) {
tmp = -0.6666666666666666 / (a / b);
} else if (b <= 4.6e-36) {
tmp = (b - sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / 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 <= (-0.0003d0)) then
tmp = (-0.6666666666666666d0) / (a / b)
else if (b <= 4.6d-36) then
tmp = (b - sqrt((c * (a * (-3.0d0))))) * ((-0.3333333333333333d0) / 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 <= -0.0003) {
tmp = -0.6666666666666666 / (a / b);
} else if (b <= 4.6e-36) {
tmp = (b - Math.sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -0.0003: tmp = -0.6666666666666666 / (a / b) elif b <= 4.6e-36: tmp = (b - math.sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -0.0003) tmp = Float64(-0.6666666666666666 / Float64(a / b)); elseif (b <= 4.6e-36) tmp = Float64(Float64(b - sqrt(Float64(c * Float64(a * -3.0)))) * Float64(-0.3333333333333333 / 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 <= -0.0003) tmp = -0.6666666666666666 / (a / b); elseif (b <= 4.6e-36) tmp = (b - sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -0.0003], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.6e-36], N[(N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0003:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{elif}\;b \leq 4.6 \cdot 10^{-36}:\\
\;\;\;\;\left(b - \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{-0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.99999999999999974e-4Initial program 56.0%
sqr-neg56.0%
sqr-neg56.0%
associate-*l*56.0%
Simplified56.0%
Taylor expanded in b around -inf 89.8%
*-commutative89.8%
Simplified89.8%
*-commutative89.8%
clear-num89.7%
un-div-inv89.9%
Applied egg-rr89.9%
if -2.99999999999999974e-4 < b < 4.59999999999999993e-36Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.4%
Simplified74.4%
frac-2neg74.4%
div-inv74.4%
Applied egg-rr74.6%
Taylor expanded in b around 0 66.3%
associate-*r*66.4%
*-commutative66.4%
*-commutative66.4%
Simplified66.4%
Taylor expanded in a around 0 66.3%
if 4.59999999999999993e-36 < b Initial program 17.6%
sqr-neg17.6%
sqr-neg17.6%
associate-*l*17.6%
Simplified17.6%
frac-2neg17.6%
div-inv17.5%
Applied egg-rr17.5%
Taylor expanded in b around inf 87.9%
associate-*r/87.9%
*-commutative87.9%
Simplified87.9%
(FPCore (a b c)
:precision binary64
(if (<= b -0.00038)
(/ -0.6666666666666666 (/ a b))
(if (<= b 2e-30)
(* 0.3333333333333333 (/ (sqrt (* c (* a -3.0))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -0.00038) {
tmp = -0.6666666666666666 / (a / b);
} else if (b <= 2e-30) {
tmp = 0.3333333333333333 * (sqrt((c * (a * -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 <= (-0.00038d0)) then
tmp = (-0.6666666666666666d0) / (a / b)
else if (b <= 2d-30) then
tmp = 0.3333333333333333d0 * (sqrt((c * (a * (-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 <= -0.00038) {
tmp = -0.6666666666666666 / (a / b);
} else if (b <= 2e-30) {
tmp = 0.3333333333333333 * (Math.sqrt((c * (a * -3.0))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -0.00038: tmp = -0.6666666666666666 / (a / b) elif b <= 2e-30: tmp = 0.3333333333333333 * (math.sqrt((c * (a * -3.0))) / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -0.00038) tmp = Float64(-0.6666666666666666 / Float64(a / b)); elseif (b <= 2e-30) tmp = Float64(0.3333333333333333 * Float64(sqrt(Float64(c * Float64(a * -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 <= -0.00038) tmp = -0.6666666666666666 / (a / b); elseif (b <= 2e-30) tmp = 0.3333333333333333 * (sqrt((c * (a * -3.0))) / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -0.00038], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2e-30], N[(0.3333333333333333 * N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.00038:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{elif}\;b \leq 2 \cdot 10^{-30}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3.8000000000000002e-4Initial program 56.0%
sqr-neg56.0%
sqr-neg56.0%
associate-*l*56.0%
Simplified56.0%
Taylor expanded in b around -inf 89.8%
*-commutative89.8%
Simplified89.8%
*-commutative89.8%
clear-num89.7%
un-div-inv89.9%
Applied egg-rr89.9%
if -3.8000000000000002e-4 < b < 2e-30Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.4%
Simplified74.4%
prod-diff74.1%
*-commutative74.1%
associate-*r*74.3%
*-commutative74.3%
distribute-rgt-neg-in74.3%
*-commutative74.3%
distribute-rgt-neg-in74.3%
metadata-eval74.3%
*-commutative74.3%
fma-undefine74.3%
distribute-lft-neg-in74.3%
*-commutative74.3%
associate-*r*74.3%
*-commutative74.3%
distribute-rgt-neg-in74.3%
*-commutative74.3%
distribute-rgt-neg-in74.3%
metadata-eval74.3%
associate-*r*74.3%
*-commutative74.3%
associate-*l*74.3%
Applied egg-rr74.3%
Taylor expanded in b around 0 63.6%
associate-*r*63.6%
associate-*r*63.6%
distribute-rgt-in64.0%
associate-*l/64.1%
distribute-rgt-in63.7%
associate-*r*63.7%
associate-*r*63.7%
distribute-rgt-out64.0%
*-commutative64.0%
metadata-eval64.0%
associate-*r*64.1%
*-lft-identity64.1%
Simplified64.1%
if 2e-30 < b Initial program 17.6%
sqr-neg17.6%
sqr-neg17.6%
associate-*l*17.6%
Simplified17.6%
frac-2neg17.6%
div-inv17.5%
Applied egg-rr17.5%
Taylor expanded in b around inf 87.9%
associate-*r/87.9%
*-commutative87.9%
Simplified87.9%
(FPCore (a b c)
:precision binary64
(if (<= b -0.00038)
(/ -0.6666666666666666 (/ a b))
(if (<= b 5.3e-36)
(* 0.3333333333333333 (/ (sqrt (* a (* c -3.0))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -0.00038) {
tmp = -0.6666666666666666 / (a / b);
} else if (b <= 5.3e-36) {
tmp = 0.3333333333333333 * (sqrt((a * (c * -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 <= (-0.00038d0)) then
tmp = (-0.6666666666666666d0) / (a / b)
else if (b <= 5.3d-36) then
tmp = 0.3333333333333333d0 * (sqrt((a * (c * (-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 <= -0.00038) {
tmp = -0.6666666666666666 / (a / b);
} else if (b <= 5.3e-36) {
tmp = 0.3333333333333333 * (Math.sqrt((a * (c * -3.0))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -0.00038: tmp = -0.6666666666666666 / (a / b) elif b <= 5.3e-36: tmp = 0.3333333333333333 * (math.sqrt((a * (c * -3.0))) / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -0.00038) tmp = Float64(-0.6666666666666666 / Float64(a / b)); elseif (b <= 5.3e-36) tmp = Float64(0.3333333333333333 * Float64(sqrt(Float64(a * Float64(c * -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 <= -0.00038) tmp = -0.6666666666666666 / (a / b); elseif (b <= 5.3e-36) tmp = 0.3333333333333333 * (sqrt((a * (c * -3.0))) / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -0.00038], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.3e-36], N[(0.3333333333333333 * N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.00038:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{elif}\;b \leq 5.3 \cdot 10^{-36}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3.8000000000000002e-4Initial program 56.0%
sqr-neg56.0%
sqr-neg56.0%
associate-*l*56.0%
Simplified56.0%
Taylor expanded in b around -inf 89.8%
*-commutative89.8%
Simplified89.8%
*-commutative89.8%
clear-num89.7%
un-div-inv89.9%
Applied egg-rr89.9%
if -3.8000000000000002e-4 < b < 5.2999999999999998e-36Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.4%
Simplified74.4%
prod-diff74.1%
*-commutative74.1%
associate-*r*74.3%
*-commutative74.3%
distribute-rgt-neg-in74.3%
*-commutative74.3%
distribute-rgt-neg-in74.3%
metadata-eval74.3%
*-commutative74.3%
fma-undefine74.3%
distribute-lft-neg-in74.3%
*-commutative74.3%
associate-*r*74.3%
*-commutative74.3%
distribute-rgt-neg-in74.3%
*-commutative74.3%
distribute-rgt-neg-in74.3%
metadata-eval74.3%
associate-*r*74.3%
*-commutative74.3%
associate-*l*74.3%
Applied egg-rr74.3%
Taylor expanded in b around 0 63.6%
associate-*r*63.6%
associate-*r*63.6%
distribute-rgt-in64.0%
associate-*l/64.1%
Simplified64.1%
if 5.2999999999999998e-36 < b Initial program 17.6%
sqr-neg17.6%
sqr-neg17.6%
associate-*l*17.6%
Simplified17.6%
frac-2neg17.6%
div-inv17.5%
Applied egg-rr17.5%
Taylor expanded in b around inf 87.9%
associate-*r/87.9%
*-commutative87.9%
Simplified87.9%
(FPCore (a b c)
:precision binary64
(if (<= b -5.8e-54)
(/ (/ (* b 2.0) a) -3.0)
(if (<= b 1.18e-181)
(* 0.3333333333333333 (sqrt (/ (* c -3.0) a)))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.8e-54) {
tmp = ((b * 2.0) / a) / -3.0;
} else if (b <= 1.18e-181) {
tmp = 0.3333333333333333 * sqrt(((c * -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 <= (-5.8d-54)) then
tmp = ((b * 2.0d0) / a) / (-3.0d0)
else if (b <= 1.18d-181) then
tmp = 0.3333333333333333d0 * sqrt(((c * (-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 <= -5.8e-54) {
tmp = ((b * 2.0) / a) / -3.0;
} else if (b <= 1.18e-181) {
tmp = 0.3333333333333333 * Math.sqrt(((c * -3.0) / a));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.8e-54: tmp = ((b * 2.0) / a) / -3.0 elif b <= 1.18e-181: tmp = 0.3333333333333333 * math.sqrt(((c * -3.0) / a)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.8e-54) tmp = Float64(Float64(Float64(b * 2.0) / a) / -3.0); elseif (b <= 1.18e-181) tmp = Float64(0.3333333333333333 * sqrt(Float64(Float64(c * -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 <= -5.8e-54) tmp = ((b * 2.0) / a) / -3.0; elseif (b <= 1.18e-181) tmp = 0.3333333333333333 * sqrt(((c * -3.0) / a)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.8e-54], N[(N[(N[(b * 2.0), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], If[LessEqual[b, 1.18e-181], N[(0.3333333333333333 * N[Sqrt[N[(N[(c * -3.0), $MachinePrecision] / a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.8 \cdot 10^{-54}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{a}}{-3}\\
\mathbf{elif}\;b \leq 1.18 \cdot 10^{-181}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt{\frac{c \cdot -3}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -5.80000000000000029e-54Initial program 59.9%
sqr-neg59.9%
sqr-neg59.9%
associate-*l*59.9%
Simplified59.9%
frac-2neg59.9%
div-inv59.9%
Applied egg-rr59.9%
un-div-inv59.9%
associate-/r*59.9%
fma-undefine59.9%
add-sqr-sqrt39.8%
hypot-define46.9%
Applied egg-rr46.9%
Taylor expanded in b around -inf 86.1%
*-commutative86.1%
Simplified86.1%
if -5.80000000000000029e-54 < b < 1.17999999999999994e-181Initial program 80.6%
sqr-neg80.6%
sqr-neg80.6%
associate-*l*80.3%
Simplified80.3%
prod-diff80.1%
*-commutative80.1%
associate-*r*80.3%
*-commutative80.3%
distribute-rgt-neg-in80.3%
*-commutative80.3%
distribute-rgt-neg-in80.3%
metadata-eval80.3%
*-commutative80.3%
fma-undefine80.3%
distribute-lft-neg-in80.3%
*-commutative80.3%
associate-*r*80.3%
*-commutative80.3%
distribute-rgt-neg-in80.3%
*-commutative80.3%
distribute-rgt-neg-in80.3%
metadata-eval80.3%
associate-*r*80.3%
*-commutative80.3%
associate-*l*80.4%
Applied egg-rr80.4%
Taylor expanded in a around inf 30.9%
*-commutative30.9%
distribute-rgt-out30.9%
metadata-eval30.9%
Simplified30.9%
if 1.17999999999999994e-181 < b Initial program 27.0%
sqr-neg27.0%
sqr-neg27.0%
associate-*l*27.0%
Simplified27.0%
frac-2neg27.0%
div-inv27.0%
Applied egg-rr27.0%
Taylor expanded in b around inf 75.2%
associate-*r/75.2%
*-commutative75.2%
Simplified75.2%
Final simplification68.7%
(FPCore (a b c) :precision binary64 (if (<= b 6e-309) (/ (/ (* b 2.0) a) -3.0) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 6e-309) {
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 <= 6d-309) 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 <= 6e-309) {
tmp = ((b * 2.0) / a) / -3.0;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 6e-309: 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 <= 6e-309) 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 <= 6e-309) 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, 6e-309], 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 6 \cdot 10^{-309}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{a}}{-3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 6.000000000000001e-309Initial program 68.4%
sqr-neg68.4%
sqr-neg68.4%
associate-*l*68.3%
Simplified68.3%
frac-2neg68.3%
div-inv68.3%
Applied egg-rr68.4%
un-div-inv68.4%
associate-/r*68.4%
fma-undefine68.4%
add-sqr-sqrt54.6%
hypot-define59.2%
Applied egg-rr59.2%
Taylor expanded in b around -inf 61.5%
*-commutative61.5%
Simplified61.5%
if 6.000000000000001e-309 < b Initial program 31.5%
sqr-neg31.5%
sqr-neg31.5%
associate-*l*31.4%
Simplified31.4%
frac-2neg31.4%
div-inv31.4%
Applied egg-rr31.5%
Taylor expanded in b around inf 68.2%
associate-*r/68.2%
*-commutative68.2%
Simplified68.2%
(FPCore (a b c) :precision binary64 (if (<= b -4e-310) (/ -0.6666666666666666 (/ a b)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -4e-310) {
tmp = -0.6666666666666666 / (a / 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 <= (-4d-310)) then
tmp = (-0.6666666666666666d0) / (a / 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 <= -4e-310) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4e-310: tmp = -0.6666666666666666 / (a / b) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4e-310) tmp = Float64(-0.6666666666666666 / Float64(a / 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 <= -4e-310) tmp = -0.6666666666666666 / (a / b); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4e-310], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3.999999999999988e-310Initial program 68.4%
sqr-neg68.4%
sqr-neg68.4%
associate-*l*68.3%
Simplified68.3%
Taylor expanded in b around -inf 61.4%
*-commutative61.4%
Simplified61.4%
*-commutative61.4%
clear-num61.4%
un-div-inv61.5%
Applied egg-rr61.5%
if -3.999999999999988e-310 < b Initial program 31.5%
sqr-neg31.5%
sqr-neg31.5%
associate-*l*31.4%
Simplified31.4%
frac-2neg31.4%
div-inv31.4%
Applied egg-rr31.5%
Taylor expanded in b around inf 68.2%
associate-*r/68.2%
*-commutative68.2%
Simplified68.2%
(FPCore (a b c) :precision binary64 (if (<= b 5e-308) (/ -0.6666666666666666 (/ a b)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 5e-308) {
tmp = -0.6666666666666666 / (a / 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 <= 5d-308) then
tmp = (-0.6666666666666666d0) / (a / 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 <= 5e-308) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5e-308: tmp = -0.6666666666666666 / (a / b) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5e-308) tmp = Float64(-0.6666666666666666 / Float64(a / 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 <= 5e-308) tmp = -0.6666666666666666 / (a / b); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5e-308], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5 \cdot 10^{-308}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 4.99999999999999955e-308Initial program 68.4%
sqr-neg68.4%
sqr-neg68.4%
associate-*l*68.3%
Simplified68.3%
Taylor expanded in b around -inf 61.4%
*-commutative61.4%
Simplified61.4%
*-commutative61.4%
clear-num61.4%
un-div-inv61.5%
Applied egg-rr61.5%
if 4.99999999999999955e-308 < b Initial program 31.5%
sqr-neg31.5%
sqr-neg31.5%
associate-*l*31.4%
Simplified31.4%
Taylor expanded in b around inf 68.2%
*-commutative68.2%
Simplified68.2%
Final simplification65.0%
(FPCore (a b c) :precision binary64 (if (<= b -4e-310) (* (/ b a) -0.6666666666666666) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4e-310) {
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 <= (-4d-310)) 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 <= -4e-310) {
tmp = (b / a) * -0.6666666666666666;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4e-310: tmp = (b / a) * -0.6666666666666666 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4e-310) tmp = Float64(Float64(b / 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 <= -4e-310) tmp = (b / a) * -0.6666666666666666; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4e-310], N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -3.999999999999988e-310Initial program 68.4%
sqr-neg68.4%
sqr-neg68.4%
associate-*l*68.3%
Simplified68.3%
Taylor expanded in b around -inf 61.4%
*-commutative61.4%
Simplified61.4%
if -3.999999999999988e-310 < b Initial program 31.5%
sqr-neg31.5%
sqr-neg31.5%
associate-*l*31.4%
Simplified31.4%
Taylor expanded in b around inf 68.2%
*-commutative68.2%
Simplified68.2%
Final simplification65.0%
(FPCore (a b c) :precision binary64 (if (<= b 6e-309) (* (/ b a) -0.6666666666666666) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 6e-309) {
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 <= 6d-309) 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 <= 6e-309) {
tmp = (b / a) * -0.6666666666666666;
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 6e-309: tmp = (b / a) * -0.6666666666666666 else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 6e-309) 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 <= 6e-309) tmp = (b / a) * -0.6666666666666666; else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 6e-309], 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 6 \cdot 10^{-309}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 6.000000000000001e-309Initial program 68.4%
sqr-neg68.4%
sqr-neg68.4%
associate-*l*68.3%
Simplified68.3%
Taylor expanded in b around -inf 61.4%
*-commutative61.4%
Simplified61.4%
if 6.000000000000001e-309 < b Initial program 31.5%
sqr-neg31.5%
sqr-neg31.5%
associate-*l*31.4%
Simplified31.4%
Taylor expanded in b around inf 50.4%
associate-*r/50.4%
*-commutative50.4%
associate-*l*50.4%
Simplified50.4%
div-inv50.4%
associate-/l*55.8%
associate-*l*62.7%
associate-/l*62.7%
associate-/r*62.6%
metadata-eval62.6%
Applied egg-rr62.6%
associate-*r*55.8%
associate-*r*50.4%
*-commutative50.4%
associate-*r/50.4%
*-commutative50.4%
*-commutative50.4%
associate-*r*50.4%
*-commutative50.4%
*-rgt-identity50.4%
associate-*r/50.4%
associate-*r*53.3%
associate-*l*61.7%
*-commutative61.7%
associate-*l/61.7%
*-lft-identity61.7%
Simplified61.7%
Taylor expanded in a around 0 67.9%
(FPCore (a b c) :precision binary64 (if (<= b -4e-310) (* b (/ -0.6666666666666666 a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4e-310) {
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 <= (-4d-310)) 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 <= -4e-310) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4e-310: tmp = b * (-0.6666666666666666 / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4e-310) 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 <= -4e-310) tmp = b * (-0.6666666666666666 / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4e-310], 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 -4 \cdot 10^{-310}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < -3.999999999999988e-310Initial program 68.4%
sqr-neg68.4%
sqr-neg68.4%
associate-*l*68.3%
Simplified68.3%
frac-2neg68.3%
div-inv68.3%
Applied egg-rr68.4%
Taylor expanded in b around -inf 61.4%
associate-*r/61.5%
*-commutative61.5%
associate-*r/61.4%
Simplified61.4%
if -3.999999999999988e-310 < b Initial program 31.5%
sqr-neg31.5%
sqr-neg31.5%
associate-*l*31.4%
Simplified31.4%
Taylor expanded in b around inf 50.4%
associate-*r/50.4%
*-commutative50.4%
associate-*l*50.4%
Simplified50.4%
div-inv50.4%
associate-/l*55.8%
associate-*l*62.7%
associate-/l*62.7%
associate-/r*62.6%
metadata-eval62.6%
Applied egg-rr62.6%
associate-*r*55.8%
associate-*r*50.4%
*-commutative50.4%
associate-*r/50.4%
*-commutative50.4%
*-commutative50.4%
associate-*r*50.4%
*-commutative50.4%
*-rgt-identity50.4%
associate-*r/50.4%
associate-*r*53.3%
associate-*l*61.7%
*-commutative61.7%
associate-*l/61.7%
*-lft-identity61.7%
Simplified61.7%
Taylor expanded in a around 0 67.9%
(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 49.1%
sqr-neg49.1%
sqr-neg49.1%
associate-*l*49.0%
Simplified49.0%
frac-2neg49.0%
div-inv49.0%
Applied egg-rr49.1%
Taylor expanded in b around -inf 30.8%
associate-*r/30.8%
*-commutative30.8%
associate-*r/30.7%
Simplified30.7%
herbie shell --seed 2024089
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))