
(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 -1e+76)
(/ (fma b -2.0 (/ (* 1.5 a) (/ b c))) (* a 3.0))
(if (<= b 8e-43)
(/ (- (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 <= -1e+76) {
tmp = fma(b, -2.0, ((1.5 * a) / (b / c))) / (a * 3.0);
} else if (b <= 8e-43) {
tmp = (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 <= -1e+76) tmp = Float64(fma(b, -2.0, Float64(Float64(1.5 * a) / Float64(b / c))) / Float64(a * 3.0)); elseif (b <= 8e-43) 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
code[a_, b_, c_] := If[LessEqual[b, -1e+76], N[(N[(b * -2.0 + N[(N[(1.5 * a), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8e-43], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+76}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{1.5 \cdot a}{\frac{b}{c}}\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 8 \cdot 10^{-43}:\\
\;\;\;\;\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 < -1e76Initial program 62.1%
Taylor expanded in b around -inf 88.0%
*-commutative88.0%
fma-def88.0%
associate-/l*95.6%
associate-*r/95.6%
Simplified95.6%
if -1e76 < b < 8.00000000000000062e-43Initial program 88.6%
if 8.00000000000000062e-43 < b Initial program 15.7%
Taylor expanded in b around inf 90.0%
associate-*r/90.0%
Simplified90.0%
Final simplification90.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2.9e-127)
(/ (fma b -2.0 (/ (* 1.5 a) (/ b c))) (* a 3.0))
(if (<= b 1e-42)
(* (- (sqrt (* c (* a -3.0))) b) (/ -1.0 (* a -3.0)))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.9e-127) {
tmp = fma(b, -2.0, ((1.5 * a) / (b / c))) / (a * 3.0);
} else if (b <= 1e-42) {
tmp = (sqrt((c * (a * -3.0))) - b) * (-1.0 / (a * -3.0));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.9e-127) tmp = Float64(fma(b, -2.0, Float64(Float64(1.5 * a) / Float64(b / c))) / Float64(a * 3.0)); elseif (b <= 1e-42) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) * 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, -2.9e-127], N[(N[(b * -2.0 + N[(N[(1.5 * a), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1e-42], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $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.9 \cdot 10^{-127}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{1.5 \cdot a}{\frac{b}{c}}\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 10^{-42}:\\
\;\;\;\;\left(\sqrt{c \cdot \left(a \cdot -3\right)} - b\right) \cdot \frac{-1}{a \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.9e-127Initial program 74.3%
Taylor expanded in b around -inf 82.3%
*-commutative82.3%
fma-def82.3%
associate-/l*87.4%
associate-*r/87.4%
Simplified87.4%
if -2.9e-127 < b < 1.00000000000000004e-42Initial program 83.5%
Taylor expanded in b around 0 82.7%
associate-*r*83.1%
*-commutative83.1%
*-commutative83.1%
Simplified83.1%
+-commutative83.1%
unsub-neg83.1%
Applied egg-rr83.1%
frac-2neg83.1%
div-inv83.2%
distribute-lft-neg-in83.2%
metadata-eval83.2%
*-commutative83.2%
Applied egg-rr83.2%
if 1.00000000000000004e-42 < b Initial program 15.7%
Taylor expanded in b around inf 90.0%
associate-*r/90.0%
Simplified90.0%
Final simplification87.2%
(FPCore (a b c)
:precision binary64
(if (<= b -2.9e-127)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 5.6e-41)
(* 0.3333333333333333 (/ (+ b (sqrt (* a (* c -3.0)))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.9e-127) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 5.6e-41) {
tmp = 0.3333333333333333 * ((b + 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 <= (-2.9d-127)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 5.6d-41) then
tmp = 0.3333333333333333d0 * ((b + 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 <= -2.9e-127) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 5.6e-41) {
tmp = 0.3333333333333333 * ((b + Math.sqrt((a * (c * -3.0)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.9e-127: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 5.6e-41: tmp = 0.3333333333333333 * ((b + 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 <= -2.9e-127) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 5.6e-41) tmp = Float64(0.3333333333333333 * Float64(Float64(b + 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 <= -2.9e-127) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 5.6e-41) tmp = 0.3333333333333333 * ((b + sqrt((a * (c * -3.0)))) / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.9e-127], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.6e-41], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(a * N[(c * -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 -2.9 \cdot 10^{-127}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 5.6 \cdot 10^{-41}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.9e-127Initial program 74.3%
Taylor expanded in b around -inf 87.4%
if -2.9e-127 < b < 5.6000000000000003e-41Initial program 83.5%
Taylor expanded in b around 0 82.7%
associate-*r*83.1%
*-commutative83.1%
*-commutative83.1%
Simplified83.1%
*-un-lft-identity83.1%
*-commutative83.1%
times-frac83.0%
div-inv82.9%
+-commutative82.9%
add-sqr-sqrt41.7%
sqrt-unprod82.7%
sqr-neg82.7%
sqrt-unprod41.2%
add-sqr-sqrt82.6%
metadata-eval82.6%
Applied egg-rr82.6%
associate-*l/82.7%
*-lft-identity82.7%
*-commutative82.7%
associate-*r/82.7%
+-commutative82.7%
associate-*r*82.6%
*-commutative82.6%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt82.8%
Simplified82.8%
if 5.6000000000000003e-41 < b Initial program 15.7%
Taylor expanded in b around inf 90.0%
associate-*r/90.0%
Simplified90.0%
Final simplification87.1%
(FPCore (a b c)
:precision binary64
(if (<= b -2.9e-127)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 1.66e-35)
(* (- b (sqrt (* c (* a -3.0)))) (/ -0.3333333333333333 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.9e-127) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 1.66e-35) {
tmp = (b - sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-2.9d-127)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 1.66d-35) then
tmp = (b - sqrt((c * (a * (-3.0d0))))) * ((-0.3333333333333333d0) / a)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.9e-127) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 1.66e-35) {
tmp = (b - Math.sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.9e-127: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 1.66e-35: tmp = (b - math.sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.9e-127) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 1.66e-35) tmp = Float64(Float64(b - sqrt(Float64(c * Float64(a * -3.0)))) * Float64(-0.3333333333333333 / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.9e-127) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 1.66e-35) tmp = (b - sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.9e-127], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.66e-35], N[(N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.9 \cdot 10^{-127}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.66 \cdot 10^{-35}:\\
\;\;\;\;\left(b - \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{-0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.9e-127Initial program 74.3%
Taylor expanded in b around -inf 87.4%
if -2.9e-127 < b < 1.65999999999999999e-35Initial program 83.5%
Taylor expanded in b around 0 82.7%
associate-*r*83.1%
*-commutative83.1%
*-commutative83.1%
Simplified83.1%
frac-2neg83.1%
div-inv83.2%
distribute-neg-in83.2%
add-sqr-sqrt41.8%
sqrt-unprod82.9%
sqr-neg82.9%
sqrt-unprod41.3%
add-sqr-sqrt82.9%
sub-neg82.9%
add-sqr-sqrt41.6%
sqrt-unprod82.9%
sqr-neg82.9%
sqrt-unprod41.3%
add-sqr-sqrt83.2%
distribute-lft-neg-in83.2%
metadata-eval83.2%
associate-/l/83.0%
div-inv82.8%
metadata-eval82.8%
Applied egg-rr82.8%
*-commutative82.8%
associate-*l/82.9%
metadata-eval82.9%
Simplified82.9%
if 1.65999999999999999e-35 < b Initial program 15.7%
Taylor expanded in b around inf 90.0%
associate-*r/90.0%
Simplified90.0%
Final simplification87.1%
(FPCore (a b c)
:precision binary64
(if (<= b -2.9e-127)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 5.2e-35)
(/ (- (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.9e-127) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 5.2e-35) {
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.9d-127)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 5.2d-35) 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.9e-127) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 5.2e-35) {
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.9e-127: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 5.2e-35: 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.9e-127) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 5.2e-35) 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 <= -2.9e-127) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 5.2e-35) 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.9e-127], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.2e-35], 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 -2.9 \cdot 10^{-127}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 5.2 \cdot 10^{-35}:\\
\;\;\;\;\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 < -2.9e-127Initial program 74.3%
Taylor expanded in b around -inf 87.4%
if -2.9e-127 < b < 5.20000000000000009e-35Initial program 83.5%
Taylor expanded in b around 0 82.7%
associate-*r*83.1%
*-commutative83.1%
*-commutative83.1%
Simplified83.1%
+-commutative83.1%
unsub-neg83.1%
Applied egg-rr83.1%
if 5.20000000000000009e-35 < b Initial program 15.7%
Taylor expanded in b around inf 90.0%
associate-*r/90.0%
Simplified90.0%
Final simplification87.2%
(FPCore (a b c)
:precision binary64
(if (<= b -3.8e-129)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 1e-42)
(/ (/ (- (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 <= -3.8e-129) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 1e-42) {
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 <= (-3.8d-129)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 1d-42) 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 <= -3.8e-129) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 1e-42) {
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 <= -3.8e-129: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 1e-42: 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 <= -3.8e-129) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 1e-42) tmp = Float64(Float64(Float64(sqrt(Float64(a * Float64(c * -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 <= -3.8e-129) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 1e-42) 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, -3.8e-129], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1e-42], N[(N[(N[(N[Sqrt[N[(a * N[(c * -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 -3.8 \cdot 10^{-129}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 10^{-42}:\\
\;\;\;\;\frac{\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}}{3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3.79999999999999985e-129Initial program 74.3%
Taylor expanded in b around -inf 87.4%
if -3.79999999999999985e-129 < b < 1.00000000000000004e-42Initial program 83.5%
Taylor expanded in b around 0 82.7%
associate-*r*83.1%
*-commutative83.1%
*-commutative83.1%
Simplified83.1%
+-commutative83.1%
unsub-neg83.1%
Applied egg-rr83.1%
add-cube-cbrt81.8%
*-commutative81.8%
times-frac81.7%
pow281.7%
Applied egg-rr81.7%
associate-*r/81.8%
associate-*l/81.8%
unpow281.8%
rem-3cbrt-lft83.1%
associate-*r*83.0%
*-commutative83.0%
associate-*l*83.1%
Simplified83.1%
if 1.00000000000000004e-42 < b Initial program 15.7%
Taylor expanded in b around inf 90.0%
associate-*r/90.0%
Simplified90.0%
Final simplification87.2%
(FPCore (a b c)
:precision binary64
(if (<= b -2.9e-127)
(/ (fma b -2.0 (/ (* 1.5 a) (/ b c))) (* a 3.0))
(if (<= b 4.4e-42)
(/ (/ (- (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 <= -2.9e-127) {
tmp = fma(b, -2.0, ((1.5 * a) / (b / c))) / (a * 3.0);
} else if (b <= 4.4e-42) {
tmp = ((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 <= -2.9e-127) tmp = Float64(fma(b, -2.0, Float64(Float64(1.5 * a) / Float64(b / c))) / Float64(a * 3.0)); elseif (b <= 4.4e-42) tmp = Float64(Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / a) / 3.0); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.9e-127], N[(N[(b * -2.0 + N[(N[(1.5 * a), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.4e-42], N[(N[(N[(N[Sqrt[N[(a * N[(c * -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.9 \cdot 10^{-127}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{1.5 \cdot a}{\frac{b}{c}}\right)}{a \cdot 3}\\
\mathbf{elif}\;b \leq 4.4 \cdot 10^{-42}:\\
\;\;\;\;\frac{\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}}{3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.9e-127Initial program 74.3%
Taylor expanded in b around -inf 82.3%
*-commutative82.3%
fma-def82.3%
associate-/l*87.4%
associate-*r/87.4%
Simplified87.4%
if -2.9e-127 < b < 4.4000000000000001e-42Initial program 83.5%
Taylor expanded in b around 0 82.7%
associate-*r*83.1%
*-commutative83.1%
*-commutative83.1%
Simplified83.1%
+-commutative83.1%
unsub-neg83.1%
Applied egg-rr83.1%
add-cube-cbrt81.8%
*-commutative81.8%
times-frac81.7%
pow281.7%
Applied egg-rr81.7%
associate-*r/81.8%
associate-*l/81.8%
unpow281.8%
rem-3cbrt-lft83.1%
associate-*r*83.0%
*-commutative83.0%
associate-*l*83.1%
Simplified83.1%
if 4.4000000000000001e-42 < b Initial program 15.7%
Taylor expanded in b around inf 90.0%
associate-*r/90.0%
Simplified90.0%
Final simplification87.2%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (fma -0.6666666666666666 (/ b a) (/ (* c 0.5) b)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = fma(-0.6666666666666666, (b / a), ((c * 0.5) / b));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(Float64(c * 0.5) / b)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(N[(c * 0.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, \frac{c \cdot 0.5}{b}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 78.4%
Taylor expanded in b around -inf 68.2%
fma-def68.2%
associate-*r/68.2%
Simplified68.2%
if -9.999999999999969e-311 < b Initial program 33.5%
Taylor expanded in b around inf 69.0%
associate-*r/69.0%
Simplified69.0%
Final simplification68.6%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = (-0.6666666666666666 * (b / 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 <= (-1d-310)) then
tmp = ((-0.6666666666666666d0) * (b / 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 <= -1e-310) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-310) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / 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 <= -1e-310) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $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 -1 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 78.4%
Taylor expanded in b around -inf 68.2%
if -9.999999999999969e-311 < b Initial program 33.5%
Taylor expanded in b around inf 69.0%
associate-*r/69.0%
Simplified69.0%
Final simplification68.6%
(FPCore (a b c) :precision binary64 (if (<= b 5.1e-245) (/ (* b -2.0) (* a 3.0)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
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 <= 5.1d-245) 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 <= 5.1e-245) {
tmp = (b * -2.0) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.1e-245: 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 <= 5.1e-245) 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 <= 5.1e-245) 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, 5.1e-245], 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.1 \cdot 10^{-245}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 5.1000000000000003e-245Initial program 78.9%
Taylor expanded in b around -inf 66.3%
*-commutative66.3%
Simplified66.3%
if 5.1000000000000003e-245 < b Initial program 31.9%
Taylor expanded in b around inf 70.6%
associate-*r/70.6%
Simplified70.6%
Final simplification68.4%
(FPCore (a b c) :precision binary64 (if (<= b 5.1e-245) (/ (/ (* b -2.0) a) 3.0) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
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 <= 5.1d-245) 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 <= 5.1e-245) {
tmp = ((b * -2.0) / a) / 3.0;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.1e-245: 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 <= 5.1e-245) tmp = Float64(Float64(Float64(b * -2.0) / a) / 3.0); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 5.1e-245) 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, 5.1e-245], N[(N[(N[(b * -2.0), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.1 \cdot 10^{-245}:\\
\;\;\;\;\frac{\frac{b \cdot -2}{a}}{3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 5.1000000000000003e-245Initial program 78.9%
Applied egg-rr66.6%
associate-/r*66.5%
Simplified66.5%
associate-*r/66.5%
frac-2neg66.5%
un-div-inv66.5%
metadata-eval66.5%
Applied egg-rr66.5%
distribute-neg-frac66.5%
sub-neg66.5%
+-commutative66.5%
distribute-neg-in66.5%
remove-double-neg66.5%
sub-neg66.5%
associate-*r*66.4%
*-commutative66.4%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt66.5%
Simplified66.5%
Taylor expanded in b around -inf 66.3%
*-commutative66.3%
Simplified66.3%
if 5.1000000000000003e-245 < b Initial program 31.9%
Taylor expanded in b around inf 70.6%
associate-*r/70.6%
Simplified70.6%
Final simplification68.4%
(FPCore (a b c) :precision binary64 (if (<= b 5.1e-245) (* b (/ -0.6666666666666666 a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
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 <= 5.1d-245) 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 <= 5.1e-245) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.1e-245: tmp = b * (-0.6666666666666666 / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5.1e-245) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 5.1e-245) tmp = b * (-0.6666666666666666 / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5.1e-245], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.1 \cdot 10^{-245}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 5.1000000000000003e-245Initial program 78.9%
Taylor expanded in b around -inf 66.3%
*-commutative66.3%
Simplified66.3%
*-commutative66.3%
clear-num66.2%
un-div-inv66.3%
Applied egg-rr66.3%
associate-/r/66.3%
Simplified66.3%
if 5.1000000000000003e-245 < b Initial program 31.9%
Taylor expanded in b around inf 20.0%
Taylor expanded in b around 0 70.6%
associate-*r/70.6%
*-rgt-identity70.6%
times-frac70.4%
/-rgt-identity70.4%
Simplified70.4%
Final simplification68.3%
(FPCore (a b c) :precision binary64 (if (<= b 5.1e-245) (* -0.6666666666666666 (/ b a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
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 <= 5.1d-245) 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 <= 5.1e-245) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.1e-245: tmp = -0.6666666666666666 * (b / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5.1e-245) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 5.1e-245) tmp = -0.6666666666666666 * (b / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5.1e-245], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.1 \cdot 10^{-245}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 5.1000000000000003e-245Initial program 78.9%
Taylor expanded in b around -inf 66.3%
*-commutative66.3%
Simplified66.3%
if 5.1000000000000003e-245 < b Initial program 31.9%
Taylor expanded in b around inf 20.0%
Taylor expanded in b around 0 70.6%
associate-*r/70.6%
*-rgt-identity70.6%
times-frac70.4%
/-rgt-identity70.4%
Simplified70.4%
Final simplification68.3%
(FPCore (a b c) :precision binary64 (if (<= b 5.1e-245) (/ -0.6666666666666666 (/ a b)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 5.1d-245) then
tmp = (-0.6666666666666666d0) / (a / b)
else
tmp = c * ((-0.5d0) / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.1e-245: tmp = -0.6666666666666666 / (a / b) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5.1e-245) tmp = Float64(-0.6666666666666666 / Float64(a / b)); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 5.1e-245) tmp = -0.6666666666666666 / (a / b); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5.1e-245], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.1 \cdot 10^{-245}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 5.1000000000000003e-245Initial program 78.9%
Taylor expanded in b around -inf 66.3%
*-commutative66.3%
Simplified66.3%
*-commutative66.3%
clear-num66.2%
un-div-inv66.3%
Applied egg-rr66.3%
if 5.1000000000000003e-245 < b Initial program 31.9%
Taylor expanded in b around inf 20.0%
Taylor expanded in b around 0 70.6%
associate-*r/70.6%
*-rgt-identity70.6%
times-frac70.4%
/-rgt-identity70.4%
Simplified70.4%
Final simplification68.3%
(FPCore (a b c) :precision binary64 (if (<= b 5.1e-245) (/ -0.6666666666666666 (/ a b)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 5.1d-245) then
tmp = (-0.6666666666666666d0) / (a / b)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 5.1e-245) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 5.1e-245: tmp = -0.6666666666666666 / (a / b) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 5.1e-245) tmp = Float64(-0.6666666666666666 / Float64(a / b)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 5.1e-245) tmp = -0.6666666666666666 / (a / b); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 5.1e-245], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.1 \cdot 10^{-245}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 5.1000000000000003e-245Initial program 78.9%
Taylor expanded in b around -inf 66.3%
*-commutative66.3%
Simplified66.3%
*-commutative66.3%
clear-num66.2%
un-div-inv66.3%
Applied egg-rr66.3%
if 5.1000000000000003e-245 < b Initial program 31.9%
Taylor expanded in b around inf 70.6%
associate-*r/70.6%
Simplified70.6%
Final simplification68.4%
(FPCore (a b c) :precision binary64 (* b (/ -0.6666666666666666 a)))
double code(double a, double b, double c) {
return b * (-0.6666666666666666 / a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = b * ((-0.6666666666666666d0) / a)
end function
public static double code(double a, double b, double c) {
return b * (-0.6666666666666666 / a);
}
def code(a, b, c): return b * (-0.6666666666666666 / a)
function code(a, b, c) return Float64(b * Float64(-0.6666666666666666 / a)) end
function tmp = code(a, b, c) tmp = b * (-0.6666666666666666 / a); end
code[a_, b_, c_] := N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
b \cdot \frac{-0.6666666666666666}{a}
\end{array}
Initial program 56.1%
Taylor expanded in b around -inf 35.4%
*-commutative35.4%
Simplified35.4%
*-commutative35.4%
clear-num35.4%
un-div-inv35.5%
Applied egg-rr35.5%
associate-/r/35.4%
Simplified35.4%
Final simplification35.4%
herbie shell --seed 2024041
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))