
(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 -2.9e+152)
(/ (* b -0.6666666666666666) a)
(if (<= b 1.75e-82)
(/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
(* c (- (* -0.375 (* a (/ c (pow b 3.0)))) (/ 0.5 b))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.9e+152) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 1.75e-82) {
tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = c * ((-0.375 * (a * (c / pow(b, 3.0)))) - (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.9d+152)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 1.75d-82) then
tmp = (sqrt(((b * b) - ((a * 3.0d0) * c))) - b) / (a * 3.0d0)
else
tmp = c * (((-0.375d0) * (a * (c / (b ** 3.0d0)))) - (0.5d0 / b))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.9e+152) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 1.75e-82) {
tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = c * ((-0.375 * (a * (c / Math.pow(b, 3.0)))) - (0.5 / b));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.9e+152: tmp = (b * -0.6666666666666666) / a elif b <= 1.75e-82: tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0) else: tmp = c * ((-0.375 * (a * (c / math.pow(b, 3.0)))) - (0.5 / b)) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.9e+152) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 1.75e-82) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0)); else tmp = Float64(c * Float64(Float64(-0.375 * Float64(a * Float64(c / (b ^ 3.0)))) - Float64(0.5 / b))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.9e+152) tmp = (b * -0.6666666666666666) / a; elseif (b <= 1.75e-82) tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0); else tmp = c * ((-0.375 * (a * (c / (b ^ 3.0)))) - (0.5 / b)); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.9e+152], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 1.75e-82], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * 3.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(-0.375 * N[(a * N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.9 \cdot 10^{+152}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 1.75 \cdot 10^{-82}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(-0.375 \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) - \frac{0.5}{b}\right)\\
\end{array}
\end{array}
if b < -2.8999999999999998e152Initial program 39.0%
sqr-neg39.0%
sqr-neg39.0%
associate-*l*39.0%
Simplified39.0%
Taylor expanded in b around -inf 99.5%
*-commutative99.5%
Simplified99.5%
associate-*l/99.6%
Applied egg-rr99.6%
if -2.8999999999999998e152 < b < 1.7499999999999999e-82Initial program 88.2%
if 1.7499999999999999e-82 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in c around 0 92.1%
associate-/l*93.4%
associate-*r/93.4%
metadata-eval93.4%
Simplified93.4%
Final simplification92.1%
(FPCore (a b c)
:precision binary64
(if (<= b -5.2e+152)
(/ (* b -0.6666666666666666) a)
(if (<= b 1.75e-82)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
(* c (- (* -0.375 (* a (/ c (pow b 3.0)))) (/ 0.5 b))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.2e+152) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 1.75e-82) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = c * ((-0.375 * (a * (c / pow(b, 3.0)))) - (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+152)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 1.75d-82) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (a * 3.0d0)
else
tmp = c * (((-0.375d0) * (a * (c / (b ** 3.0d0)))) - (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+152) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 1.75e-82) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = c * ((-0.375 * (a * (c / Math.pow(b, 3.0)))) - (0.5 / b));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.2e+152: tmp = (b * -0.6666666666666666) / a elif b <= 1.75e-82: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0) else: tmp = c * ((-0.375 * (a * (c / math.pow(b, 3.0)))) - (0.5 / b)) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.2e+152) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 1.75e-82) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0)); else tmp = Float64(c * Float64(Float64(-0.375 * Float64(a * Float64(c / (b ^ 3.0)))) - Float64(0.5 / b))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5.2e+152) tmp = (b * -0.6666666666666666) / a; elseif (b <= 1.75e-82) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0); else tmp = c * ((-0.375 * (a * (c / (b ^ 3.0)))) - (0.5 / b)); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.2e+152], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 1.75e-82], 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[(c * N[(N[(-0.375 * N[(a * N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.2 \cdot 10^{+152}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 1.75 \cdot 10^{-82}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(-0.375 \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) - \frac{0.5}{b}\right)\\
\end{array}
\end{array}
if b < -5.2000000000000001e152Initial program 39.0%
sqr-neg39.0%
sqr-neg39.0%
associate-*l*39.0%
Simplified39.0%
Taylor expanded in b around -inf 99.5%
*-commutative99.5%
Simplified99.5%
associate-*l/99.6%
Applied egg-rr99.6%
if -5.2000000000000001e152 < b < 1.7499999999999999e-82Initial program 88.2%
sqr-neg88.2%
sqr-neg88.2%
associate-*l*88.2%
Simplified88.2%
if 1.7499999999999999e-82 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in c around 0 92.1%
associate-/l*93.4%
associate-*r/93.4%
metadata-eval93.4%
Simplified93.4%
Final simplification92.0%
(FPCore (a b c)
:precision binary64
(if (<= b -1.62e-83)
(* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
(if (<= b 1.5e-82)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(* c (- (* -0.375 (* a (/ c (pow b 3.0)))) (/ 0.5 b))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.62e-83) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else if (b <= 1.5e-82) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = c * ((-0.375 * (a * (c / pow(b, 3.0)))) - (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.62d-83)) then
tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.5d0) * (c / (b ** 2.0d0))))
else if (b <= 1.5d-82) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
else
tmp = c * (((-0.375d0) * (a * (c / (b ** 3.0d0)))) - (0.5d0 / b))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.62e-83) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
} else if (b <= 1.5e-82) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = c * ((-0.375 * (a * (c / Math.pow(b, 3.0)))) - (0.5 / b));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.62e-83: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) elif b <= 1.5e-82: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = c * ((-0.375 * (a * (c / math.pow(b, 3.0)))) - (0.5 / b)) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.62e-83) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); elseif (b <= 1.5e-82) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(c * Float64(Float64(-0.375 * Float64(a * Float64(c / (b ^ 3.0)))) - Float64(0.5 / b))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.62e-83) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); elseif (b <= 1.5e-82) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = c * ((-0.375 * (a * (c / (b ^ 3.0)))) - (0.5 / b)); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.62e-83], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.5e-82], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(-0.375 * N[(a * N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.62 \cdot 10^{-83}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{-82}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(-0.375 \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) - \frac{0.5}{b}\right)\\
\end{array}
\end{array}
if b < -1.6199999999999999e-83Initial program 67.6%
sqr-neg67.6%
sqr-neg67.6%
associate-*l*67.6%
Simplified67.6%
Taylor expanded in b around -inf 88.9%
if -1.6199999999999999e-83 < b < 1.4999999999999999e-82Initial program 83.5%
sqr-neg83.5%
sqr-neg83.5%
associate-*l*83.4%
Simplified83.4%
Taylor expanded in b around 0 78.4%
+-commutative78.4%
unsub-neg78.4%
*-commutative78.4%
*-commutative78.4%
associate-*r*78.5%
Applied egg-rr78.5%
if 1.4999999999999999e-82 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in c around 0 92.1%
associate-/l*93.4%
associate-*r/93.4%
metadata-eval93.4%
Simplified93.4%
Final simplification87.4%
(FPCore (a b c)
:precision binary64
(if (<= b -1.65e-76)
(* -0.3333333333333333 (* b (- (/ 2.0 a) (* (/ c (pow b 2.0)) 1.5))))
(if (<= b 1.85e-83)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(* c (- (* -0.375 (* a (/ c (pow b 3.0)))) (/ 0.5 b))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.65e-76) {
tmp = -0.3333333333333333 * (b * ((2.0 / a) - ((c / pow(b, 2.0)) * 1.5)));
} else if (b <= 1.85e-83) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = c * ((-0.375 * (a * (c / pow(b, 3.0)))) - (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.65d-76)) then
tmp = (-0.3333333333333333d0) * (b * ((2.0d0 / a) - ((c / (b ** 2.0d0)) * 1.5d0)))
else if (b <= 1.85d-83) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
else
tmp = c * (((-0.375d0) * (a * (c / (b ** 3.0d0)))) - (0.5d0 / b))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.65e-76) {
tmp = -0.3333333333333333 * (b * ((2.0 / a) - ((c / Math.pow(b, 2.0)) * 1.5)));
} else if (b <= 1.85e-83) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = c * ((-0.375 * (a * (c / Math.pow(b, 3.0)))) - (0.5 / b));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.65e-76: tmp = -0.3333333333333333 * (b * ((2.0 / a) - ((c / math.pow(b, 2.0)) * 1.5))) elif b <= 1.85e-83: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = c * ((-0.375 * (a * (c / math.pow(b, 3.0)))) - (0.5 / b)) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.65e-76) tmp = Float64(-0.3333333333333333 * Float64(b * Float64(Float64(2.0 / a) - Float64(Float64(c / (b ^ 2.0)) * 1.5)))); elseif (b <= 1.85e-83) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(c * Float64(Float64(-0.375 * Float64(a * Float64(c / (b ^ 3.0)))) - Float64(0.5 / b))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.65e-76) tmp = -0.3333333333333333 * (b * ((2.0 / a) - ((c / (b ^ 2.0)) * 1.5))); elseif (b <= 1.85e-83) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = c * ((-0.375 * (a * (c / (b ^ 3.0)))) - (0.5 / b)); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.65e-76], N[(-0.3333333333333333 * N[(b * N[(N[(2.0 / a), $MachinePrecision] - N[(N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.85e-83], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(-0.375 * N[(a * N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.65 \cdot 10^{-76}:\\
\;\;\;\;-0.3333333333333333 \cdot \left(b \cdot \left(\frac{2}{a} - \frac{c}{{b}^{2}} \cdot 1.5\right)\right)\\
\mathbf{elif}\;b \leq 1.85 \cdot 10^{-83}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(-0.375 \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) - \frac{0.5}{b}\right)\\
\end{array}
\end{array}
if b < -1.64999999999999992e-76Initial program 67.6%
sqr-neg67.6%
sqr-neg67.6%
associate-*l*67.6%
Simplified67.6%
frac-2neg67.6%
div-inv67.5%
Applied egg-rr67.5%
associate-*r/67.6%
*-rgt-identity67.6%
*-commutative67.6%
metadata-eval67.6%
distribute-lft-neg-in67.6%
distribute-neg-frac267.6%
distribute-neg-frac67.6%
neg-mul-167.6%
times-frac67.6%
metadata-eval67.6%
fma-undefine67.6%
unpow267.6%
+-commutative67.6%
fma-define67.6%
Simplified67.6%
Taylor expanded in b around -inf 88.8%
associate-*r*88.8%
mul-1-neg88.8%
associate-*r/88.8%
metadata-eval88.8%
Simplified88.8%
if -1.64999999999999992e-76 < b < 1.84999999999999997e-83Initial program 83.5%
sqr-neg83.5%
sqr-neg83.5%
associate-*l*83.4%
Simplified83.4%
Taylor expanded in b around 0 78.4%
+-commutative78.4%
unsub-neg78.4%
*-commutative78.4%
*-commutative78.4%
associate-*r*78.5%
Applied egg-rr78.5%
if 1.84999999999999997e-83 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in c around 0 92.1%
associate-/l*93.4%
associate-*r/93.4%
metadata-eval93.4%
Simplified93.4%
Final simplification87.4%
(FPCore (a b c)
:precision binary64
(if (<= b -1.35e-77)
(/ (* b -2.0) (* a 3.0))
(if (<= b 2.4e-83)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(* c (- (* -0.375 (* a (/ c (pow b 3.0)))) (/ 0.5 b))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.35e-77) {
tmp = (b * -2.0) / (a * 3.0);
} else if (b <= 2.4e-83) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = c * ((-0.375 * (a * (c / pow(b, 3.0)))) - (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.35d-77)) then
tmp = (b * (-2.0d0)) / (a * 3.0d0)
else if (b <= 2.4d-83) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
else
tmp = c * (((-0.375d0) * (a * (c / (b ** 3.0d0)))) - (0.5d0 / b))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.35e-77) {
tmp = (b * -2.0) / (a * 3.0);
} else if (b <= 2.4e-83) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = c * ((-0.375 * (a * (c / Math.pow(b, 3.0)))) - (0.5 / b));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.35e-77: tmp = (b * -2.0) / (a * 3.0) elif b <= 2.4e-83: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = c * ((-0.375 * (a * (c / math.pow(b, 3.0)))) - (0.5 / b)) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.35e-77) tmp = Float64(Float64(b * -2.0) / Float64(a * 3.0)); elseif (b <= 2.4e-83) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(c * Float64(Float64(-0.375 * Float64(a * Float64(c / (b ^ 3.0)))) - Float64(0.5 / b))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.35e-77) tmp = (b * -2.0) / (a * 3.0); elseif (b <= 2.4e-83) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = c * ((-0.375 * (a * (c / (b ^ 3.0)))) - (0.5 / b)); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.35e-77], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.4e-83], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(-0.375 * N[(a * N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.35 \cdot 10^{-77}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\
\mathbf{elif}\;b \leq 2.4 \cdot 10^{-83}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(-0.375 \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) - \frac{0.5}{b}\right)\\
\end{array}
\end{array}
if b < -1.35e-77Initial program 67.6%
sqr-neg67.6%
sqr-neg67.6%
associate-*l*67.6%
Simplified67.6%
Taylor expanded in b around -inf 88.8%
*-commutative88.8%
Simplified88.8%
if -1.35e-77 < b < 2.4000000000000001e-83Initial program 83.5%
sqr-neg83.5%
sqr-neg83.5%
associate-*l*83.4%
Simplified83.4%
Taylor expanded in b around 0 78.4%
+-commutative78.4%
unsub-neg78.4%
*-commutative78.4%
*-commutative78.4%
associate-*r*78.5%
Applied egg-rr78.5%
if 2.4000000000000001e-83 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in c around 0 92.1%
associate-/l*93.4%
associate-*r/93.4%
metadata-eval93.4%
Simplified93.4%
Final simplification87.4%
(FPCore (a b c)
:precision binary64
(if (<= b -1.25e-72)
(/ (* b -2.0) (* a 3.0))
(if (<= b 1.22e-82)
(/ (- (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.25e-72) {
tmp = (b * -2.0) / (a * 3.0);
} else if (b <= 1.22e-82) {
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 <= (-1.25d-72)) then
tmp = (b * (-2.0d0)) / (a * 3.0d0)
else if (b <= 1.22d-82) 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 <= -1.25e-72) {
tmp = (b * -2.0) / (a * 3.0);
} else if (b <= 1.22e-82) {
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 <= -1.25e-72: tmp = (b * -2.0) / (a * 3.0) elif b <= 1.22e-82: 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 <= -1.25e-72) tmp = Float64(Float64(b * -2.0) / Float64(a * 3.0)); elseif (b <= 1.22e-82) 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
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.25e-72) tmp = (b * -2.0) / (a * 3.0); elseif (b <= 1.22e-82) 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, -1.25e-72], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.22e-82], 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.25 \cdot 10^{-72}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\
\mathbf{elif}\;b \leq 1.22 \cdot 10^{-82}:\\
\;\;\;\;\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.2499999999999999e-72Initial program 67.6%
sqr-neg67.6%
sqr-neg67.6%
associate-*l*67.6%
Simplified67.6%
Taylor expanded in b around -inf 88.8%
*-commutative88.8%
Simplified88.8%
if -1.2499999999999999e-72 < b < 1.22000000000000001e-82Initial program 83.5%
sqr-neg83.5%
sqr-neg83.5%
associate-*l*83.4%
Simplified83.4%
Taylor expanded in b around 0 78.4%
+-commutative78.4%
unsub-neg78.4%
*-commutative78.4%
*-commutative78.4%
associate-*r*78.5%
Applied egg-rr78.5%
if 1.22000000000000001e-82 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in b around inf 32.8%
associate-/l*32.9%
Simplified32.9%
Taylor expanded in b around 0 92.8%
associate-*r/92.8%
Simplified92.8%
Final simplification87.2%
(FPCore (a b c)
:precision binary64
(if (<= b -1.9e-140)
(/ (* b -2.0) (* a 3.0))
(if (<= b 1.3e-82)
(* 0.3333333333333333 (/ (+ b (sqrt (* c (* a -3.0)))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.9e-140) {
tmp = (b * -2.0) / (a * 3.0);
} else if (b <= 1.3e-82) {
tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.9d-140)) then
tmp = (b * (-2.0d0)) / (a * 3.0d0)
else if (b <= 1.3d-82) then
tmp = 0.3333333333333333d0 * ((b + sqrt((c * (a * (-3.0d0))))) / a)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.9e-140) {
tmp = (b * -2.0) / (a * 3.0);
} else if (b <= 1.3e-82) {
tmp = 0.3333333333333333 * ((b + Math.sqrt((c * (a * -3.0)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.9e-140: tmp = (b * -2.0) / (a * 3.0) elif b <= 1.3e-82: tmp = 0.3333333333333333 * ((b + math.sqrt((c * (a * -3.0)))) / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.9e-140) tmp = Float64(Float64(b * -2.0) / Float64(a * 3.0)); elseif (b <= 1.3e-82) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(c * Float64(a * -3.0)))) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.9e-140) tmp = (b * -2.0) / (a * 3.0); elseif (b <= 1.3e-82) tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.9e-140], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.3e-82], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(c * N[(a * -3.0), $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.9 \cdot 10^{-140}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\
\mathbf{elif}\;b \leq 1.3 \cdot 10^{-82}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.89999999999999999e-140Initial program 68.2%
sqr-neg68.2%
sqr-neg68.2%
associate-*l*68.2%
Simplified68.2%
Taylor expanded in b around -inf 85.1%
*-commutative85.1%
Simplified85.1%
if -1.89999999999999999e-140 < b < 1.3e-82Initial program 84.5%
sqr-neg84.5%
sqr-neg84.5%
associate-*l*84.3%
Simplified84.3%
Taylor expanded in b around 0 82.4%
div-inv82.3%
add-sqr-sqrt41.4%
sqrt-unprod82.2%
sqr-neg82.2%
sqrt-prod41.1%
add-sqr-sqrt81.7%
*-commutative81.7%
*-commutative81.7%
associate-*r*81.8%
*-commutative81.8%
metadata-eval81.8%
div-inv81.7%
clear-num81.7%
Applied egg-rr81.7%
associate-*r/81.9%
*-commutative81.9%
associate-*r/81.8%
Simplified81.8%
if 1.3e-82 < b Initial program 13.4%
sqr-neg13.4%
sqr-neg13.4%
associate-*l*13.4%
Simplified13.4%
Taylor expanded in b around inf 32.8%
associate-/l*32.9%
Simplified32.9%
Taylor expanded in b around 0 92.8%
associate-*r/92.8%
Simplified92.8%
Final simplification86.9%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (/ (* b -2.0) (* a 3.0)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (b * -2.0) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-310)) then
tmp = (b * (-2.0d0)) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (b * -2.0) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = (b * -2.0) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(b * -2.0) / 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 <= -5e-310) tmp = (b * -2.0) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(b * -2.0), $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 \cdot 10^{-310}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 73.3%
sqr-neg73.3%
sqr-neg73.3%
associate-*l*73.3%
Simplified73.3%
Taylor expanded in b around -inf 67.4%
*-commutative67.4%
Simplified67.4%
if -4.999999999999985e-310 < b Initial program 32.0%
sqr-neg32.0%
sqr-neg32.0%
associate-*l*31.9%
Simplified31.9%
Taylor expanded in b around inf 24.7%
associate-/l*24.9%
Simplified24.9%
Taylor expanded in b around 0 70.6%
associate-*r/70.6%
Simplified70.6%
Final simplification68.9%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (/ (* b -0.6666666666666666) a) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-310)) then
tmp = (b * (-0.6666666666666666d0)) / a
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = (b * -0.6666666666666666) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) 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-310) tmp = (b * -0.6666666666666666) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], 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^{-310}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 73.3%
sqr-neg73.3%
sqr-neg73.3%
associate-*l*73.3%
Simplified73.3%
Taylor expanded in b around -inf 67.4%
*-commutative67.4%
Simplified67.4%
associate-*l/67.4%
Applied egg-rr67.4%
if -4.999999999999985e-310 < b Initial program 32.0%
sqr-neg32.0%
sqr-neg32.0%
associate-*l*31.9%
Simplified31.9%
Taylor expanded in b around inf 24.7%
associate-/l*24.9%
Simplified24.9%
Taylor expanded in b around 0 70.6%
associate-*r/70.6%
Simplified70.6%
Final simplification68.9%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (* -0.6666666666666666 (/ b a)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -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-310)) then
tmp = (-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-310) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = -0.6666666666666666 * (b / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = 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-310) tmp = -0.6666666666666666 * (b / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 73.3%
sqr-neg73.3%
sqr-neg73.3%
associate-*l*73.3%
Simplified73.3%
Taylor expanded in b around -inf 67.4%
*-commutative67.4%
Simplified67.4%
if -4.999999999999985e-310 < b Initial program 32.0%
sqr-neg32.0%
sqr-neg32.0%
associate-*l*31.9%
Simplified31.9%
Taylor expanded in b around inf 24.7%
associate-/l*24.9%
Simplified24.9%
Taylor expanded in b around 0 70.6%
associate-*r/70.6%
Simplified70.6%
Final simplification68.9%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (* -0.6666666666666666 (/ b a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-310)) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = -0.6666666666666666 * (b / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = -0.6666666666666666 * (b / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 73.3%
sqr-neg73.3%
sqr-neg73.3%
associate-*l*73.3%
Simplified73.3%
Taylor expanded in b around -inf 67.4%
*-commutative67.4%
Simplified67.4%
if -4.999999999999985e-310 < b Initial program 32.0%
sqr-neg32.0%
sqr-neg32.0%
associate-*l*31.9%
Simplified31.9%
Taylor expanded in b around inf 70.6%
*-commutative70.6%
Simplified70.6%
Final simplification68.9%
(FPCore (a b c) :precision binary64 (if (<= b 660.0) (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 660.0) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = 0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 660.0d0) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = 0.5d0 * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 660.0) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = 0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 660.0: tmp = -0.6666666666666666 * (b / a) else: tmp = 0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 660.0) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 660.0) tmp = -0.6666666666666666 * (b / a); else tmp = 0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 660.0], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 660:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 660Initial program 72.3%
sqr-neg72.3%
sqr-neg72.3%
associate-*l*72.2%
Simplified72.2%
Taylor expanded in b around -inf 51.7%
*-commutative51.7%
Simplified51.7%
if 660 < b Initial program 10.7%
sqr-neg10.7%
sqr-neg10.7%
associate-*l*10.7%
Simplified10.7%
Taylor expanded in b around inf 80.4%
associate-*r/80.3%
*-commutative80.3%
associate-*l*80.4%
Simplified80.4%
frac-2neg80.4%
div-inv80.3%
distribute-neg-frac280.3%
add-sqr-sqrt0.0%
sqrt-unprod34.3%
sqr-neg34.3%
sqrt-prod33.9%
add-sqr-sqrt33.9%
associate-/l*34.0%
*-commutative34.0%
*-un-lft-identity34.0%
times-frac34.0%
metadata-eval34.0%
distribute-lft-neg-in34.0%
metadata-eval34.0%
*-commutative34.0%
Applied egg-rr34.0%
associate-*r/34.0%
*-rgt-identity34.0%
associate-*l/33.8%
associate-*r*33.8%
associate-/r*33.8%
*-inverses33.8%
metadata-eval33.8%
metadata-eval33.8%
Simplified33.8%
Final simplification46.3%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-5) (* b (/ -0.6666666666666666 a)) (* 0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-5) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = 0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 4.2d-5) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = 0.5d0 * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-5) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = 0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-5: tmp = b * (-0.6666666666666666 / a) else: tmp = 0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 4.2e-5) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 4.2e-5) tmp = b * (-0.6666666666666666 / a); else tmp = 0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 4.2e-5], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.2 \cdot 10^{-5}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 4.19999999999999977e-5Initial program 72.3%
sqr-neg72.3%
sqr-neg72.3%
associate-*l*72.2%
Simplified72.2%
Taylor expanded in b around -inf 51.7%
*-commutative51.7%
Simplified51.7%
*-commutative51.7%
clear-num51.6%
un-div-inv51.6%
Applied egg-rr51.6%
associate-/r/51.6%
Simplified51.6%
if 4.19999999999999977e-5 < b Initial program 10.7%
sqr-neg10.7%
sqr-neg10.7%
associate-*l*10.7%
Simplified10.7%
Taylor expanded in b around inf 80.4%
associate-*r/80.3%
*-commutative80.3%
associate-*l*80.4%
Simplified80.4%
frac-2neg80.4%
div-inv80.3%
distribute-neg-frac280.3%
add-sqr-sqrt0.0%
sqrt-unprod34.3%
sqr-neg34.3%
sqrt-prod33.9%
add-sqr-sqrt33.9%
associate-/l*34.0%
*-commutative34.0%
*-un-lft-identity34.0%
times-frac34.0%
metadata-eval34.0%
distribute-lft-neg-in34.0%
metadata-eval34.0%
*-commutative34.0%
Applied egg-rr34.0%
associate-*r/34.0%
*-rgt-identity34.0%
associate-*l/33.8%
associate-*r*33.8%
associate-/r*33.8%
*-inverses33.8%
metadata-eval33.8%
metadata-eval33.8%
Simplified33.8%
Final simplification46.2%
(FPCore (a b c) :precision binary64 (* 0.5 (/ c b)))
double code(double a, double b, double c) {
return 0.5 * (c / b);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = 0.5d0 * (c / b)
end function
public static double code(double a, double b, double c) {
return 0.5 * (c / b);
}
def code(a, b, c): return 0.5 * (c / b)
function code(a, b, c) return Float64(0.5 * Float64(c / b)) end
function tmp = code(a, b, c) tmp = 0.5 * (c / b); end
code[a_, b_, c_] := N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \frac{c}{b}
\end{array}
Initial program 53.8%
sqr-neg53.8%
sqr-neg53.8%
associate-*l*53.7%
Simplified53.7%
Taylor expanded in b around inf 28.1%
associate-*r/28.0%
*-commutative28.0%
associate-*l*28.1%
Simplified28.1%
frac-2neg28.1%
div-inv28.0%
distribute-neg-frac228.0%
add-sqr-sqrt1.1%
sqrt-unprod11.5%
sqr-neg11.5%
sqrt-prod10.5%
add-sqr-sqrt12.4%
associate-/l*12.5%
*-commutative12.5%
*-un-lft-identity12.5%
times-frac12.5%
metadata-eval12.5%
distribute-lft-neg-in12.5%
metadata-eval12.5%
*-commutative12.5%
Applied egg-rr12.5%
associate-*r/12.5%
*-rgt-identity12.5%
associate-*l/12.4%
associate-*r*12.4%
associate-/r*12.4%
*-inverses12.4%
metadata-eval12.4%
metadata-eval12.4%
Simplified12.4%
herbie shell --seed 2024097
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))