
(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 16 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 -5e+153)
(* (+ b (- b (* a (* (/ c b) 1.5)))) (/ -0.3333333333333333 a))
(if (<= b 5e-112)
(* (- b (sqrt (fma c (* a -3.0) (pow b 2.0)))) (/ 1.0 (* a -3.0)))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e+153) {
tmp = (b + (b - (a * ((c / b) * 1.5)))) * (-0.3333333333333333 / a);
} else if (b <= 5e-112) {
tmp = (b - sqrt(fma(c, (a * -3.0), pow(b, 2.0)))) * (1.0 / (a * -3.0));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -5e+153) tmp = Float64(Float64(b + Float64(b - Float64(a * Float64(Float64(c / b) * 1.5)))) * Float64(-0.3333333333333333 / a)); elseif (b <= 5e-112) tmp = Float64(Float64(b - sqrt(fma(c, Float64(a * -3.0), (b ^ 2.0)))) * Float64(1.0 / Float64(a * -3.0))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -5e+153], N[(N[(b + N[(b - N[(a * N[(N[(c / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5e-112], N[(N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{+153}:\\
\;\;\;\;\left(b + \left(b - a \cdot \left(\frac{c}{b} \cdot 1.5\right)\right)\right) \cdot \frac{-0.3333333333333333}{a}\\
\mathbf{elif}\;b \leq 5 \cdot 10^{-112}:\\
\;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}\right) \cdot \frac{1}{a \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -5.00000000000000018e153Initial program 45.8%
sqr-neg45.8%
sqr-neg45.8%
associate-*l*45.8%
Simplified45.8%
frac-2neg45.8%
div-inv45.8%
Applied egg-rr45.8%
fma-undefine45.8%
unpow245.8%
+-commutative45.8%
fma-define45.9%
Simplified45.9%
Taylor expanded in b around -inf 92.8%
neg-mul-192.8%
+-commutative92.8%
associate-*r/92.8%
*-commutative92.8%
unsub-neg92.8%
associate-/l*92.8%
*-commutative92.8%
associate-*r/99.4%
Simplified99.4%
*-commutative99.4%
metadata-eval99.4%
div-inv99.4%
clear-num99.5%
add-log-exp48.3%
exp-prod45.5%
associate--r-45.5%
*-commutative45.5%
associate-*r*45.5%
Applied egg-rr45.5%
log-pow49.5%
+-commutative49.5%
*-commutative49.5%
*-commutative49.5%
rem-log-exp99.5%
Simplified99.5%
if -5.00000000000000018e153 < b < 5.00000000000000044e-112Initial program 82.7%
sqr-neg82.7%
sqr-neg82.7%
associate-*l*82.6%
Simplified82.6%
frac-2neg82.6%
div-inv82.6%
Applied egg-rr82.7%
fma-undefine82.7%
unpow282.7%
+-commutative82.7%
fma-define82.7%
Simplified82.7%
if 5.00000000000000044e-112 < b Initial program 17.8%
sqr-neg17.8%
sqr-neg17.8%
associate-*l*17.8%
Simplified17.8%
Taylor expanded in b around inf 86.7%
associate-*r/86.8%
Applied egg-rr86.8%
Final simplification87.2%
(FPCore (a b c)
:precision binary64
(if (<= b -5e+153)
(* (+ b (- b (* a (* (/ c b) 1.5)))) (/ -0.3333333333333333 a))
(if (<= b 2.6e-117)
(* (/ 1.0 (* a -3.0)) (- b (sqrt (fma b b (* c (* a -3.0))))))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e+153) {
tmp = (b + (b - (a * ((c / b) * 1.5)))) * (-0.3333333333333333 / a);
} else if (b <= 2.6e-117) {
tmp = (1.0 / (a * -3.0)) * (b - sqrt(fma(b, b, (c * (a * -3.0)))));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -5e+153) tmp = Float64(Float64(b + Float64(b - Float64(a * Float64(Float64(c / b) * 1.5)))) * Float64(-0.3333333333333333 / a)); elseif (b <= 2.6e-117) tmp = Float64(Float64(1.0 / Float64(a * -3.0)) * Float64(b - sqrt(fma(b, b, Float64(c * Float64(a * -3.0)))))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -5e+153], N[(N[(b + N[(b - N[(a * N[(N[(c / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.6e-117], N[(N[(1.0 / N[(a * -3.0), $MachinePrecision]), $MachinePrecision] * N[(b - N[Sqrt[N[(b * b + N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{+153}:\\
\;\;\;\;\left(b + \left(b - a \cdot \left(\frac{c}{b} \cdot 1.5\right)\right)\right) \cdot \frac{-0.3333333333333333}{a}\\
\mathbf{elif}\;b \leq 2.6 \cdot 10^{-117}:\\
\;\;\;\;\frac{1}{a \cdot -3} \cdot \left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -5.00000000000000018e153Initial program 45.8%
sqr-neg45.8%
sqr-neg45.8%
associate-*l*45.8%
Simplified45.8%
frac-2neg45.8%
div-inv45.8%
Applied egg-rr45.8%
fma-undefine45.8%
unpow245.8%
+-commutative45.8%
fma-define45.9%
Simplified45.9%
Taylor expanded in b around -inf 92.8%
neg-mul-192.8%
+-commutative92.8%
associate-*r/92.8%
*-commutative92.8%
unsub-neg92.8%
associate-/l*92.8%
*-commutative92.8%
associate-*r/99.4%
Simplified99.4%
*-commutative99.4%
metadata-eval99.4%
div-inv99.4%
clear-num99.5%
add-log-exp48.3%
exp-prod45.5%
associate--r-45.5%
*-commutative45.5%
associate-*r*45.5%
Applied egg-rr45.5%
log-pow49.5%
+-commutative49.5%
*-commutative49.5%
*-commutative49.5%
rem-log-exp99.5%
Simplified99.5%
if -5.00000000000000018e153 < b < 2.59999999999999983e-117Initial program 82.7%
sqr-neg82.7%
sqr-neg82.7%
associate-*l*82.6%
Simplified82.6%
frac-2neg82.6%
div-inv82.6%
Applied egg-rr82.7%
if 2.59999999999999983e-117 < b Initial program 17.8%
sqr-neg17.8%
sqr-neg17.8%
associate-*l*17.8%
Simplified17.8%
Taylor expanded in b around inf 86.7%
associate-*r/86.8%
Applied egg-rr86.8%
Final simplification87.2%
(FPCore (a b c)
:precision binary64
(if (<= b -1e+145)
(* (+ b (- b (* a (* (/ c b) 1.5)))) (/ -0.3333333333333333 a))
(if (<= b 3.85e-118)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e+145) {
tmp = (b + (b - (a * ((c / b) * 1.5)))) * (-0.3333333333333333 / a);
} else if (b <= 3.85e-118) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1d+145)) then
tmp = (b + (b - (a * ((c / b) * 1.5d0)))) * ((-0.3333333333333333d0) / a)
else if (b <= 3.85d-118) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e+145) {
tmp = (b + (b - (a * ((c / b) * 1.5)))) * (-0.3333333333333333 / a);
} else if (b <= 3.85e-118) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e+145: tmp = (b + (b - (a * ((c / b) * 1.5)))) * (-0.3333333333333333 / a) elif b <= 3.85e-118: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e+145) tmp = Float64(Float64(b + Float64(b - Float64(a * Float64(Float64(c / b) * 1.5)))) * Float64(-0.3333333333333333 / a)); elseif (b <= 3.85e-118) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e+145) tmp = (b + (b - (a * ((c / b) * 1.5)))) * (-0.3333333333333333 / a); elseif (b <= 3.85e-118) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e+145], N[(N[(b + N[(b - N[(a * N[(N[(c / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.85e-118], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+145}:\\
\;\;\;\;\left(b + \left(b - a \cdot \left(\frac{c}{b} \cdot 1.5\right)\right)\right) \cdot \frac{-0.3333333333333333}{a}\\
\mathbf{elif}\;b \leq 3.85 \cdot 10^{-118}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -9.9999999999999999e144Initial program 48.3%
sqr-neg48.3%
sqr-neg48.3%
associate-*l*48.3%
Simplified48.3%
frac-2neg48.3%
div-inv48.3%
Applied egg-rr48.3%
fma-undefine48.3%
unpow248.3%
+-commutative48.3%
fma-define48.4%
Simplified48.4%
Taylor expanded in b around -inf 93.1%
neg-mul-193.1%
+-commutative93.1%
associate-*r/93.1%
*-commutative93.1%
unsub-neg93.1%
associate-/l*93.1%
*-commutative93.1%
associate-*r/99.5%
Simplified99.5%
*-commutative99.5%
metadata-eval99.5%
div-inv99.4%
clear-num99.5%
add-log-exp46.4%
exp-prod43.7%
associate--r-43.7%
*-commutative43.7%
associate-*r*43.7%
Applied egg-rr43.7%
log-pow47.6%
+-commutative47.6%
*-commutative47.6%
*-commutative47.6%
rem-log-exp99.5%
Simplified99.5%
if -9.9999999999999999e144 < b < 3.8499999999999998e-118Initial program 82.4%
sqr-neg82.4%
sqr-neg82.4%
associate-*l*82.3%
Simplified82.3%
if 3.8499999999999998e-118 < b Initial program 17.8%
sqr-neg17.8%
sqr-neg17.8%
associate-*l*17.8%
Simplified17.8%
Taylor expanded in b around inf 86.7%
associate-*r/86.8%
Applied egg-rr86.8%
Final simplification87.1%
(FPCore (a b c)
:precision binary64
(if (<= b -1.1e+142)
(* (+ b (- b (* a (* (/ c b) 1.5)))) (/ -0.3333333333333333 a))
(if (<= b 1.26e-112)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.1e+142) {
tmp = (b + (b - (a * ((c / b) * 1.5)))) * (-0.3333333333333333 / a);
} else if (b <= 1.26e-112) {
tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.1d+142)) then
tmp = (b + (b - (a * ((c / b) * 1.5d0)))) * ((-0.3333333333333333d0) / a)
else if (b <= 1.26d-112) then
tmp = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.1e+142) {
tmp = (b + (b - (a * ((c / b) * 1.5)))) * (-0.3333333333333333 / a);
} else if (b <= 1.26e-112) {
tmp = (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.1e+142: tmp = (b + (b - (a * ((c / b) * 1.5)))) * (-0.3333333333333333 / a) elif b <= 1.26e-112: tmp = (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.1e+142) tmp = Float64(Float64(b + Float64(b - Float64(a * Float64(Float64(c / b) * 1.5)))) * Float64(-0.3333333333333333 / a)); elseif (b <= 1.26e-112) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.1e+142) tmp = (b + (b - (a * ((c / b) * 1.5)))) * (-0.3333333333333333 / a); elseif (b <= 1.26e-112) tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.1e+142], N[(N[(b + N[(b - N[(a * N[(N[(c / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.26e-112], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.1 \cdot 10^{+142}:\\
\;\;\;\;\left(b + \left(b - a \cdot \left(\frac{c}{b} \cdot 1.5\right)\right)\right) \cdot \frac{-0.3333333333333333}{a}\\
\mathbf{elif}\;b \leq 1.26 \cdot 10^{-112}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.09999999999999993e142Initial program 48.3%
sqr-neg48.3%
sqr-neg48.3%
associate-*l*48.3%
Simplified48.3%
frac-2neg48.3%
div-inv48.3%
Applied egg-rr48.3%
fma-undefine48.3%
unpow248.3%
+-commutative48.3%
fma-define48.4%
Simplified48.4%
Taylor expanded in b around -inf 93.1%
neg-mul-193.1%
+-commutative93.1%
associate-*r/93.1%
*-commutative93.1%
unsub-neg93.1%
associate-/l*93.1%
*-commutative93.1%
associate-*r/99.5%
Simplified99.5%
*-commutative99.5%
metadata-eval99.5%
div-inv99.4%
clear-num99.5%
add-log-exp46.4%
exp-prod43.7%
associate--r-43.7%
*-commutative43.7%
associate-*r*43.7%
Applied egg-rr43.7%
log-pow47.6%
+-commutative47.6%
*-commutative47.6%
*-commutative47.6%
rem-log-exp99.5%
Simplified99.5%
if -1.09999999999999993e142 < b < 1.2599999999999999e-112Initial program 82.4%
if 1.2599999999999999e-112 < b Initial program 17.8%
sqr-neg17.8%
sqr-neg17.8%
associate-*l*17.8%
Simplified17.8%
Taylor expanded in b around inf 86.7%
associate-*r/86.8%
Applied egg-rr86.8%
Final simplification87.2%
(FPCore (a b c)
:precision binary64
(if (<= b -3.05e-34)
(fma 0.5 (/ c b) (/ (* b -0.6666666666666666) a))
(if (<= b 3.8e-117)
(* (/ 0.3333333333333333 a) (+ b (sqrt (* -3.0 (* a c)))))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.05e-34) {
tmp = fma(0.5, (c / b), ((b * -0.6666666666666666) / a));
} else if (b <= 3.8e-117) {
tmp = (0.3333333333333333 / a) * (b + sqrt((-3.0 * (a * c))));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -3.05e-34) tmp = fma(0.5, Float64(c / b), Float64(Float64(b * -0.6666666666666666) / a)); elseif (b <= 3.8e-117) tmp = Float64(Float64(0.3333333333333333 / a) * Float64(b + sqrt(Float64(-3.0 * Float64(a * c))))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -3.05e-34], N[(0.5 * N[(c / b), $MachinePrecision] + N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.8e-117], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(b + N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.05 \cdot 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b \cdot -0.6666666666666666}{a}\right)\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-117}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(b + \sqrt{-3 \cdot \left(a \cdot c\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3.0499999999999999e-34Initial program 67.7%
sqr-neg67.7%
sqr-neg67.7%
associate-*l*67.7%
Simplified67.7%
frac-2neg67.7%
div-inv67.8%
Applied egg-rr67.8%
fma-undefine67.8%
unpow267.8%
+-commutative67.8%
fma-define67.8%
Simplified67.8%
Taylor expanded in b around -inf 89.5%
+-commutative89.5%
fma-define89.5%
associate-*r/89.6%
Simplified89.6%
if -3.0499999999999999e-34 < b < 3.79999999999999972e-117Initial program 77.9%
sqr-neg77.9%
sqr-neg77.9%
associate-*l*77.9%
Simplified77.9%
clear-num77.8%
associate-/r/77.9%
associate-/r*78.0%
metadata-eval78.0%
add-sqr-sqrt53.1%
sqrt-unprod76.8%
sqr-neg76.8%
sqrt-prod25.1%
add-sqr-sqrt68.3%
fma-neg68.3%
associate-*r*68.4%
*-commutative68.4%
distribute-rgt-neg-in68.4%
*-commutative68.4%
distribute-rgt-neg-in68.4%
metadata-eval68.4%
Applied egg-rr68.4%
Taylor expanded in b around 0 68.2%
if 3.79999999999999972e-117 < b Initial program 17.8%
sqr-neg17.8%
sqr-neg17.8%
associate-*l*17.8%
Simplified17.8%
Taylor expanded in b around inf 86.7%
associate-*r/86.8%
Applied egg-rr86.8%
Final simplification83.0%
(FPCore (a b c)
:precision binary64
(if (<= b -1.1e-46)
(fma 0.5 (/ c b) (/ (* b -0.6666666666666666) a))
(if (<= b 2.9e-112)
(* (/ 0.3333333333333333 a) (+ b (sqrt (* a (* c -3.0)))))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.1e-46) {
tmp = fma(0.5, (c / b), ((b * -0.6666666666666666) / a));
} else if (b <= 2.9e-112) {
tmp = (0.3333333333333333 / a) * (b + sqrt((a * (c * -3.0))));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -1.1e-46) tmp = fma(0.5, Float64(c / b), Float64(Float64(b * -0.6666666666666666) / a)); elseif (b <= 2.9e-112) tmp = Float64(Float64(0.3333333333333333 / a) * Float64(b + sqrt(Float64(a * Float64(c * -3.0))))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -1.1e-46], N[(0.5 * N[(c / b), $MachinePrecision] + N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.9e-112], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(b + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.1 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b \cdot -0.6666666666666666}{a}\right)\\
\mathbf{elif}\;b \leq 2.9 \cdot 10^{-112}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(b + \sqrt{a \cdot \left(c \cdot -3\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.1e-46Initial program 67.7%
sqr-neg67.7%
sqr-neg67.7%
associate-*l*67.7%
Simplified67.7%
frac-2neg67.7%
div-inv67.8%
Applied egg-rr67.8%
fma-undefine67.8%
unpow267.8%
+-commutative67.8%
fma-define67.8%
Simplified67.8%
Taylor expanded in b around -inf 89.5%
+-commutative89.5%
fma-define89.5%
associate-*r/89.6%
Simplified89.6%
if -1.1e-46 < b < 2.89999999999999992e-112Initial program 77.9%
sqr-neg77.9%
sqr-neg77.9%
associate-*l*77.9%
Simplified77.9%
clear-num77.8%
associate-/r/77.9%
associate-/r*78.0%
metadata-eval78.0%
add-sqr-sqrt53.1%
sqrt-unprod76.8%
sqr-neg76.8%
sqrt-prod25.1%
add-sqr-sqrt68.3%
fma-neg68.3%
associate-*r*68.4%
*-commutative68.4%
distribute-rgt-neg-in68.4%
*-commutative68.4%
distribute-rgt-neg-in68.4%
metadata-eval68.4%
Applied egg-rr68.4%
Taylor expanded in b around 0 68.2%
distribute-lft-in68.2%
associate-*r*68.2%
*-commutative68.2%
*-commutative68.2%
Applied egg-rr68.2%
distribute-lft-out68.2%
associate-*r*68.2%
*-commutative68.2%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt68.2%
Simplified68.2%
if 2.89999999999999992e-112 < b Initial program 17.8%
sqr-neg17.8%
sqr-neg17.8%
associate-*l*17.8%
Simplified17.8%
Taylor expanded in b around inf 86.7%
associate-*r/86.8%
Applied egg-rr86.8%
Final simplification83.0%
(FPCore (a b c)
:precision binary64
(if (<= b -8e-37)
(fma 0.5 (/ c b) (/ (* b -0.6666666666666666) a))
(if (<= b 6.2e-112)
(* (/ 0.3333333333333333 a) (+ b (sqrt (* c (* a -3.0)))))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -8e-37) {
tmp = fma(0.5, (c / b), ((b * -0.6666666666666666) / a));
} else if (b <= 6.2e-112) {
tmp = (0.3333333333333333 / a) * (b + sqrt((c * (a * -3.0))));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -8e-37) tmp = fma(0.5, Float64(c / b), Float64(Float64(b * -0.6666666666666666) / a)); elseif (b <= 6.2e-112) tmp = Float64(Float64(0.3333333333333333 / a) * Float64(b + sqrt(Float64(c * Float64(a * -3.0))))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -8e-37], N[(0.5 * N[(c / b), $MachinePrecision] + N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.2e-112], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8 \cdot 10^{-37}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b \cdot -0.6666666666666666}{a}\right)\\
\mathbf{elif}\;b \leq 6.2 \cdot 10^{-112}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(b + \sqrt{c \cdot \left(a \cdot -3\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -8.00000000000000053e-37Initial program 67.7%
sqr-neg67.7%
sqr-neg67.7%
associate-*l*67.7%
Simplified67.7%
frac-2neg67.7%
div-inv67.8%
Applied egg-rr67.8%
fma-undefine67.8%
unpow267.8%
+-commutative67.8%
fma-define67.8%
Simplified67.8%
Taylor expanded in b around -inf 89.5%
+-commutative89.5%
fma-define89.5%
associate-*r/89.6%
Simplified89.6%
if -8.00000000000000053e-37 < b < 6.1999999999999995e-112Initial program 77.9%
sqr-neg77.9%
sqr-neg77.9%
associate-*l*77.9%
Simplified77.9%
clear-num77.8%
associate-/r/77.9%
associate-/r*78.0%
metadata-eval78.0%
add-sqr-sqrt53.1%
sqrt-unprod76.8%
sqr-neg76.8%
sqrt-prod25.1%
add-sqr-sqrt68.3%
fma-neg68.3%
associate-*r*68.4%
*-commutative68.4%
distribute-rgt-neg-in68.4%
*-commutative68.4%
distribute-rgt-neg-in68.4%
metadata-eval68.4%
Applied egg-rr68.4%
Taylor expanded in b around 0 68.2%
associate-*r*68.2%
*-commutative68.2%
*-commutative68.2%
Simplified68.2%
if 6.1999999999999995e-112 < b Initial program 17.8%
sqr-neg17.8%
sqr-neg17.8%
associate-*l*17.8%
Simplified17.8%
Taylor expanded in b around inf 86.7%
associate-*r/86.8%
Applied egg-rr86.8%
Final simplification83.0%
(FPCore (a b c)
:precision binary64
(if (<= b -3.5e-30)
(fma 0.5 (/ c b) (/ (* b -0.6666666666666666) a))
(if (<= b 1.26e-113)
(/ (- (sqrt (* -3.0 (* a c))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.5e-30) {
tmp = fma(0.5, (c / b), ((b * -0.6666666666666666) / a));
} else if (b <= 1.26e-113) {
tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -3.5e-30) tmp = fma(0.5, Float64(c / b), Float64(Float64(b * -0.6666666666666666) / a)); elseif (b <= 1.26e-113) tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -3.5e-30], N[(0.5 * N[(c / b), $MachinePrecision] + N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.26e-113], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.5 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b \cdot -0.6666666666666666}{a}\right)\\
\mathbf{elif}\;b \leq 1.26 \cdot 10^{-113}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3.5000000000000003e-30Initial program 67.7%
sqr-neg67.7%
sqr-neg67.7%
associate-*l*67.7%
Simplified67.7%
frac-2neg67.7%
div-inv67.8%
Applied egg-rr67.8%
fma-undefine67.8%
unpow267.8%
+-commutative67.8%
fma-define67.8%
Simplified67.8%
Taylor expanded in b around -inf 89.5%
+-commutative89.5%
fma-define89.5%
associate-*r/89.6%
Simplified89.6%
if -3.5000000000000003e-30 < b < 1.26000000000000003e-113Initial program 77.9%
sqr-neg77.9%
sqr-neg77.9%
associate-*l*77.9%
Simplified77.9%
Taylor expanded in b around 0 70.3%
if 1.26000000000000003e-113 < b Initial program 17.8%
sqr-neg17.8%
sqr-neg17.8%
associate-*l*17.8%
Simplified17.8%
Taylor expanded in b around inf 86.7%
associate-*r/86.8%
Applied egg-rr86.8%
Final simplification83.5%
(FPCore (a b c)
:precision binary64
(if (<= b -1.42e-34)
(fma 0.5 (/ c b) (/ (* b -0.6666666666666666) a))
(if (<= b 1.3e-114)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.42e-34) {
tmp = fma(0.5, (c / b), ((b * -0.6666666666666666) / a));
} else if (b <= 1.3e-114) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -1.42e-34) tmp = fma(0.5, Float64(c / b), Float64(Float64(b * -0.6666666666666666) / a)); elseif (b <= 1.3e-114) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -1.42e-34], N[(0.5 * N[(c / b), $MachinePrecision] + N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.3e-114], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.42 \cdot 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b \cdot -0.6666666666666666}{a}\right)\\
\mathbf{elif}\;b \leq 1.3 \cdot 10^{-114}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.42000000000000003e-34Initial program 67.7%
sqr-neg67.7%
sqr-neg67.7%
associate-*l*67.7%
Simplified67.7%
frac-2neg67.7%
div-inv67.8%
Applied egg-rr67.8%
fma-undefine67.8%
unpow267.8%
+-commutative67.8%
fma-define67.8%
Simplified67.8%
Taylor expanded in b around -inf 89.5%
+-commutative89.5%
fma-define89.5%
associate-*r/89.6%
Simplified89.6%
if -1.42000000000000003e-34 < b < 1.30000000000000007e-114Initial program 77.9%
sqr-neg77.9%
sqr-neg77.9%
associate-*l*77.9%
Simplified77.9%
Taylor expanded in b around 0 70.3%
*-commutative70.3%
*-commutative70.3%
associate-*r*70.4%
Simplified70.4%
if 1.30000000000000007e-114 < b Initial program 17.8%
sqr-neg17.8%
sqr-neg17.8%
associate-*l*17.8%
Simplified17.8%
Taylor expanded in b around inf 86.7%
associate-*r/86.8%
Applied egg-rr86.8%
Final simplification83.5%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (fma 0.5 (/ c b) (/ (* b -0.6666666666666666) a)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = fma(0.5, (c / b), ((b * -0.6666666666666666) / a));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = fma(0.5, Float64(c / b), Float64(Float64(b * -0.6666666666666666) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(0.5 * N[(c / b), $MachinePrecision] + N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b \cdot -0.6666666666666666}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 73.2%
sqr-neg73.2%
sqr-neg73.2%
associate-*l*73.1%
Simplified73.1%
frac-2neg73.1%
div-inv73.1%
Applied egg-rr73.2%
fma-undefine73.2%
unpow273.2%
+-commutative73.2%
fma-define73.2%
Simplified73.2%
Taylor expanded in b around -inf 68.6%
+-commutative68.6%
fma-define68.6%
associate-*r/68.6%
Simplified68.6%
if -5.00000000000023e-311 < b Initial program 26.8%
sqr-neg26.8%
sqr-neg26.8%
associate-*l*26.8%
Simplified26.8%
Taylor expanded in b around inf 73.9%
associate-*r/74.0%
Applied egg-rr74.0%
Final simplification71.4%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-311)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-311) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 73.2%
sqr-neg73.2%
sqr-neg73.2%
associate-*l*73.1%
Simplified73.1%
Taylor expanded in b around -inf 68.6%
if -5.00000000000023e-311 < b Initial program 26.8%
sqr-neg26.8%
sqr-neg26.8%
associate-*l*26.8%
Simplified26.8%
Taylor expanded in b around inf 73.9%
associate-*r/74.0%
Applied egg-rr74.0%
Final simplification71.4%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (* (/ 1.0 (* a -3.0)) (* b 2.0)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = (1.0 / (a * -3.0)) * (b * 2.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-311)) then
tmp = (1.0d0 / (a * (-3.0d0))) * (b * 2.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = (1.0 / (a * -3.0)) * (b * 2.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = (1.0 / (a * -3.0)) * (b * 2.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(Float64(1.0 / Float64(a * -3.0)) * Float64(b * 2.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-311) tmp = (1.0 / (a * -3.0)) * (b * 2.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(N[(1.0 / N[(a * -3.0), $MachinePrecision]), $MachinePrecision] * N[(b * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{1}{a \cdot -3} \cdot \left(b \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 73.2%
sqr-neg73.2%
sqr-neg73.2%
associate-*l*73.1%
Simplified73.1%
frac-2neg73.1%
div-inv73.1%
Applied egg-rr73.2%
fma-undefine73.2%
unpow273.2%
+-commutative73.2%
fma-define73.2%
Simplified73.2%
Taylor expanded in b around -inf 68.0%
*-commutative68.0%
Simplified68.0%
if -5.00000000000023e-311 < b Initial program 26.8%
sqr-neg26.8%
sqr-neg26.8%
associate-*l*26.8%
Simplified26.8%
Taylor expanded in b around inf 73.9%
associate-*r/74.0%
Applied egg-rr74.0%
Final simplification71.1%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (* -0.6666666666666666 (/ b a)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = (c / b) * -0.5;
}
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-311)) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = -0.6666666666666666 * (b / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-311) tmp = -0.6666666666666666 * (b / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 73.2%
sqr-neg73.2%
sqr-neg73.2%
associate-*l*73.1%
Simplified73.1%
Taylor expanded in b around -inf 67.9%
*-commutative67.9%
Simplified67.9%
if -5.00000000000023e-311 < b Initial program 26.8%
sqr-neg26.8%
sqr-neg26.8%
associate-*l*26.8%
Simplified26.8%
Taylor expanded in b around inf 73.9%
Final simplification71.0%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (/ (* b -0.6666666666666666) a) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c / b) * -0.5;
}
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-311)) then
tmp = (b * (-0.6666666666666666d0)) / a
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = (b * -0.6666666666666666) / a else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(Float64(b * -0.6666666666666666) / a); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-311) tmp = (b * -0.6666666666666666) / a; else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 73.2%
sqr-neg73.2%
sqr-neg73.2%
associate-*l*73.1%
Simplified73.1%
frac-2neg73.1%
div-inv73.1%
Applied egg-rr73.2%
fma-undefine73.2%
unpow273.2%
+-commutative73.2%
fma-define73.2%
Simplified73.2%
Taylor expanded in b around -inf 67.9%
associate-*r/68.0%
Simplified68.0%
if -5.00000000000023e-311 < b Initial program 26.8%
sqr-neg26.8%
sqr-neg26.8%
associate-*l*26.8%
Simplified26.8%
Taylor expanded in b around inf 73.9%
Final simplification71.0%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (/ (* b -0.6666666666666666) a) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
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 <= (-5d-311)) 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 <= -5e-311) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = (b * -0.6666666666666666) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(Float64(b * -0.6666666666666666) / 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 <= -5e-311) tmp = (b * -0.6666666666666666) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 73.2%
sqr-neg73.2%
sqr-neg73.2%
associate-*l*73.1%
Simplified73.1%
frac-2neg73.1%
div-inv73.1%
Applied egg-rr73.2%
fma-undefine73.2%
unpow273.2%
+-commutative73.2%
fma-define73.2%
Simplified73.2%
Taylor expanded in b around -inf 67.9%
associate-*r/68.0%
Simplified68.0%
if -5.00000000000023e-311 < b Initial program 26.8%
sqr-neg26.8%
sqr-neg26.8%
associate-*l*26.8%
Simplified26.8%
Taylor expanded in b around inf 73.9%
associate-*r/74.0%
Applied egg-rr74.0%
Final simplification71.1%
(FPCore (a b c) :precision binary64 (* (/ c b) -0.5))
double code(double a, double b, double c) {
return (c / b) * -0.5;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (c / b) * (-0.5d0)
end function
public static double code(double a, double b, double c) {
return (c / b) * -0.5;
}
def code(a, b, c): return (c / b) * -0.5
function code(a, b, c) return Float64(Float64(c / b) * -0.5) end
function tmp = code(a, b, c) tmp = (c / b) * -0.5; end
code[a_, b_, c_] := N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{c}{b} \cdot -0.5
\end{array}
Initial program 49.3%
sqr-neg49.3%
sqr-neg49.3%
associate-*l*49.3%
Simplified49.3%
Taylor expanded in b around inf 39.2%
Final simplification39.2%
herbie shell --seed 2024050
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))