
(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 13 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 -3.25e+121)
(* (/ b a) -0.6666666666666666)
(if (<= b 6.5e-80)
(/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.25e+121) {
tmp = (b / a) * -0.6666666666666666;
} else if (b <= 6.5e-80) {
tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-3.25d+121)) then
tmp = (b / a) * (-0.6666666666666666d0)
else if (b <= 6.5d-80) then
tmp = (sqrt(((b * b) - ((a * 3.0d0) * c))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -3.25e+121) {
tmp = (b / a) * -0.6666666666666666;
} else if (b <= 6.5e-80) {
tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.25e+121: tmp = (b / a) * -0.6666666666666666 elif b <= 6.5e-80: tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.25e+121) tmp = Float64(Float64(b / a) * -0.6666666666666666); elseif (b <= 6.5e-80) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.25e+121) tmp = (b / a) * -0.6666666666666666; elseif (b <= 6.5e-80) tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.25e+121], N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision], If[LessEqual[b, 6.5e-80], 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[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.25 \cdot 10^{+121}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{elif}\;b \leq 6.5 \cdot 10^{-80}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3.25000000000000009e121Initial program 47.1%
sqr-neg47.1%
sqr-neg47.1%
associate-*l*47.1%
Simplified47.1%
Taylor expanded in b around -inf 95.9%
*-commutative95.9%
Simplified95.9%
if -3.25000000000000009e121 < b < 6.49999999999999984e-80Initial program 80.3%
if 6.49999999999999984e-80 < b Initial program 14.5%
sqr-neg14.5%
sqr-neg14.5%
associate-*l*14.5%
Simplified14.5%
frac-2neg14.5%
div-inv14.5%
Applied egg-rr14.5%
Taylor expanded in b around inf 87.7%
associate-*r/87.7%
*-commutative87.7%
Simplified87.7%
Final simplification86.1%
(FPCore (a b c)
:precision binary64
(if (<= b -3.6e+120)
(* (/ b a) -0.6666666666666666)
(if (<= b 9.2e-79)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.6e+120) {
tmp = (b / a) * -0.6666666666666666;
} else if (b <= 9.2e-79) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-3.6d+120)) then
tmp = (b / a) * (-0.6666666666666666d0)
else if (b <= 9.2d-79) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -3.6e+120) {
tmp = (b / a) * -0.6666666666666666;
} else if (b <= 9.2e-79) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.6e+120: tmp = (b / a) * -0.6666666666666666 elif b <= 9.2e-79: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.6e+120) tmp = Float64(Float64(b / a) * -0.6666666666666666); elseif (b <= 9.2e-79) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.6e+120) tmp = (b / a) * -0.6666666666666666; elseif (b <= 9.2e-79) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.6e+120], N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision], If[LessEqual[b, 9.2e-79], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.6 \cdot 10^{+120}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{elif}\;b \leq 9.2 \cdot 10^{-79}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3.60000000000000016e120Initial program 47.1%
sqr-neg47.1%
sqr-neg47.1%
associate-*l*47.1%
Simplified47.1%
Taylor expanded in b around -inf 95.9%
*-commutative95.9%
Simplified95.9%
if -3.60000000000000016e120 < b < 9.20000000000000047e-79Initial program 80.3%
sqr-neg80.3%
sqr-neg80.3%
associate-*l*80.0%
Simplified80.0%
if 9.20000000000000047e-79 < b Initial program 14.5%
sqr-neg14.5%
sqr-neg14.5%
associate-*l*14.5%
Simplified14.5%
frac-2neg14.5%
div-inv14.5%
Applied egg-rr14.5%
Taylor expanded in b around inf 87.7%
associate-*r/87.7%
*-commutative87.7%
Simplified87.7%
Final simplification85.9%
(FPCore (a b c)
:precision binary64
(if (<= b -7.2e-104)
(- (* (/ b a) (- 0.6666666666666666)) (* -0.5 (/ c b)))
(if (<= b 2.3e-80)
(/ (- (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 <= -7.2e-104) {
tmp = ((b / a) * -0.6666666666666666) - (-0.5 * (c / b));
} else if (b <= 2.3e-80) {
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 <= (-7.2d-104)) then
tmp = ((b / a) * -0.6666666666666666d0) - ((-0.5d0) * (c / b))
else if (b <= 2.3d-80) 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 <= -7.2e-104) {
tmp = ((b / a) * -0.6666666666666666) - (-0.5 * (c / b));
} else if (b <= 2.3e-80) {
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 <= -7.2e-104: tmp = ((b / a) * -0.6666666666666666) - (-0.5 * (c / b)) elif b <= 2.3e-80: 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 <= -7.2e-104) tmp = Float64(Float64(Float64(b / a) * Float64(-0.6666666666666666)) - Float64(-0.5 * Float64(c / b))); elseif (b <= 2.3e-80) 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 <= -7.2e-104) tmp = ((b / a) * -0.6666666666666666) - (-0.5 * (c / b)); elseif (b <= 2.3e-80) 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, -7.2e-104], N[(N[(N[(b / a), $MachinePrecision] * (-0.6666666666666666)), $MachinePrecision] - N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.3e-80], 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 -7.2 \cdot 10^{-104}:\\
\;\;\;\;\frac{b}{a} \cdot \left(-0.6666666666666666\right) - -0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{-80}:\\
\;\;\;\;\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 < -7.1999999999999996e-104Initial program 69.8%
sqr-neg69.8%
sqr-neg69.8%
associate-*l*69.8%
Simplified69.8%
Taylor expanded in b around -inf 86.4%
Taylor expanded in c around 0 86.5%
if -7.1999999999999996e-104 < b < 2.2999999999999998e-80Initial program 71.1%
sqr-neg71.1%
sqr-neg71.1%
associate-*l*70.5%
Simplified70.5%
Taylor expanded in b around 0 69.9%
*-commutative69.9%
*-commutative69.9%
associate-*r*70.4%
Simplified70.4%
if 2.2999999999999998e-80 < b Initial program 14.5%
sqr-neg14.5%
sqr-neg14.5%
associate-*l*14.5%
Simplified14.5%
frac-2neg14.5%
div-inv14.5%
Applied egg-rr14.5%
Taylor expanded in b around inf 87.7%
associate-*r/87.7%
*-commutative87.7%
Simplified87.7%
Final simplification83.2%
(FPCore (a b c)
:precision binary64
(if (<= b -2e-103)
(- (* (/ b a) (- 0.6666666666666666)) (* -0.5 (/ c b)))
(if (<= b 1.55e-78)
(* 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 <= -2e-103) {
tmp = ((b / a) * -0.6666666666666666) - (-0.5 * (c / b));
} else if (b <= 1.55e-78) {
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 <= (-2d-103)) then
tmp = ((b / a) * -0.6666666666666666d0) - ((-0.5d0) * (c / b))
else if (b <= 1.55d-78) 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 <= -2e-103) {
tmp = ((b / a) * -0.6666666666666666) - (-0.5 * (c / b));
} else if (b <= 1.55e-78) {
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 <= -2e-103: tmp = ((b / a) * -0.6666666666666666) - (-0.5 * (c / b)) elif b <= 1.55e-78: 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 <= -2e-103) tmp = Float64(Float64(Float64(b / a) * Float64(-0.6666666666666666)) - Float64(-0.5 * Float64(c / b))); elseif (b <= 1.55e-78) 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 <= -2e-103) tmp = ((b / a) * -0.6666666666666666) - (-0.5 * (c / b)); elseif (b <= 1.55e-78) 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, -2e-103], N[(N[(N[(b / a), $MachinePrecision] * (-0.6666666666666666)), $MachinePrecision] - N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.55e-78], 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 -2 \cdot 10^{-103}:\\
\;\;\;\;\frac{b}{a} \cdot \left(-0.6666666666666666\right) - -0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.55 \cdot 10^{-78}:\\
\;\;\;\;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.99999999999999992e-103Initial program 69.8%
sqr-neg69.8%
sqr-neg69.8%
associate-*l*69.8%
Simplified69.8%
Taylor expanded in b around -inf 86.4%
Taylor expanded in c around 0 86.5%
if -1.99999999999999992e-103 < b < 1.55000000000000009e-78Initial program 71.1%
sqr-neg71.1%
sqr-neg71.1%
associate-*l*70.5%
Simplified70.5%
*-un-lft-identity70.5%
times-frac70.5%
metadata-eval70.5%
add-sqr-sqrt22.2%
sqrt-unprod69.7%
sqr-neg69.7%
sqrt-prod48.3%
add-sqr-sqrt70.0%
fma-neg70.0%
associate-*r*70.3%
*-commutative70.3%
distribute-rgt-neg-in70.3%
*-commutative70.3%
distribute-rgt-neg-in70.3%
metadata-eval70.3%
Applied egg-rr70.3%
Taylor expanded in b around 0 70.0%
*-commutative70.0%
*-commutative70.0%
associate-*r*70.3%
Simplified70.3%
if 1.55000000000000009e-78 < b Initial program 14.5%
sqr-neg14.5%
sqr-neg14.5%
associate-*l*14.5%
Simplified14.5%
frac-2neg14.5%
div-inv14.5%
Applied egg-rr14.5%
Taylor expanded in b around inf 87.7%
associate-*r/87.7%
*-commutative87.7%
Simplified87.7%
Final simplification83.2%
(FPCore (a b c)
:precision binary64
(if (<= b -2.8e-107)
(- (* (/ b a) (- 0.6666666666666666)) (* -0.5 (/ c b)))
(if (<= b 3.1e-81)
(* 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.8e-107) {
tmp = ((b / a) * -0.6666666666666666) - (-0.5 * (c / b));
} else if (b <= 3.1e-81) {
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.8d-107)) then
tmp = ((b / a) * -0.6666666666666666d0) - ((-0.5d0) * (c / b))
else if (b <= 3.1d-81) 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.8e-107) {
tmp = ((b / a) * -0.6666666666666666) - (-0.5 * (c / b));
} else if (b <= 3.1e-81) {
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.8e-107: tmp = ((b / a) * -0.6666666666666666) - (-0.5 * (c / b)) elif b <= 3.1e-81: 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.8e-107) tmp = Float64(Float64(Float64(b / a) * Float64(-0.6666666666666666)) - Float64(-0.5 * Float64(c / b))); elseif (b <= 3.1e-81) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(Float64(a * 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.8e-107) tmp = ((b / a) * -0.6666666666666666) - (-0.5 * (c / b)); elseif (b <= 3.1e-81) 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.8e-107], N[(N[(N[(b / a), $MachinePrecision] * (-0.6666666666666666)), $MachinePrecision] - N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.1e-81], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.8 \cdot 10^{-107}:\\
\;\;\;\;\frac{b}{a} \cdot \left(-0.6666666666666666\right) - -0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 3.1 \cdot 10^{-81}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{\left(a \cdot c\right) \cdot -3}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.7999999999999999e-107Initial program 69.8%
sqr-neg69.8%
sqr-neg69.8%
associate-*l*69.8%
Simplified69.8%
Taylor expanded in b around -inf 86.4%
Taylor expanded in c around 0 86.5%
if -2.7999999999999999e-107 < b < 3.09999999999999988e-81Initial program 71.1%
sqr-neg71.1%
sqr-neg71.1%
associate-*l*70.5%
Simplified70.5%
*-un-lft-identity70.5%
times-frac70.5%
metadata-eval70.5%
add-sqr-sqrt22.2%
sqrt-unprod69.7%
sqr-neg69.7%
sqrt-prod48.3%
add-sqr-sqrt70.0%
fma-neg70.0%
associate-*r*70.3%
*-commutative70.3%
distribute-rgt-neg-in70.3%
*-commutative70.3%
distribute-rgt-neg-in70.3%
metadata-eval70.3%
Applied egg-rr70.3%
Taylor expanded in b around 0 70.0%
if 3.09999999999999988e-81 < b Initial program 14.5%
sqr-neg14.5%
sqr-neg14.5%
associate-*l*14.5%
Simplified14.5%
frac-2neg14.5%
div-inv14.5%
Applied egg-rr14.5%
Taylor expanded in b around inf 87.7%
associate-*r/87.7%
*-commutative87.7%
Simplified87.7%
Final simplification83.1%
(FPCore (a b c) :precision binary64 (if (<= b -1e-310) (- (* (/ b a) (- 0.6666666666666666)) (* -0.5 (/ c b))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-310) {
tmp = ((b / a) * -0.6666666666666666) - (-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 = ((b / a) * -0.6666666666666666d0) - ((-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 = ((b / a) * -0.6666666666666666) - (-0.5 * (c / b));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-310: tmp = ((b / a) * -0.6666666666666666) - (-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(Float64(b / a) * Float64(-0.6666666666666666)) - 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 = ((b / a) * -0.6666666666666666) - (-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[(N[(b / a), $MachinePrecision] * (-0.6666666666666666)), $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}:\\
\;\;\;\;\frac{b}{a} \cdot \left(-0.6666666666666666\right) - -0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -9.999999999999969e-311Initial program 70.5%
sqr-neg70.5%
sqr-neg70.5%
associate-*l*70.5%
Simplified70.5%
Taylor expanded in b around -inf 73.5%
Taylor expanded in c around 0 74.4%
if -9.999999999999969e-311 < b Initial program 30.9%
sqr-neg30.9%
sqr-neg30.9%
associate-*l*30.7%
Simplified30.7%
frac-2neg30.7%
div-inv30.6%
Applied egg-rr30.8%
Taylor expanded in b around inf 66.6%
associate-*r/66.6%
*-commutative66.6%
Simplified66.6%
Final simplification70.1%
(FPCore (a b c) :precision binary64 (if (<= b 1.8e-306) (/ (* b -0.6666666666666666) a) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.8e-306) {
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 <= 1.8d-306) 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 <= 1.8e-306) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.8e-306: tmp = (b * -0.6666666666666666) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.8e-306) 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 <= 1.8e-306) tmp = (b * -0.6666666666666666) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.8e-306], 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 1.8 \cdot 10^{-306}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.79999999999999996e-306Initial program 70.7%
sqr-neg70.7%
sqr-neg70.7%
associate-*l*70.7%
Simplified70.7%
Taylor expanded in b around -inf 73.5%
*-commutative73.5%
Simplified73.5%
associate-*l/73.6%
Applied egg-rr73.6%
if 1.79999999999999996e-306 < b Initial program 30.4%
sqr-neg30.4%
sqr-neg30.4%
associate-*l*30.2%
Simplified30.2%
frac-2neg30.2%
div-inv30.1%
Applied egg-rr30.3%
Taylor expanded in b around inf 67.1%
associate-*r/67.1%
*-commutative67.1%
Simplified67.1%
(FPCore (a b c) :precision binary64 (if (<= b 2.55e-306) (/ (* b -0.6666666666666666) a) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.55e-306) {
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 <= 2.55d-306) 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 <= 2.55e-306) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.55e-306: tmp = (b * -0.6666666666666666) / a else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.55e-306) tmp = Float64(Float64(b * -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 <= 2.55e-306) tmp = (b * -0.6666666666666666) / a; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.55e-306], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.55 \cdot 10^{-306}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 2.54999999999999986e-306Initial program 70.7%
sqr-neg70.7%
sqr-neg70.7%
associate-*l*70.7%
Simplified70.7%
Taylor expanded in b around -inf 73.5%
*-commutative73.5%
Simplified73.5%
associate-*l/73.6%
Applied egg-rr73.6%
if 2.54999999999999986e-306 < b Initial program 30.4%
sqr-neg30.4%
sqr-neg30.4%
associate-*l*30.2%
Simplified30.2%
Taylor expanded in b around inf 67.1%
*-commutative67.1%
Simplified67.1%
Final simplification70.0%
(FPCore (a b c) :precision binary64 (if (<= b 1.8e-306) (* (/ b a) -0.6666666666666666) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.8e-306) {
tmp = (b / a) * -0.6666666666666666;
} 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 <= 1.8d-306) then
tmp = (b / a) * (-0.6666666666666666d0)
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 <= 1.8e-306) {
tmp = (b / a) * -0.6666666666666666;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.8e-306: tmp = (b / a) * -0.6666666666666666 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.8e-306) tmp = Float64(Float64(b / a) * -0.6666666666666666); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.8e-306) tmp = (b / a) * -0.6666666666666666; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.8e-306], N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.8 \cdot 10^{-306}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 1.79999999999999996e-306Initial program 70.7%
sqr-neg70.7%
sqr-neg70.7%
associate-*l*70.7%
Simplified70.7%
Taylor expanded in b around -inf 73.5%
*-commutative73.5%
Simplified73.5%
if 1.79999999999999996e-306 < b Initial program 30.4%
sqr-neg30.4%
sqr-neg30.4%
associate-*l*30.2%
Simplified30.2%
Taylor expanded in b around inf 67.1%
*-commutative67.1%
Simplified67.1%
Final simplification70.0%
(FPCore (a b c) :precision binary64 (if (<= b 1.8e-306) (* (/ b a) -0.6666666666666666) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.8e-306) {
tmp = (b / a) * -0.6666666666666666;
} 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.8d-306) then
tmp = (b / a) * (-0.6666666666666666d0)
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.8e-306) {
tmp = (b / a) * -0.6666666666666666;
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.8e-306: tmp = (b / a) * -0.6666666666666666 else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.8e-306) tmp = Float64(Float64(b / a) * -0.6666666666666666); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.8e-306) tmp = (b / a) * -0.6666666666666666; else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.8e-306], N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.8 \cdot 10^{-306}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 1.79999999999999996e-306Initial program 70.7%
sqr-neg70.7%
sqr-neg70.7%
associate-*l*70.7%
Simplified70.7%
Taylor expanded in b around -inf 73.5%
*-commutative73.5%
Simplified73.5%
if 1.79999999999999996e-306 < b Initial program 30.4%
sqr-neg30.4%
sqr-neg30.4%
associate-*l*30.2%
Simplified30.2%
Taylor expanded in b around inf 49.6%
associate-*r/49.5%
*-commutative49.5%
associate-*l*49.6%
Simplified49.6%
Taylor expanded in a around 0 49.5%
Taylor expanded in a around 0 67.1%
associate-*r/67.1%
*-commutative67.1%
metadata-eval67.1%
rem-square-sqrt0.0%
unpow20.0%
associate-*r/0.0%
unpow20.0%
rem-square-sqrt66.9%
metadata-eval66.9%
Simplified66.9%
(FPCore (a b c) :precision binary64 (if (<= b 1.8e-306) (* b (/ -0.6666666666666666 a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.8e-306) {
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 <= 1.8d-306) 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 <= 1.8e-306) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.8e-306: tmp = b * (-0.6666666666666666 / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.8e-306) 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 <= 1.8e-306) tmp = b * (-0.6666666666666666 / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.8e-306], 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 1.8 \cdot 10^{-306}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 1.79999999999999996e-306Initial program 70.7%
sqr-neg70.7%
sqr-neg70.7%
associate-*l*70.7%
Simplified70.7%
frac-2neg70.7%
div-inv70.7%
Applied egg-rr70.8%
Taylor expanded in b around -inf 73.5%
associate-*r/73.6%
*-commutative73.6%
associate-*r/73.5%
Simplified73.5%
if 1.79999999999999996e-306 < b Initial program 30.4%
sqr-neg30.4%
sqr-neg30.4%
associate-*l*30.2%
Simplified30.2%
Taylor expanded in b around inf 49.6%
associate-*r/49.5%
*-commutative49.5%
associate-*l*49.6%
Simplified49.6%
Taylor expanded in a around 0 49.5%
Taylor expanded in a around 0 67.1%
associate-*r/67.1%
*-commutative67.1%
metadata-eval67.1%
rem-square-sqrt0.0%
unpow20.0%
associate-*r/0.0%
unpow20.0%
rem-square-sqrt66.9%
metadata-eval66.9%
Simplified66.9%
(FPCore (a b c) :precision binary64 (if (<= b 3.3e-46) (* b (/ -0.6666666666666666 a)) (* (/ c b) 0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.3e-46) {
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 <= 3.3d-46) 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 <= 3.3e-46) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * 0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3.3e-46: tmp = b * (-0.6666666666666666 / a) else: tmp = (c / b) * 0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3.3e-46) 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 <= 3.3e-46) tmp = b * (-0.6666666666666666 / a); else tmp = (c / b) * 0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3.3e-46], 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 3.3 \cdot 10^{-46}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot 0.5\\
\end{array}
\end{array}
if b < 3.30000000000000013e-46Initial program 68.8%
sqr-neg68.8%
sqr-neg68.8%
associate-*l*68.6%
Simplified68.6%
frac-2neg68.6%
div-inv68.6%
Applied egg-rr68.8%
Taylor expanded in b around -inf 53.4%
associate-*r/53.4%
*-commutative53.4%
associate-*r/53.3%
Simplified53.3%
if 3.30000000000000013e-46 < b Initial program 14.1%
sqr-neg14.1%
sqr-neg14.1%
associate-*l*14.1%
Simplified14.1%
Taylor expanded in b around inf 65.6%
associate-*r/65.6%
*-commutative65.6%
associate-*l*65.6%
Simplified65.6%
div-inv65.5%
associate-/l*73.3%
associate-*l*72.5%
associate-/l*72.7%
add-sqr-sqrt34.2%
sqrt-unprod29.3%
*-commutative29.3%
*-commutative29.3%
swap-sqr29.2%
metadata-eval29.2%
metadata-eval29.2%
swap-sqr29.3%
sqrt-unprod9.2%
add-sqr-sqrt19.0%
*-commutative19.0%
associate-/r*19.0%
metadata-eval19.0%
Applied egg-rr19.0%
associate-*r*19.1%
associate-*r*19.0%
*-commutative19.0%
metadata-eval19.0%
associate-*r/19.0%
associate-*r*19.0%
*-commutative19.0%
*-commutative19.0%
associate-*r*19.0%
*-commutative19.0%
associate-*r*18.9%
*-commutative18.9%
associate-*l/18.9%
*-lft-identity18.9%
Simplified18.9%
Taylor expanded in c around 0 18.9%
Final simplification40.6%
(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.5%
sqr-neg48.5%
sqr-neg48.5%
associate-*l*48.4%
Simplified48.4%
Taylor expanded in b around inf 28.4%
associate-*r/28.3%
*-commutative28.3%
associate-*l*28.4%
Simplified28.4%
div-inv28.3%
associate-/l*31.8%
associate-*l*31.5%
associate-/l*31.5%
add-sqr-sqrt14.3%
sqrt-unprod14.2%
*-commutative14.2%
*-commutative14.2%
swap-sqr14.1%
metadata-eval14.1%
metadata-eval14.1%
swap-sqr14.2%
sqrt-unprod4.3%
add-sqr-sqrt9.3%
*-commutative9.3%
associate-/r*9.3%
metadata-eval9.3%
Applied egg-rr9.3%
associate-*r*9.0%
associate-*r*8.9%
*-commutative8.9%
metadata-eval8.9%
associate-*r/8.9%
associate-*r*8.9%
*-commutative8.9%
*-commutative8.9%
associate-*r*8.9%
*-commutative8.9%
associate-*r*8.6%
*-commutative8.6%
associate-*l/8.6%
*-lft-identity8.6%
Simplified8.6%
Taylor expanded in c around 0 8.9%
Final simplification8.9%
herbie shell --seed 2024110
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))