
(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 14 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 -1.85e+88)
(/ (* b (- (- 2.0) (* -1.5 (* a (/ c (pow b 2.0)))))) (* a 3.0))
(if (<= b 5.8e-147)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.85e+88) {
tmp = (b * (-2.0 - (-1.5 * (a * (c / pow(b, 2.0)))))) / (a * 3.0);
} else if (b <= 5.8e-147) {
tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} 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 <= (-1.85d+88)) then
tmp = (b * (-2.0d0 - ((-1.5d0) * (a * (c / (b ** 2.0d0)))))) / (a * 3.0d0)
else if (b <= 5.8d-147) then
tmp = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
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 <= -1.85e+88) {
tmp = (b * (-2.0 - (-1.5 * (a * (c / Math.pow(b, 2.0)))))) / (a * 3.0);
} else if (b <= 5.8e-147) {
tmp = (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.85e+88: tmp = (b * (-2.0 - (-1.5 * (a * (c / math.pow(b, 2.0)))))) / (a * 3.0) elif b <= 5.8e-147: tmp = (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.85e+88) tmp = Float64(Float64(b * Float64(Float64(-2.0) - Float64(-1.5 * Float64(a * Float64(c / (b ^ 2.0)))))) / Float64(a * 3.0)); elseif (b <= 5.8e-147) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.85e+88) tmp = (b * (-2.0 - (-1.5 * (a * (c / (b ^ 2.0)))))) / (a * 3.0); elseif (b <= 5.8e-147) tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.85e+88], N[(N[(b * N[((-2.0) - N[(-1.5 * N[(a * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.8e-147], 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 / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.85 \cdot 10^{+88}:\\
\;\;\;\;\frac{b \cdot \left(\left(-2\right) - -1.5 \cdot \left(a \cdot \frac{c}{{b}^{2}}\right)\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 5.8 \cdot 10^{-147}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.84999999999999997e88Initial program 52.6%
sqr-neg52.6%
sqr-neg52.6%
associate-*l*52.6%
Simplified52.6%
Taylor expanded in b around -inf 92.4%
associate-*r*92.4%
mul-1-neg92.4%
associate-/l*97.0%
Simplified97.0%
if -1.84999999999999997e88 < b < 5.8000000000000002e-147Initial program 80.8%
if 5.8000000000000002e-147 < b Initial program 19.5%
sqr-neg19.5%
sqr-neg19.5%
associate-*l*19.5%
Simplified19.5%
Taylor expanded in b around inf 83.1%
*-commutative83.1%
Simplified83.1%
Final simplification85.9%
(FPCore (a b c)
:precision binary64
(if (<= b -4e+86)
(/ (* a (+ (* -2.0 (/ b a)) (* (/ c b) 1.5))) (* a 3.0))
(if (<= b 5.8e-147)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4e+86) {
tmp = (a * ((-2.0 * (b / a)) + ((c / b) * 1.5))) / (a * 3.0);
} else if (b <= 5.8e-147) {
tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} 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 <= (-4d+86)) then
tmp = (a * (((-2.0d0) * (b / a)) + ((c / b) * 1.5d0))) / (a * 3.0d0)
else if (b <= 5.8d-147) then
tmp = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
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 <= -4e+86) {
tmp = (a * ((-2.0 * (b / a)) + ((c / b) * 1.5))) / (a * 3.0);
} else if (b <= 5.8e-147) {
tmp = (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4e+86: tmp = (a * ((-2.0 * (b / a)) + ((c / b) * 1.5))) / (a * 3.0) elif b <= 5.8e-147: tmp = (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4e+86) tmp = Float64(Float64(a * Float64(Float64(-2.0 * Float64(b / a)) + Float64(Float64(c / b) * 1.5))) / Float64(a * 3.0)); elseif (b <= 5.8e-147) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4e+86) tmp = (a * ((-2.0 * (b / a)) + ((c / b) * 1.5))) / (a * 3.0); elseif (b <= 5.8e-147) tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4e+86], N[(N[(a * N[(N[(-2.0 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.8e-147], 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 / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{+86}:\\
\;\;\;\;\frac{a \cdot \left(-2 \cdot \frac{b}{a} + \frac{c}{b} \cdot 1.5\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 5.8 \cdot 10^{-147}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -4.0000000000000001e86Initial program 53.3%
sqr-neg53.3%
sqr-neg53.3%
associate-*l*53.3%
Simplified53.3%
Taylor expanded in b around -inf 92.4%
associate-*r*92.4%
mul-1-neg92.4%
associate-/l*97.0%
Simplified97.0%
Taylor expanded in a around inf 97.0%
if -4.0000000000000001e86 < b < 5.8000000000000002e-147Initial program 80.6%
if 5.8000000000000002e-147 < b Initial program 19.5%
sqr-neg19.5%
sqr-neg19.5%
associate-*l*19.5%
Simplified19.5%
Taylor expanded in b around inf 83.1%
*-commutative83.1%
Simplified83.1%
Final simplification85.9%
(FPCore (a b c)
:precision binary64
(if (<= b -1.05e+86)
(/ (* a (+ (* -2.0 (/ b a)) (* (/ c b) 1.5))) (* a 3.0))
(if (<= b 5.8e-147)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.05e+86) {
tmp = (a * ((-2.0 * (b / a)) + ((c / b) * 1.5))) / (a * 3.0);
} else if (b <= 5.8e-147) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} 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 <= (-1.05d+86)) then
tmp = (a * (((-2.0d0) * (b / a)) + ((c / b) * 1.5d0))) / (a * 3.0d0)
else if (b <= 5.8d-147) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (a * 3.0d0)
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 <= -1.05e+86) {
tmp = (a * ((-2.0 * (b / a)) + ((c / b) * 1.5))) / (a * 3.0);
} else if (b <= 5.8e-147) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.05e+86: tmp = (a * ((-2.0 * (b / a)) + ((c / b) * 1.5))) / (a * 3.0) elif b <= 5.8e-147: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.05e+86) tmp = Float64(Float64(a * Float64(Float64(-2.0 * Float64(b / a)) + Float64(Float64(c / b) * 1.5))) / Float64(a * 3.0)); elseif (b <= 5.8e-147) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.05e+86) tmp = (a * ((-2.0 * (b / a)) + ((c / b) * 1.5))) / (a * 3.0); elseif (b <= 5.8e-147) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.05e+86], N[(N[(a * N[(N[(-2.0 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.8e-147], 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 / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.05 \cdot 10^{+86}:\\
\;\;\;\;\frac{a \cdot \left(-2 \cdot \frac{b}{a} + \frac{c}{b} \cdot 1.5\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 5.8 \cdot 10^{-147}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.0499999999999999e86Initial program 53.3%
sqr-neg53.3%
sqr-neg53.3%
associate-*l*53.3%
Simplified53.3%
Taylor expanded in b around -inf 92.4%
associate-*r*92.4%
mul-1-neg92.4%
associate-/l*97.0%
Simplified97.0%
Taylor expanded in a around inf 97.0%
if -1.0499999999999999e86 < b < 5.8000000000000002e-147Initial program 80.6%
sqr-neg80.6%
sqr-neg80.6%
associate-*l*80.5%
Simplified80.5%
if 5.8000000000000002e-147 < b Initial program 19.5%
sqr-neg19.5%
sqr-neg19.5%
associate-*l*19.5%
Simplified19.5%
Taylor expanded in b around inf 83.1%
*-commutative83.1%
Simplified83.1%
Final simplification85.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2.7e-86)
(+ (/ (* b -0.6666666666666666) a) (* (/ c b) 0.5))
(if (<= b 5.8e-147)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.7e-86) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 5.8e-147) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} 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 <= (-2.7d-86)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + ((c / b) * 0.5d0)
else if (b <= 5.8d-147) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
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 <= -2.7e-86) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 5.8e-147) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.7e-86: tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5) elif b <= 5.8e-147: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.7e-86) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(Float64(c / b) * 0.5)); elseif (b <= 5.8e-147) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.7e-86) tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5); elseif (b <= 5.8e-147) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.7e-86], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.8e-147], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.7 \cdot 10^{-86}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 5.8 \cdot 10^{-147}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -2.69999999999999992e-86Initial program 65.6%
sqr-neg65.6%
sqr-neg65.6%
associate-*l*65.6%
Simplified65.6%
Taylor expanded in b around -inf 87.5%
associate-*r*87.5%
mul-1-neg87.5%
associate-/l*90.7%
Simplified90.7%
Taylor expanded in a around inf 90.5%
*-commutative90.5%
associate-*l/90.6%
Applied egg-rr90.6%
if -2.69999999999999992e-86 < b < 5.8000000000000002e-147Initial program 73.9%
sqr-neg73.9%
sqr-neg73.9%
associate-*l*73.8%
Simplified73.8%
Taylor expanded in b around 0 70.9%
*-commutative70.9%
associate-*r*70.9%
Simplified70.9%
+-commutative70.9%
unsub-neg70.9%
*-commutative70.9%
associate-*r*71.1%
*-commutative71.1%
Applied egg-rr71.1%
if 5.8000000000000002e-147 < b Initial program 19.5%
sqr-neg19.5%
sqr-neg19.5%
associate-*l*19.5%
Simplified19.5%
Taylor expanded in b around inf 83.1%
*-commutative83.1%
Simplified83.1%
Final simplification83.3%
(FPCore (a b c)
:precision binary64
(if (<= b -6e-83)
(+ (/ (* b -0.6666666666666666) a) (* (/ c b) 0.5))
(if (<= b 5.8e-147)
(/ (- (sqrt (* a (* c -3.0))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6e-83) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 5.8e-147) {
tmp = (sqrt((a * (c * -3.0))) - b) / (a * 3.0);
} 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 <= (-6d-83)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + ((c / b) * 0.5d0)
else if (b <= 5.8d-147) then
tmp = (sqrt((a * (c * (-3.0d0)))) - b) / (a * 3.0d0)
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 <= -6e-83) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 5.8e-147) {
tmp = (Math.sqrt((a * (c * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6e-83: tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5) elif b <= 5.8e-147: tmp = (math.sqrt((a * (c * -3.0))) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6e-83) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(Float64(c / b) * 0.5)); elseif (b <= 5.8e-147) tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6e-83) tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5); elseif (b <= 5.8e-147) tmp = (sqrt((a * (c * -3.0))) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6e-83], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.8e-147], N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6 \cdot 10^{-83}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 5.8 \cdot 10^{-147}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -6.00000000000000021e-83Initial program 65.6%
sqr-neg65.6%
sqr-neg65.6%
associate-*l*65.6%
Simplified65.6%
Taylor expanded in b around -inf 87.5%
associate-*r*87.5%
mul-1-neg87.5%
associate-/l*90.7%
Simplified90.7%
Taylor expanded in a around inf 90.5%
*-commutative90.5%
associate-*l/90.6%
Applied egg-rr90.6%
if -6.00000000000000021e-83 < b < 5.8000000000000002e-147Initial program 73.9%
sqr-neg73.9%
sqr-neg73.9%
associate-*l*73.8%
Simplified73.8%
Taylor expanded in b around 0 70.9%
*-commutative70.9%
associate-*r*70.9%
Simplified70.9%
+-commutative70.9%
unsub-neg70.9%
*-commutative70.9%
associate-*r*71.1%
*-commutative71.1%
Applied egg-rr71.1%
associate-*r*70.9%
*-commutative70.9%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt70.9%
Simplified70.9%
if 5.8000000000000002e-147 < b Initial program 19.5%
sqr-neg19.5%
sqr-neg19.5%
associate-*l*19.5%
Simplified19.5%
Taylor expanded in b around inf 83.1%
*-commutative83.1%
Simplified83.1%
Final simplification83.3%
(FPCore (a b c)
:precision binary64
(if (<= b -6.6e-84)
(+ (/ (* b -0.6666666666666666) a) (* (/ c b) 0.5))
(if (<= b 5.8e-147)
(* 0.3333333333333333 (/ (- (sqrt (* c (* a -3.0))) b) a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.6e-84) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 5.8e-147) {
tmp = 0.3333333333333333 * ((sqrt((c * (a * -3.0))) - 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 <= (-6.6d-84)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + ((c / b) * 0.5d0)
else if (b <= 5.8d-147) then
tmp = 0.3333333333333333d0 * ((sqrt((c * (a * (-3.0d0)))) - 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 <= -6.6e-84) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 5.8e-147) {
tmp = 0.3333333333333333 * ((Math.sqrt((c * (a * -3.0))) - b) / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.6e-84: tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5) elif b <= 5.8e-147: tmp = 0.3333333333333333 * ((math.sqrt((c * (a * -3.0))) - b) / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.6e-84) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(Float64(c / b) * 0.5)); elseif (b <= 5.8e-147) tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - 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 <= -6.6e-84) tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5); elseif (b <= 5.8e-147) tmp = 0.3333333333333333 * ((sqrt((c * (a * -3.0))) - b) / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.6e-84], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.8e-147], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.6 \cdot 10^{-84}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 5.8 \cdot 10^{-147}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -6.59999999999999968e-84Initial program 65.6%
sqr-neg65.6%
sqr-neg65.6%
associate-*l*65.6%
Simplified65.6%
Taylor expanded in b around -inf 87.5%
associate-*r*87.5%
mul-1-neg87.5%
associate-/l*90.7%
Simplified90.7%
Taylor expanded in a around inf 90.5%
*-commutative90.5%
associate-*l/90.6%
Applied egg-rr90.6%
if -6.59999999999999968e-84 < b < 5.8000000000000002e-147Initial program 73.9%
sqr-neg73.9%
sqr-neg73.9%
associate-*l*73.8%
Simplified73.8%
Taylor expanded in b around 0 70.9%
*-commutative70.9%
associate-*r*70.9%
Simplified70.9%
+-commutative70.9%
unsub-neg70.9%
*-commutative70.9%
associate-*r*71.1%
*-commutative71.1%
Applied egg-rr71.1%
*-un-lft-identity71.1%
times-frac70.8%
metadata-eval70.8%
Applied egg-rr70.8%
if 5.8000000000000002e-147 < b Initial program 19.5%
sqr-neg19.5%
sqr-neg19.5%
associate-*l*19.5%
Simplified19.5%
Taylor expanded in b around inf 83.1%
*-commutative83.1%
Simplified83.1%
Final simplification83.3%
(FPCore (a b c)
:precision binary64
(if (<= b -1.26e-82)
(+ (/ (* b -0.6666666666666666) a) (* (/ c b) 0.5))
(if (<= b 5.8e-147)
(* 0.3333333333333333 (/ (+ b (sqrt (* c (* a -3.0)))) a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.26e-82) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 5.8e-147) {
tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / 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 <= (-1.26d-82)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + ((c / b) * 0.5d0)
else if (b <= 5.8d-147) then
tmp = 0.3333333333333333d0 * ((b + sqrt((c * (a * (-3.0d0))))) / 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 <= -1.26e-82) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else if (b <= 5.8e-147) {
tmp = 0.3333333333333333 * ((b + Math.sqrt((c * (a * -3.0)))) / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.26e-82: tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5) elif b <= 5.8e-147: tmp = 0.3333333333333333 * ((b + math.sqrt((c * (a * -3.0)))) / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.26e-82) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(Float64(c / b) * 0.5)); elseif (b <= 5.8e-147) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(c * Float64(a * -3.0)))) / 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 <= -1.26e-82) tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5); elseif (b <= 5.8e-147) tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.26e-82], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.8e-147], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.26 \cdot 10^{-82}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 5.8 \cdot 10^{-147}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.25999999999999993e-82Initial program 65.6%
sqr-neg65.6%
sqr-neg65.6%
associate-*l*65.6%
Simplified65.6%
Taylor expanded in b around -inf 87.5%
associate-*r*87.5%
mul-1-neg87.5%
associate-/l*90.7%
Simplified90.7%
Taylor expanded in a around inf 90.5%
*-commutative90.5%
associate-*l/90.6%
Applied egg-rr90.6%
if -1.25999999999999993e-82 < b < 5.8000000000000002e-147Initial program 73.9%
sqr-neg73.9%
sqr-neg73.9%
associate-*l*73.8%
Simplified73.8%
Taylor expanded in b around 0 70.9%
*-commutative70.9%
associate-*r*70.9%
Simplified70.9%
div-inv70.8%
add-sqr-sqrt42.0%
sqrt-unprod70.8%
sqr-neg70.8%
sqrt-unprod29.2%
add-sqr-sqrt69.3%
*-commutative69.3%
associate-*r*69.3%
*-commutative69.3%
associate-/r*69.2%
metadata-eval69.2%
Applied egg-rr69.2%
associate-*r/69.3%
*-commutative69.3%
associate-*r/69.3%
Simplified69.3%
if 5.8000000000000002e-147 < b Initial program 19.5%
sqr-neg19.5%
sqr-neg19.5%
associate-*l*19.5%
Simplified19.5%
Taylor expanded in b around inf 83.1%
*-commutative83.1%
Simplified83.1%
Final simplification82.9%
(FPCore (a b c) :precision binary64 (if (<= b -5e-312) (+ (/ (* b -0.6666666666666666) a) (* (/ c b) 0.5)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-312) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} 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-312)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + ((c / b) * 0.5d0)
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-312) {
tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-312: tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-312) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(Float64(c / b) * 0.5)); 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-312) tmp = ((b * -0.6666666666666666) / a) + ((c / b) * 0.5); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-312], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-312}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -5.0000000000022e-312Initial program 69.4%
sqr-neg69.4%
sqr-neg69.4%
associate-*l*69.4%
Simplified69.4%
Taylor expanded in b around -inf 68.9%
associate-*r*68.9%
mul-1-neg68.9%
associate-/l*71.3%
Simplified71.3%
Taylor expanded in a around inf 71.4%
*-commutative71.4%
associate-*l/71.5%
Applied egg-rr71.5%
if -5.0000000000022e-312 < b Initial program 28.4%
sqr-neg28.4%
sqr-neg28.4%
associate-*l*28.4%
Simplified28.4%
Taylor expanded in b around inf 68.5%
*-commutative68.5%
Simplified68.5%
Final simplification70.0%
(FPCore (a b c) :precision binary64 (if (<= b -5e-312) (+ (* (/ c b) 0.5) (* (/ b a) -0.6666666666666666)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-312) {
tmp = ((c / b) * 0.5) + ((b / a) * -0.6666666666666666);
} 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-312)) then
tmp = ((c / b) * 0.5d0) + ((b / a) * (-0.6666666666666666d0))
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-312) {
tmp = ((c / b) * 0.5) + ((b / a) * -0.6666666666666666);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-312: tmp = ((c / b) * 0.5) + ((b / a) * -0.6666666666666666) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-312) tmp = Float64(Float64(Float64(c / b) * 0.5) + Float64(Float64(b / a) * -0.6666666666666666)); 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-312) tmp = ((c / b) * 0.5) + ((b / a) * -0.6666666666666666); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-312], N[(N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision] + N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-312}:\\
\;\;\;\;\frac{c}{b} \cdot 0.5 + \frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -5.0000000000022e-312Initial program 69.4%
sqr-neg69.4%
sqr-neg69.4%
associate-*l*69.4%
Simplified69.4%
Taylor expanded in b around -inf 68.9%
associate-*r*68.9%
mul-1-neg68.9%
associate-/l*71.3%
Simplified71.3%
Taylor expanded in a around inf 71.4%
if -5.0000000000022e-312 < b Initial program 28.4%
sqr-neg28.4%
sqr-neg28.4%
associate-*l*28.4%
Simplified28.4%
Taylor expanded in b around inf 68.5%
*-commutative68.5%
Simplified68.5%
Final simplification70.0%
(FPCore (a b c) :precision binary64 (if (<= b 1.9e-252) (/ b (* -1.5 a)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.9e-252) {
tmp = b / (-1.5 * 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 <= 1.9d-252) then
tmp = b / ((-1.5d0) * 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 <= 1.9e-252) {
tmp = b / (-1.5 * a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.9e-252: tmp = b / (-1.5 * a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.9e-252) tmp = Float64(b / Float64(-1.5 * 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 <= 1.9e-252) tmp = b / (-1.5 * a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.9e-252], N[(b / N[(-1.5 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.9 \cdot 10^{-252}:\\
\;\;\;\;\frac{b}{-1.5 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 1.9e-252Initial program 69.7%
sqr-neg69.7%
sqr-neg69.7%
associate-*l*69.7%
Simplified69.7%
Applied egg-rr60.6%
Taylor expanded in b around -inf 65.8%
*-commutative65.8%
associate-*l/65.9%
associate-/l*65.8%
Simplified65.8%
clear-num65.7%
un-div-inv65.8%
div-inv65.9%
metadata-eval65.9%
Applied egg-rr65.9%
if 1.9e-252 < b Initial program 24.2%
sqr-neg24.2%
sqr-neg24.2%
associate-*l*24.1%
Simplified24.1%
Taylor expanded in b around inf 74.6%
*-commutative74.6%
Simplified74.6%
Final simplification69.9%
(FPCore (a b c) :precision binary64 (if (<= b 1.9e-252) (* (/ b a) -0.6666666666666666) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.9e-252) {
tmp = (b / a) * -0.6666666666666666;
} 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 <= 1.9d-252) then
tmp = (b / a) * (-0.6666666666666666d0)
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 <= 1.9e-252) {
tmp = (b / a) * -0.6666666666666666;
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.9e-252: tmp = (b / a) * -0.6666666666666666 else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.9e-252) tmp = Float64(Float64(b / a) * -0.6666666666666666); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.9e-252) tmp = (b / a) * -0.6666666666666666; else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.9e-252], N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.9 \cdot 10^{-252}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 1.9e-252Initial program 69.7%
sqr-neg69.7%
sqr-neg69.7%
associate-*l*69.7%
Simplified69.7%
Taylor expanded in b around -inf 65.8%
*-commutative65.8%
Simplified65.8%
if 1.9e-252 < b Initial program 24.2%
sqr-neg24.2%
sqr-neg24.2%
associate-*l*24.1%
Simplified24.1%
Taylor expanded in b around inf 74.6%
*-commutative74.6%
Simplified74.6%
(FPCore (a b c) :precision binary64 (if (<= b 8.8e+56) (* (/ b a) -0.6666666666666666) (* (/ c b) 0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 8.8e+56) {
tmp = (b / a) * -0.6666666666666666;
} 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 <= 8.8d+56) then
tmp = (b / a) * (-0.6666666666666666d0)
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 <= 8.8e+56) {
tmp = (b / a) * -0.6666666666666666;
} else {
tmp = (c / b) * 0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 8.8e+56: tmp = (b / a) * -0.6666666666666666 else: tmp = (c / b) * 0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 8.8e+56) tmp = Float64(Float64(b / a) * -0.6666666666666666); else tmp = Float64(Float64(c / b) * 0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 8.8e+56) tmp = (b / a) * -0.6666666666666666; else tmp = (c / b) * 0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 8.8e+56], N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.8 \cdot 10^{+56}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot 0.5\\
\end{array}
\end{array}
if b < 8.80000000000000063e56Initial program 63.8%
sqr-neg63.8%
sqr-neg63.8%
associate-*l*63.7%
Simplified63.7%
Taylor expanded in b around -inf 50.6%
*-commutative50.6%
Simplified50.6%
if 8.80000000000000063e56 < b Initial program 10.9%
sqr-neg10.9%
sqr-neg10.9%
associate-*l*10.9%
Simplified10.9%
Taylor expanded in b around -inf 2.0%
associate-*r*2.0%
mul-1-neg2.0%
associate-/l*2.3%
Simplified2.3%
Taylor expanded in b around 0 23.9%
Final simplification43.1%
(FPCore (a b c) :precision binary64 (if (<= b 1.1e+57) (* b (/ -0.6666666666666666 a)) (* (/ c b) 0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.1e+57) {
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 <= 1.1d+57) 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 <= 1.1e+57) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * 0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.1e+57: tmp = b * (-0.6666666666666666 / a) else: tmp = (c / b) * 0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.1e+57) 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 <= 1.1e+57) tmp = b * (-0.6666666666666666 / a); else tmp = (c / b) * 0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.1e+57], 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 1.1 \cdot 10^{+57}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot 0.5\\
\end{array}
\end{array}
if b < 1.1e57Initial program 63.8%
sqr-neg63.8%
sqr-neg63.8%
associate-*l*63.7%
Simplified63.7%
Applied egg-rr55.9%
Taylor expanded in b around -inf 50.6%
*-commutative50.6%
associate-*l/50.6%
associate-/l*50.6%
Simplified50.6%
if 1.1e57 < b Initial program 10.9%
sqr-neg10.9%
sqr-neg10.9%
associate-*l*10.9%
Simplified10.9%
Taylor expanded in b around -inf 2.0%
associate-*r*2.0%
mul-1-neg2.0%
associate-/l*2.3%
Simplified2.3%
Taylor expanded in b around 0 23.9%
Final simplification43.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 48.9%
sqr-neg48.9%
sqr-neg48.9%
associate-*l*48.9%
Simplified48.9%
Taylor expanded in b around -inf 35.5%
associate-*r*35.5%
mul-1-neg35.5%
associate-/l*36.8%
Simplified36.8%
Taylor expanded in b around 0 8.8%
Final simplification8.8%
herbie shell --seed 2024086
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))