
(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 -2e+154)
(+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
(if (<= b 6.2e-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 <= -2e+154) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 6.2e-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 <= -2e+154) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); elseif (b <= 6.2e-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, -2e+154], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.2e-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 -2 \cdot 10^{+154}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 6.2 \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 < -2.00000000000000007e154Initial program 45.8%
sqr-neg45.8%
sqr-neg45.8%
associate-*l*45.8%
Simplified45.8%
Taylor expanded in b around -inf 99.4%
associate-*r/99.4%
Applied egg-rr99.4%
if -2.00000000000000007e154 < b < 6.1999999999999995e-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 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 simplification87.2%
(FPCore (a b c)
:precision binary64
(if (<= b -8.2e+153)
(+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
(if (<= b 3.8e-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 <= -8.2e+153) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 3.8e-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 <= -8.2e+153) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); elseif (b <= 3.8e-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, -8.2e+153], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.8e-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 -8.2 \cdot 10^{+153}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 3.8 \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 < -8.20000000000000033e153Initial program 45.8%
sqr-neg45.8%
sqr-neg45.8%
associate-*l*45.8%
Simplified45.8%
Taylor expanded in b around -inf 99.4%
associate-*r/99.4%
Applied egg-rr99.4%
if -8.20000000000000033e153 < b < 3.79999999999999972e-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 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 simplification87.2%
(FPCore (a b c)
:precision binary64
(if (<= b -4e+143)
(+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
(if (<= b 3.2e-117)
(/ (- (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 <= -4e+143) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 3.2e-117) {
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 <= (-4d+143)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
else if (b <= 3.2d-117) 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 <= -4e+143) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 3.2e-117) {
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 <= -4e+143: tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)) elif b <= 3.2e-117: 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 <= -4e+143) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); elseif (b <= 3.2e-117) 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 <= -4e+143) tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)); elseif (b <= 3.2e-117) 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, -4e+143], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.2e-117], 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 -4 \cdot 10^{+143}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 3.2 \cdot 10^{-117}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.0000000000000001e143Initial program 48.3%
sqr-neg48.3%
sqr-neg48.3%
associate-*l*48.3%
Simplified48.3%
Taylor expanded in b around -inf 99.4%
associate-*r/99.5%
Applied egg-rr99.5%
if -4.0000000000000001e143 < b < 3.19999999999999995e-117Initial program 82.4%
sqr-neg82.4%
sqr-neg82.4%
associate-*l*82.3%
Simplified82.3%
if 3.19999999999999995e-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.1%
(FPCore (a b c)
:precision binary64
(if (<= b -2.8e+142)
(+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
(if (<= b 1.02e-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 <= -2.8e+142) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 1.02e-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 <= (-2.8d+142)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
else if (b <= 1.02d-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 <= -2.8e+142) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 1.02e-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 <= -2.8e+142: tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)) elif b <= 1.02e-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 <= -2.8e+142) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); elseif (b <= 1.02e-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 <= -2.8e+142) tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)); elseif (b <= 1.02e-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, -2.8e+142], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.02e-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 -2.8 \cdot 10^{+142}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.02 \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 < -2.8e142Initial program 48.3%
sqr-neg48.3%
sqr-neg48.3%
associate-*l*48.3%
Simplified48.3%
Taylor expanded in b around -inf 99.4%
associate-*r/99.5%
Applied egg-rr99.5%
if -2.8e142 < b < 1.01999999999999996e-112Initial program 82.4%
if 1.01999999999999996e-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 -1.3e-45)
(+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
(if (<= b 1.36e-112)
(* 0.3333333333333333 (/ (+ b (sqrt (* -3.0 (* a c)))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.3e-45) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 1.36e-112) {
tmp = 0.3333333333333333 * ((b + sqrt((-3.0 * (a * c)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.3d-45)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
else if (b <= 1.36d-112) then
tmp = 0.3333333333333333d0 * ((b + sqrt(((-3.0d0) * (a * c)))) / a)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.3e-45) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 1.36e-112) {
tmp = 0.3333333333333333 * ((b + Math.sqrt((-3.0 * (a * c)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.3e-45: tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)) elif b <= 1.36e-112: tmp = 0.3333333333333333 * ((b + math.sqrt((-3.0 * (a * c)))) / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.3e-45) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); elseif (b <= 1.36e-112) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(-3.0 * Float64(a * c)))) / 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 <= -1.3e-45) tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)); elseif (b <= 1.36e-112) tmp = 0.3333333333333333 * ((b + sqrt((-3.0 * (a * c)))) / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.3e-45], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.36e-112], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.3 \cdot 10^{-45}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.36 \cdot 10^{-112}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{-3 \cdot \left(a \cdot c\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.29999999999999993e-45Initial program 67.7%
sqr-neg67.7%
sqr-neg67.7%
associate-*l*67.7%
Simplified67.7%
Taylor expanded in b around -inf 89.5%
associate-*r/89.6%
Applied egg-rr89.6%
if -1.29999999999999993e-45 < b < 1.3600000000000001e-112Initial program 77.9%
sqr-neg77.9%
sqr-neg77.9%
associate-*l*77.9%
Simplified77.9%
*-un-lft-identity77.9%
times-frac77.9%
metadata-eval77.9%
add-sqr-sqrt53.1%
sqrt-unprod76.7%
sqr-neg76.7%
sqrt-prod25.1%
add-sqr-sqrt68.3%
fma-neg68.3%
associate-*r*68.3%
*-commutative68.3%
distribute-rgt-neg-in68.3%
*-commutative68.3%
distribute-rgt-neg-in68.3%
metadata-eval68.3%
Applied egg-rr68.3%
Taylor expanded in b around 0 68.1%
if 1.3600000000000001e-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 simplification82.9%
(FPCore (a b c)
:precision binary64
(if (<= b -5.2e-43)
(+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
(if (<= b 4e-112)
(/ (- (sqrt (* a (* c -3.0))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.2e-43) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 4e-112) {
tmp = (sqrt((a * (c * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5.2d-43)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
else if (b <= 4d-112) then
tmp = (sqrt((a * (c * (-3.0d0)))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5.2e-43) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 4e-112) {
tmp = (Math.sqrt((a * (c * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.2e-43: tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)) elif b <= 4e-112: tmp = (math.sqrt((a * (c * -3.0))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.2e-43) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); elseif (b <= 4e-112) tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5.2e-43) tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)); elseif (b <= 4e-112) tmp = (sqrt((a * (c * -3.0))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.2e-43], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4e-112], N[(N[(N[Sqrt[N[(a * N[(c * -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 -5.2 \cdot 10^{-43}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 4 \cdot 10^{-112}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -5.2e-43Initial program 67.7%
sqr-neg67.7%
sqr-neg67.7%
associate-*l*67.7%
Simplified67.7%
Taylor expanded in b around -inf 89.5%
associate-*r/89.6%
Applied egg-rr89.6%
if -5.2e-43 < b < 3.9999999999999998e-112Initial program 77.9%
sqr-neg77.9%
sqr-neg77.9%
associate-*l*77.9%
Simplified77.9%
prod-diff77.6%
*-commutative77.6%
associate-*r*77.6%
*-commutative77.6%
distribute-rgt-neg-in77.6%
*-commutative77.6%
distribute-rgt-neg-in77.6%
metadata-eval77.6%
*-commutative77.6%
fma-undefine77.7%
distribute-lft-neg-in77.7%
*-commutative77.7%
associate-*r*77.5%
*-commutative77.5%
distribute-rgt-neg-in77.5%
*-commutative77.5%
distribute-rgt-neg-in77.5%
metadata-eval77.5%
associate-*r*77.7%
*-commutative77.7%
associate-*l*77.6%
Applied egg-rr77.6%
Taylor expanded in b around 0 70.0%
mul-1-neg70.0%
unsub-neg70.0%
distribute-rgt-out70.3%
*-commutative70.3%
metadata-eval70.3%
associate-*r*70.4%
*-commutative70.4%
associate-*l*70.3%
*-commutative70.3%
Simplified70.3%
if 3.9999999999999998e-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.5%
(FPCore (a b c)
:precision binary64
(if (<= b -2.25e-36)
(+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
(if (<= b 6.2e-112)
(/ (/ (- (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 <= -2.25e-36) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 6.2e-112) {
tmp = ((sqrt((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 <= (-2.25d-36)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
else if (b <= 6.2d-112) then
tmp = ((sqrt((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 <= -2.25e-36) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 6.2e-112) {
tmp = ((Math.sqrt((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 <= -2.25e-36: tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)) elif b <= 6.2e-112: tmp = ((math.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 <= -2.25e-36) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); elseif (b <= 6.2e-112) tmp = Float64(Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / 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 <= -2.25e-36) tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)); elseif (b <= 6.2e-112) tmp = ((sqrt((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, -2.25e-36], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.2e-112], N[(N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.25 \cdot 10^{-36}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 6.2 \cdot 10^{-112}:\\
\;\;\;\;\frac{\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a}}{3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.25000000000000012e-36Initial program 67.7%
sqr-neg67.7%
sqr-neg67.7%
associate-*l*67.7%
Simplified67.7%
Taylor expanded in b around -inf 89.5%
associate-*r/89.6%
Applied egg-rr89.6%
if -2.25000000000000012e-36 < b < 6.1999999999999995e-112Initial program 77.9%
sqr-neg77.9%
sqr-neg77.9%
associate-*l*77.9%
Simplified77.9%
prod-diff77.6%
*-commutative77.6%
associate-*r*77.6%
*-commutative77.6%
distribute-rgt-neg-in77.6%
*-commutative77.6%
distribute-rgt-neg-in77.6%
metadata-eval77.6%
*-commutative77.6%
fma-undefine77.7%
distribute-lft-neg-in77.7%
*-commutative77.7%
associate-*r*77.5%
*-commutative77.5%
distribute-rgt-neg-in77.5%
*-commutative77.5%
distribute-rgt-neg-in77.5%
metadata-eval77.5%
associate-*r*77.7%
*-commutative77.7%
associate-*l*77.6%
Applied egg-rr77.6%
Taylor expanded in b around 0 70.0%
mul-1-neg70.0%
unsub-neg70.0%
distribute-rgt-out70.3%
*-commutative70.3%
metadata-eval70.3%
associate-*r*70.4%
*-commutative70.4%
associate-*l*70.3%
*-commutative70.3%
Simplified70.3%
add-cube-cbrt69.3%
*-commutative69.3%
times-frac69.3%
pow269.3%
*-commutative69.3%
associate-*r*69.3%
*-commutative69.3%
Applied egg-rr69.4%
associate-*r/69.5%
associate-*l/69.5%
unpow269.5%
rem-3cbrt-lft70.4%
Simplified70.4%
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.5%
(FPCore (a b c)
:precision binary64
(if (<= b -6.4e-44)
(+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
(if (<= b 6.2e-112)
(* 0.3333333333333333 (/ (sqrt (* a (* c -3.0))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.4e-44) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 6.2e-112) {
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 <= (-6.4d-44)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
else if (b <= 6.2d-112) 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 <= -6.4e-44) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 6.2e-112) {
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 <= -6.4e-44: tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)) elif b <= 6.2e-112: 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 <= -6.4e-44) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); elseif (b <= 6.2e-112) 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 <= -6.4e-44) tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)); elseif (b <= 6.2e-112) 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, -6.4e-44], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.2e-112], 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 -6.4 \cdot 10^{-44}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 6.2 \cdot 10^{-112}:\\
\;\;\;\;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 < -6.3999999999999999e-44Initial program 67.7%
sqr-neg67.7%
sqr-neg67.7%
associate-*l*67.7%
Simplified67.7%
Taylor expanded in b around -inf 89.5%
associate-*r/89.6%
Applied egg-rr89.6%
if -6.3999999999999999e-44 < b < 6.1999999999999995e-112Initial program 77.9%
sqr-neg77.9%
sqr-neg77.9%
associate-*l*77.9%
Simplified77.9%
prod-diff77.6%
*-commutative77.6%
associate-*r*77.6%
*-commutative77.6%
distribute-rgt-neg-in77.6%
*-commutative77.6%
distribute-rgt-neg-in77.6%
metadata-eval77.6%
*-commutative77.6%
fma-undefine77.7%
distribute-lft-neg-in77.7%
*-commutative77.7%
associate-*r*77.5%
*-commutative77.5%
distribute-rgt-neg-in77.5%
*-commutative77.5%
distribute-rgt-neg-in77.5%
metadata-eval77.5%
associate-*r*77.7%
*-commutative77.7%
associate-*l*77.6%
Applied egg-rr77.6%
Taylor expanded in b around 0 67.8%
associate-*l/67.8%
*-lft-identity67.8%
distribute-rgt-out68.1%
*-commutative68.1%
metadata-eval68.1%
associate-*r*68.1%
*-commutative68.1%
associate-*l*68.1%
*-commutative68.1%
Simplified68.1%
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 simplification82.9%
(FPCore (a b c)
:precision binary64
(if (<= b -1.85e-219)
(+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
(if (<= b 1.02e-122)
(* 0.3333333333333333 (sqrt (/ (* c -3.0) a)))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.85e-219) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 1.02e-122) {
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 <= (-1.85d-219)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
else if (b <= 1.02d-122) 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 <= -1.85e-219) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 1.02e-122) {
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 <= -1.85e-219: tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)) elif b <= 1.02e-122: 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 <= -1.85e-219) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); elseif (b <= 1.02e-122) 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 <= -1.85e-219) tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)); elseif (b <= 1.02e-122) 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, -1.85e-219], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.02e-122], 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 -1.85 \cdot 10^{-219}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.02 \cdot 10^{-122}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt{\frac{c \cdot -3}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.85e-219Initial program 72.9%
sqr-neg72.9%
sqr-neg72.9%
associate-*l*72.9%
Simplified72.9%
Taylor expanded in b around -inf 74.2%
associate-*r/74.3%
Applied egg-rr74.3%
if -1.85e-219 < b < 1.02000000000000002e-122Initial program 69.3%
sqr-neg69.3%
sqr-neg69.3%
associate-*l*69.2%
Simplified69.2%
prod-diff68.8%
*-commutative68.8%
associate-*r*68.7%
*-commutative68.7%
distribute-rgt-neg-in68.7%
*-commutative68.7%
distribute-rgt-neg-in68.7%
metadata-eval68.7%
*-commutative68.7%
fma-undefine68.8%
distribute-lft-neg-in68.8%
*-commutative68.8%
associate-*r*68.6%
*-commutative68.6%
distribute-rgt-neg-in68.6%
*-commutative68.6%
distribute-rgt-neg-in68.6%
metadata-eval68.6%
associate-*r*68.8%
*-commutative68.8%
associate-*l*68.6%
Applied egg-rr68.6%
Taylor expanded in a around inf 36.4%
distribute-rgt-out36.4%
metadata-eval36.4%
Simplified36.4%
if 1.02000000000000002e-122 < b Initial program 18.6%
sqr-neg18.6%
sqr-neg18.6%
associate-*l*18.6%
Simplified18.6%
Taylor expanded in b around inf 86.0%
associate-*r/86.0%
Applied egg-rr86.0%
Final simplification74.1%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (+ (* 0.5 (/ c b)) (* -0.6666666666666666 (/ b a))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / 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 = (0.5d0 * (c / b)) + ((-0.6666666666666666d0) * (b / 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 = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(Float64(0.5 * Float64(c / b)) + Float64(-0.6666666666666666 * Float64(b / 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 = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $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.5 \cdot \frac{c}{b} + -0.6666666666666666 \cdot \frac{b}{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%
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) (+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-311)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-311) tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\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%
associate-*r/68.6%
Applied egg-rr68.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) (* 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(b * Float64(-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[(b * N[(-0.6666666666666666 / 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}:\\
\;\;\;\;b \cdot \frac{-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%
*-un-lft-identity73.2%
fma-undefine73.2%
add-sqr-sqrt57.4%
unpow257.4%
hypot-define67.8%
Applied egg-rr67.8%
*-lft-identity67.8%
Simplified67.8%
Taylor expanded in a around 0 67.6%
Taylor expanded in b around -inf 67.9%
associate-*r/68.0%
associate-*l/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%
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)))