
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(if (<= b -1.65e+87)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 4e-127)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
(if (<= b 9.5e-59)
(* (/ c b) -0.5)
(if (<= b 6e-14)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(if (<= b 2e+59)
(*
c
(+
(*
c
(+
(* -0.5625 (/ (* c (pow a 2.0)) (pow b 5.0)))
(* -0.375 (/ a (pow b 3.0)))))
(* 0.5 (/ -1.0 b))))
(* 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+87) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 4e-127) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else if (b <= 9.5e-59) {
tmp = (c / b) * -0.5;
} else if (b <= 6e-14) {
tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else if (b <= 2e+59) {
tmp = c * ((c * ((-0.5625 * ((c * pow(a, 2.0)) / pow(b, 5.0))) + (-0.375 * (a / pow(b, 3.0))))) + (0.5 * (-1.0 / b)));
} 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+87)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 4d-127) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (a * 3.0d0)
else if (b <= 9.5d-59) then
tmp = (c / b) * (-0.5d0)
else if (b <= 6d-14) then
tmp = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
else if (b <= 2d+59) then
tmp = c * ((c * (((-0.5625d0) * ((c * (a ** 2.0d0)) / (b ** 5.0d0))) + ((-0.375d0) * (a / (b ** 3.0d0))))) + (0.5d0 * ((-1.0d0) / b)))
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+87) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 4e-127) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else if (b <= 9.5e-59) {
tmp = (c / b) * -0.5;
} else if (b <= 6e-14) {
tmp = (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else if (b <= 2e+59) {
tmp = c * ((c * ((-0.5625 * ((c * Math.pow(a, 2.0)) / Math.pow(b, 5.0))) + (-0.375 * (a / Math.pow(b, 3.0))))) + (0.5 * (-1.0 / b)));
} 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+87: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 4e-127: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0) elif b <= 9.5e-59: tmp = (c / b) * -0.5 elif b <= 6e-14: tmp = (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0) elif b <= 2e+59: tmp = c * ((c * ((-0.5625 * ((c * math.pow(a, 2.0)) / math.pow(b, 5.0))) + (-0.375 * (a / math.pow(b, 3.0))))) + (0.5 * (-1.0 / b))) 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+87) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 4e-127) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0)); elseif (b <= 9.5e-59) tmp = Float64(Float64(c / b) * -0.5); elseif (b <= 6e-14) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)); elseif (b <= 2e+59) tmp = Float64(c * Float64(Float64(c * Float64(Float64(-0.5625 * Float64(Float64(c * (a ^ 2.0)) / (b ^ 5.0))) + Float64(-0.375 * Float64(a / (b ^ 3.0))))) + Float64(0.5 * Float64(-1.0 / b)))); 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+87) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 4e-127) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0); elseif (b <= 9.5e-59) tmp = (c / b) * -0.5; elseif (b <= 6e-14) tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0); elseif (b <= 2e+59) tmp = c * ((c * ((-0.5625 * ((c * (a ^ 2.0)) / (b ^ 5.0))) + (-0.375 * (a / (b ^ 3.0))))) + (0.5 * (-1.0 / b))); 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+87], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4e-127], 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], If[LessEqual[b, 9.5e-59], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[b, 6e-14], 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], If[LessEqual[b, 2e+59], N[(c * N[(N[(c * N[(N[(-0.5625 * N[(N[(c * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $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^{+87}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 4 \cdot 10^{-127}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 9.5 \cdot 10^{-59}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\mathbf{elif}\;b \leq 6 \cdot 10^{-14}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 2 \cdot 10^{+59}:\\
\;\;\;\;c \cdot \left(c \cdot \left(-0.5625 \cdot \frac{c \cdot {a}^{2}}{{b}^{5}} + -0.375 \cdot \frac{a}{{b}^{3}}\right) + 0.5 \cdot \frac{-1}{b}\right)\\
\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.6500000000000001e87Initial program 49.0%
sqr-neg49.0%
sqr-neg49.0%
associate-*l*49.0%
Simplified49.0%
frac-2neg49.0%
div-inv48.8%
Applied egg-rr48.8%
un-div-inv49.0%
fma-undefine49.0%
add-sqr-sqrt33.0%
hypot-define52.6%
Applied egg-rr52.6%
*-rgt-identity52.6%
times-frac51.2%
metadata-eval51.2%
Simplified51.2%
Taylor expanded in b around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
unpow20.0%
rem-square-sqrt89.8%
associate-*r/89.8%
metadata-eval89.8%
Simplified89.8%
Taylor expanded in c around 0 91.5%
if -1.6500000000000001e87 < b < 4.0000000000000001e-127Initial program 84.3%
sqr-neg84.3%
sqr-neg84.3%
associate-*l*84.3%
Simplified84.3%
if 4.0000000000000001e-127 < b < 9.4999999999999994e-59Initial program 32.0%
sqr-neg32.0%
sqr-neg32.0%
associate-*l*31.9%
Simplified31.9%
Taylor expanded in b around inf 66.7%
*-commutative66.7%
Simplified66.7%
if 9.4999999999999994e-59 < b < 5.9999999999999997e-14Initial program 75.7%
if 5.9999999999999997e-14 < b < 1.99999999999999994e59Initial program 23.8%
sqr-neg23.8%
sqr-neg23.8%
associate-*l*23.9%
Simplified23.9%
Taylor expanded in c around 0 81.5%
if 1.99999999999999994e59 < b Initial program 12.4%
sqr-neg12.4%
sqr-neg12.4%
associate-*l*12.4%
Simplified12.4%
Taylor expanded in c around 0 87.7%
associate-/l*90.8%
associate-*r/90.8%
metadata-eval90.8%
Simplified90.8%
Final simplification86.2%
(FPCore (a b c)
:precision binary64
(if (<= b -1.7e+87)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 4e-127)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.7e+87) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 4e-127) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-1.7d+87)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 4d-127) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (a * 3.0d0)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.7e+87) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 4e-127) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.7e+87: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 4e-127: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.7e+87) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 4e-127) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.7e+87) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 4e-127) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.7e+87], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4e-127], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.7 \cdot 10^{+87}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 4 \cdot 10^{-127}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.7000000000000001e87Initial program 49.0%
sqr-neg49.0%
sqr-neg49.0%
associate-*l*49.0%
Simplified49.0%
frac-2neg49.0%
div-inv48.8%
Applied egg-rr48.8%
un-div-inv49.0%
fma-undefine49.0%
add-sqr-sqrt33.0%
hypot-define52.6%
Applied egg-rr52.6%
*-rgt-identity52.6%
times-frac51.2%
metadata-eval51.2%
Simplified51.2%
Taylor expanded in b around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
unpow20.0%
rem-square-sqrt89.8%
associate-*r/89.8%
metadata-eval89.8%
Simplified89.8%
Taylor expanded in c around 0 91.5%
if -1.7000000000000001e87 < b < 4.0000000000000001e-127Initial program 84.3%
sqr-neg84.3%
sqr-neg84.3%
associate-*l*84.3%
Simplified84.3%
if 4.0000000000000001e-127 < b Initial program 22.4%
sqr-neg22.4%
sqr-neg22.4%
associate-*l*22.4%
Simplified22.4%
Taylor expanded in b around inf 80.1%
*-commutative80.1%
Simplified80.1%
Final simplification84.5%
(FPCore (a b c)
:precision binary64
(if (<= b -0.145)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 4e-127)
(* (- b (sqrt (* c (* a -3.0)))) (/ 1.0 (* a -3.0)))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -0.145) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 4e-127) {
tmp = (b - sqrt((c * (a * -3.0)))) * (1.0 / (a * -3.0));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-0.145d0)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 4d-127) then
tmp = (b - sqrt((c * (a * (-3.0d0))))) * (1.0d0 / (a * (-3.0d0)))
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -0.145) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 4e-127) {
tmp = (b - Math.sqrt((c * (a * -3.0)))) * (1.0 / (a * -3.0));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -0.145: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 4e-127: tmp = (b - math.sqrt((c * (a * -3.0)))) * (1.0 / (a * -3.0)) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -0.145) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 4e-127) tmp = Float64(Float64(b - sqrt(Float64(c * Float64(a * -3.0)))) * Float64(1.0 / Float64(a * -3.0))); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -0.145) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 4e-127) tmp = (b - sqrt((c * (a * -3.0)))) * (1.0 / (a * -3.0)); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -0.145], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4e-127], N[(N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.145:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 4 \cdot 10^{-127}:\\
\;\;\;\;\left(b - \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{1}{a \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -0.14499999999999999Initial program 57.4%
sqr-neg57.4%
sqr-neg57.4%
associate-*l*57.4%
Simplified57.4%
frac-2neg57.4%
div-inv57.3%
Applied egg-rr57.3%
un-div-inv57.4%
fma-undefine57.4%
add-sqr-sqrt35.4%
hypot-define50.9%
Applied egg-rr50.9%
*-rgt-identity50.9%
times-frac49.8%
metadata-eval49.8%
Simplified49.8%
Taylor expanded in b around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
unpow20.0%
rem-square-sqrt86.5%
associate-*r/86.5%
metadata-eval86.5%
Simplified86.5%
Taylor expanded in c around 0 87.8%
if -0.14499999999999999 < b < 4.0000000000000001e-127Initial program 83.2%
sqr-neg83.2%
sqr-neg83.2%
associate-*l*83.2%
Simplified83.2%
frac-2neg83.2%
div-inv83.0%
Applied egg-rr83.2%
Taylor expanded in b around 0 75.8%
*-commutative75.8%
*-commutative75.8%
associate-*r*76.0%
Simplified76.0%
if 4.0000000000000001e-127 < b Initial program 22.4%
sqr-neg22.4%
sqr-neg22.4%
associate-*l*22.4%
Simplified22.4%
Taylor expanded in b around inf 80.1%
*-commutative80.1%
Simplified80.1%
(FPCore (a b c)
:precision binary64
(if (<= b -2.95e-5)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 4e-127)
(/ (- (sqrt (* (* a c) -3.0)) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.95e-5) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 4e-127) {
tmp = (sqrt(((a * c) * -3.0)) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-2.95d-5)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 4d-127) then
tmp = (sqrt(((a * c) * (-3.0d0))) - b) / (a * 3.0d0)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.95e-5) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 4e-127) {
tmp = (Math.sqrt(((a * c) * -3.0)) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.95e-5: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 4e-127: tmp = (math.sqrt(((a * c) * -3.0)) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.95e-5) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 4e-127) tmp = Float64(Float64(sqrt(Float64(Float64(a * c) * -3.0)) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.95e-5) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 4e-127) tmp = (sqrt(((a * c) * -3.0)) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.95e-5], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4e-127], N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.95 \cdot 10^{-5}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 4 \cdot 10^{-127}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -2.9499999999999999e-5Initial program 57.4%
sqr-neg57.4%
sqr-neg57.4%
associate-*l*57.4%
Simplified57.4%
frac-2neg57.4%
div-inv57.3%
Applied egg-rr57.3%
un-div-inv57.4%
fma-undefine57.4%
add-sqr-sqrt35.4%
hypot-define50.9%
Applied egg-rr50.9%
*-rgt-identity50.9%
times-frac49.8%
metadata-eval49.8%
Simplified49.8%
Taylor expanded in b around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
unpow20.0%
rem-square-sqrt86.5%
associate-*r/86.5%
metadata-eval86.5%
Simplified86.5%
Taylor expanded in c around 0 87.8%
if -2.9499999999999999e-5 < b < 4.0000000000000001e-127Initial program 83.2%
sqr-neg83.2%
sqr-neg83.2%
associate-*l*83.2%
Simplified83.2%
Taylor expanded in b around 0 75.9%
if 4.0000000000000001e-127 < b Initial program 22.4%
sqr-neg22.4%
sqr-neg22.4%
associate-*l*22.4%
Simplified22.4%
Taylor expanded in b around inf 80.1%
*-commutative80.1%
Simplified80.1%
Final simplification81.5%
(FPCore (a b c)
:precision binary64
(if (<= b -3.1e-5)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 3e-129)
(/ (- b (sqrt (* c (* a -3.0)))) (* a -3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.1e-5) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 3e-129) {
tmp = (b - sqrt((c * (a * -3.0)))) / (a * -3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-3.1d-5)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 3d-129) then
tmp = (b - sqrt((c * (a * (-3.0d0))))) / (a * (-3.0d0))
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -3.1e-5) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 3e-129) {
tmp = (b - Math.sqrt((c * (a * -3.0)))) / (a * -3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.1e-5: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 3e-129: tmp = (b - math.sqrt((c * (a * -3.0)))) / (a * -3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.1e-5) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 3e-129) tmp = Float64(Float64(b - sqrt(Float64(c * Float64(a * -3.0)))) / Float64(a * -3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.1e-5) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 3e-129) tmp = (b - sqrt((c * (a * -3.0)))) / (a * -3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.1e-5], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3e-129], N[(N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(a * -3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.1 \cdot 10^{-5}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 3 \cdot 10^{-129}:\\
\;\;\;\;\frac{b - \sqrt{c \cdot \left(a \cdot -3\right)}}{a \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -3.10000000000000014e-5Initial program 57.4%
sqr-neg57.4%
sqr-neg57.4%
associate-*l*57.4%
Simplified57.4%
frac-2neg57.4%
div-inv57.3%
Applied egg-rr57.3%
un-div-inv57.4%
fma-undefine57.4%
add-sqr-sqrt35.4%
hypot-define50.9%
Applied egg-rr50.9%
*-rgt-identity50.9%
times-frac49.8%
metadata-eval49.8%
Simplified49.8%
Taylor expanded in b around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
unpow20.0%
rem-square-sqrt86.5%
associate-*r/86.5%
metadata-eval86.5%
Simplified86.5%
Taylor expanded in c around 0 87.8%
if -3.10000000000000014e-5 < b < 2.9999999999999998e-129Initial program 83.2%
sqr-neg83.2%
sqr-neg83.2%
associate-*l*83.2%
Simplified83.2%
frac-2neg83.2%
div-inv83.0%
Applied egg-rr83.2%
Taylor expanded in b around 0 75.8%
*-commutative75.8%
*-commutative75.8%
associate-*r*76.0%
Simplified76.0%
un-div-inv75.9%
Applied egg-rr75.9%
if 2.9999999999999998e-129 < b Initial program 22.4%
sqr-neg22.4%
sqr-neg22.4%
associate-*l*22.4%
Simplified22.4%
Taylor expanded in b around inf 80.1%
*-commutative80.1%
Simplified80.1%
(FPCore (a b c)
:precision binary64
(if (<= b -0.012)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 1.4e-127)
(/ (* -0.3333333333333333 (- b (sqrt (* a (* c -3.0))))) a)
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -0.012) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 1.4e-127) {
tmp = (-0.3333333333333333 * (b - sqrt((a * (c * -3.0))))) / a;
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-0.012d0)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 1.4d-127) then
tmp = ((-0.3333333333333333d0) * (b - sqrt((a * (c * (-3.0d0)))))) / a
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -0.012) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 1.4e-127) {
tmp = (-0.3333333333333333 * (b - Math.sqrt((a * (c * -3.0))))) / a;
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -0.012: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 1.4e-127: tmp = (-0.3333333333333333 * (b - math.sqrt((a * (c * -3.0))))) / a else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -0.012) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 1.4e-127) tmp = Float64(Float64(-0.3333333333333333 * Float64(b - sqrt(Float64(a * Float64(c * -3.0))))) / a); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -0.012) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 1.4e-127) tmp = (-0.3333333333333333 * (b - sqrt((a * (c * -3.0))))) / a; else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -0.012], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.4e-127], N[(N[(-0.3333333333333333 * N[(b - N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.012:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.4 \cdot 10^{-127}:\\
\;\;\;\;\frac{-0.3333333333333333 \cdot \left(b - \sqrt{a \cdot \left(c \cdot -3\right)}\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -0.012Initial program 57.4%
sqr-neg57.4%
sqr-neg57.4%
associate-*l*57.4%
Simplified57.4%
frac-2neg57.4%
div-inv57.3%
Applied egg-rr57.3%
un-div-inv57.4%
fma-undefine57.4%
add-sqr-sqrt35.4%
hypot-define50.9%
Applied egg-rr50.9%
*-rgt-identity50.9%
times-frac49.8%
metadata-eval49.8%
Simplified49.8%
Taylor expanded in b around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
unpow20.0%
rem-square-sqrt86.5%
associate-*r/86.5%
metadata-eval86.5%
Simplified86.5%
Taylor expanded in c around 0 87.8%
if -0.012 < b < 1.4e-127Initial program 83.2%
sqr-neg83.2%
sqr-neg83.2%
associate-*l*83.2%
Simplified83.2%
frac-2neg83.2%
div-inv83.0%
Applied egg-rr83.2%
Taylor expanded in b around 0 75.8%
*-commutative75.8%
*-commutative75.8%
associate-*r*76.0%
Simplified76.0%
pow176.0%
un-div-inv75.9%
*-un-lft-identity75.9%
*-commutative75.9%
times-frac75.6%
metadata-eval75.6%
Applied egg-rr75.6%
unpow175.6%
associate-*r/75.7%
associate-*r*75.8%
*-commutative75.8%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt75.7%
Simplified75.7%
if 1.4e-127 < b Initial program 22.4%
sqr-neg22.4%
sqr-neg22.4%
associate-*l*22.4%
Simplified22.4%
Taylor expanded in b around inf 80.1%
*-commutative80.1%
Simplified80.1%
(FPCore (a b c)
:precision binary64
(if (<= b -0.000118)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 1.4e-127)
(* (- b (sqrt (* c (* a -3.0)))) (/ -0.3333333333333333 a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -0.000118) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 1.4e-127) {
tmp = (b - sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / 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 <= (-0.000118d0)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 1.4d-127) then
tmp = (b - sqrt((c * (a * (-3.0d0))))) * ((-0.3333333333333333d0) / 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 <= -0.000118) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 1.4e-127) {
tmp = (b - Math.sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -0.000118: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 1.4e-127: tmp = (b - math.sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -0.000118) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 1.4e-127) tmp = Float64(Float64(b - sqrt(Float64(c * Float64(a * -3.0)))) * Float64(-0.3333333333333333 / 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 <= -0.000118) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 1.4e-127) tmp = (b - sqrt((c * (a * -3.0)))) * (-0.3333333333333333 / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -0.000118], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.4e-127], N[(N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.000118:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.4 \cdot 10^{-127}:\\
\;\;\;\;\left(b - \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{-0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.18e-4Initial program 57.4%
sqr-neg57.4%
sqr-neg57.4%
associate-*l*57.4%
Simplified57.4%
frac-2neg57.4%
div-inv57.3%
Applied egg-rr57.3%
un-div-inv57.4%
fma-undefine57.4%
add-sqr-sqrt35.4%
hypot-define50.9%
Applied egg-rr50.9%
*-rgt-identity50.9%
times-frac49.8%
metadata-eval49.8%
Simplified49.8%
Taylor expanded in b around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
unpow20.0%
rem-square-sqrt86.5%
associate-*r/86.5%
metadata-eval86.5%
Simplified86.5%
Taylor expanded in c around 0 87.8%
if -1.18e-4 < b < 1.4e-127Initial program 83.2%
sqr-neg83.2%
sqr-neg83.2%
associate-*l*83.2%
Simplified83.2%
frac-2neg83.2%
div-inv83.0%
Applied egg-rr83.2%
Taylor expanded in b around 0 75.8%
*-commutative75.8%
*-commutative75.8%
associate-*r*76.0%
Simplified76.0%
Taylor expanded in a around 0 75.7%
if 1.4e-127 < b Initial program 22.4%
sqr-neg22.4%
sqr-neg22.4%
associate-*l*22.4%
Simplified22.4%
Taylor expanded in b around inf 80.1%
*-commutative80.1%
Simplified80.1%
(FPCore (a b c)
:precision binary64
(if (<= b -3.1e-5)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 7e-131)
(* -0.3333333333333333 (/ (- b (sqrt (* a (* c -3.0)))) a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.1e-5) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 7e-131) {
tmp = -0.3333333333333333 * ((b - sqrt((a * (c * -3.0)))) / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-3.1d-5)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 7d-131) then
tmp = (-0.3333333333333333d0) * ((b - sqrt((a * (c * (-3.0d0))))) / a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -3.1e-5) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 7e-131) {
tmp = -0.3333333333333333 * ((b - Math.sqrt((a * (c * -3.0)))) / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.1e-5: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 7e-131: tmp = -0.3333333333333333 * ((b - math.sqrt((a * (c * -3.0)))) / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.1e-5) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 7e-131) tmp = Float64(-0.3333333333333333 * Float64(Float64(b - sqrt(Float64(a * Float64(c * -3.0)))) / a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.1e-5) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 7e-131) tmp = -0.3333333333333333 * ((b - sqrt((a * (c * -3.0)))) / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.1e-5], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-131], N[(-0.3333333333333333 * N[(N[(b - N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.1 \cdot 10^{-5}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-131}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -3.10000000000000014e-5Initial program 57.4%
sqr-neg57.4%
sqr-neg57.4%
associate-*l*57.4%
Simplified57.4%
frac-2neg57.4%
div-inv57.3%
Applied egg-rr57.3%
un-div-inv57.4%
fma-undefine57.4%
add-sqr-sqrt35.4%
hypot-define50.9%
Applied egg-rr50.9%
*-rgt-identity50.9%
times-frac49.8%
metadata-eval49.8%
Simplified49.8%
Taylor expanded in b around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
unpow20.0%
rem-square-sqrt86.5%
associate-*r/86.5%
metadata-eval86.5%
Simplified86.5%
Taylor expanded in c around 0 87.8%
if -3.10000000000000014e-5 < b < 7.0000000000000004e-131Initial program 83.2%
sqr-neg83.2%
sqr-neg83.2%
associate-*l*83.2%
Simplified83.2%
frac-2neg83.2%
div-inv83.0%
Applied egg-rr83.2%
Taylor expanded in b around 0 75.8%
*-commutative75.8%
*-commutative75.8%
associate-*r*76.0%
Simplified76.0%
*-commutative76.0%
sqrt-prod42.3%
Applied egg-rr42.3%
un-div-inv42.2%
*-commutative42.2%
sqrt-prod75.9%
Applied egg-rr75.9%
*-rgt-identity75.9%
*-commutative75.9%
*-commutative75.9%
times-frac75.6%
metadata-eval75.6%
associate-*r*75.7%
*-commutative75.7%
associate-*r*75.6%
Simplified75.6%
if 7.0000000000000004e-131 < b Initial program 22.4%
sqr-neg22.4%
sqr-neg22.4%
associate-*l*22.4%
Simplified22.4%
Taylor expanded in b around inf 80.1%
*-commutative80.1%
Simplified80.1%
(FPCore (a b c) :precision binary64 (if (<= b -5e-311) (+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b))) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-311)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-311) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-311: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-311) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-311) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-311], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -5.00000000000023e-311Initial program 66.6%
sqr-neg66.6%
sqr-neg66.6%
associate-*l*66.6%
Simplified66.6%
frac-2neg66.6%
div-inv66.5%
Applied egg-rr66.5%
un-div-inv66.6%
fma-undefine66.6%
add-sqr-sqrt50.7%
hypot-define62.0%
Applied egg-rr62.0%
*-rgt-identity62.0%
times-frac61.1%
metadata-eval61.1%
Simplified61.1%
Taylor expanded in b around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
unpow20.0%
rem-square-sqrt65.1%
associate-*r/65.1%
metadata-eval65.1%
Simplified65.1%
Taylor expanded in c around 0 67.1%
if -5.00000000000023e-311 < b Initial program 35.4%
sqr-neg35.4%
sqr-neg35.4%
associate-*l*35.4%
Simplified35.4%
Taylor expanded in b around inf 64.7%
*-commutative64.7%
Simplified64.7%
(FPCore (a b c) :precision binary64 (if (<= b 3.6e-295) (/ b (* a -1.5)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.6e-295) {
tmp = b / (a * -1.5);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 3.6d-295) then
tmp = b / (a * (-1.5d0))
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 3.6e-295) {
tmp = b / (a * -1.5);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3.6e-295: tmp = b / (a * -1.5) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3.6e-295) tmp = Float64(b / Float64(a * -1.5)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 3.6e-295) tmp = b / (a * -1.5); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3.6e-295], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.6 \cdot 10^{-295}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 3.6000000000000001e-295Initial program 66.9%
sqr-neg66.9%
sqr-neg66.9%
associate-*l*66.9%
Simplified66.9%
frac-2neg66.9%
div-inv66.7%
Applied egg-rr66.8%
Taylor expanded in b around -inf 66.3%
*-commutative66.3%
associate-*l/66.4%
associate-/l*66.3%
Simplified66.3%
clear-num66.2%
un-div-inv66.4%
div-inv66.5%
metadata-eval66.5%
Applied egg-rr66.5%
if 3.6000000000000001e-295 < b Initial program 34.9%
sqr-neg34.9%
sqr-neg34.9%
associate-*l*34.9%
Simplified34.9%
Taylor expanded in b around inf 65.1%
*-commutative65.1%
Simplified65.1%
(FPCore (a b c) :precision binary64 (if (<= b 2.1e-295) (* -0.6666666666666666 (/ b a)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.1e-295) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 2.1d-295) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 2.1e-295) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.1e-295: tmp = -0.6666666666666666 * (b / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.1e-295) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 2.1e-295) tmp = -0.6666666666666666 * (b / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.1e-295], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.1 \cdot 10^{-295}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 2.09999999999999993e-295Initial program 66.9%
sqr-neg66.9%
sqr-neg66.9%
associate-*l*66.9%
Simplified66.9%
Taylor expanded in b around -inf 66.3%
*-commutative66.3%
Simplified66.3%
if 2.09999999999999993e-295 < b Initial program 34.9%
sqr-neg34.9%
sqr-neg34.9%
associate-*l*34.9%
Simplified34.9%
Taylor expanded in b around inf 65.1%
*-commutative65.1%
Simplified65.1%
Final simplification65.7%
(FPCore (a b c) :precision binary64 (if (<= b 2.1e-295) (* -0.6666666666666666 (/ b a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.1e-295) {
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 <= 2.1d-295) 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 <= 2.1e-295) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.1e-295: tmp = -0.6666666666666666 * (b / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.1e-295) 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 <= 2.1e-295) tmp = -0.6666666666666666 * (b / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.1e-295], 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 2.1 \cdot 10^{-295}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 2.09999999999999993e-295Initial program 66.9%
sqr-neg66.9%
sqr-neg66.9%
associate-*l*66.9%
Simplified66.9%
Taylor expanded in b around -inf 66.3%
*-commutative66.3%
Simplified66.3%
if 2.09999999999999993e-295 < b Initial program 34.9%
sqr-neg34.9%
sqr-neg34.9%
associate-*l*34.9%
Simplified34.9%
frac-2neg34.9%
div-inv34.9%
Applied egg-rr34.9%
un-div-inv34.9%
fma-undefine34.9%
add-sqr-sqrt32.9%
hypot-define42.9%
Applied egg-rr42.9%
*-rgt-identity42.9%
times-frac42.8%
metadata-eval42.8%
Simplified42.8%
associate-*l/42.8%
clear-num42.8%
Applied egg-rr42.8%
associate-/r/42.8%
*-commutative42.8%
Simplified42.8%
Taylor expanded in a around 0 0.0%
*-commutative0.0%
associate-/l*0.0%
associate-*r*0.0%
*-commutative0.0%
associate-*r/0.0%
unpow20.0%
rem-square-sqrt65.0%
metadata-eval65.0%
Simplified65.0%
Final simplification65.6%
(FPCore (a b c) :precision binary64 (if (<= b 2.1e-295) (* b (/ -0.6666666666666666 a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.1e-295) {
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 <= 2.1d-295) 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 <= 2.1e-295) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.1e-295: tmp = b * (-0.6666666666666666 / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.1e-295) 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 <= 2.1e-295) tmp = b * (-0.6666666666666666 / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.1e-295], 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 2.1 \cdot 10^{-295}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 2.09999999999999993e-295Initial program 66.9%
sqr-neg66.9%
sqr-neg66.9%
associate-*l*66.9%
Simplified66.9%
frac-2neg66.9%
div-inv66.7%
Applied egg-rr66.8%
Taylor expanded in b around -inf 66.3%
*-commutative66.3%
associate-*l/66.4%
associate-/l*66.3%
Simplified66.3%
if 2.09999999999999993e-295 < b Initial program 34.9%
sqr-neg34.9%
sqr-neg34.9%
associate-*l*34.9%
Simplified34.9%
frac-2neg34.9%
div-inv34.9%
Applied egg-rr34.9%
un-div-inv34.9%
fma-undefine34.9%
add-sqr-sqrt32.9%
hypot-define42.9%
Applied egg-rr42.9%
*-rgt-identity42.9%
times-frac42.8%
metadata-eval42.8%
Simplified42.8%
associate-*l/42.8%
clear-num42.8%
Applied egg-rr42.8%
associate-/r/42.8%
*-commutative42.8%
Simplified42.8%
Taylor expanded in a around 0 0.0%
*-commutative0.0%
associate-/l*0.0%
associate-*r*0.0%
*-commutative0.0%
associate-*r/0.0%
unpow20.0%
rem-square-sqrt65.0%
metadata-eval65.0%
Simplified65.0%
(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 50.4%
sqr-neg50.4%
sqr-neg50.4%
associate-*l*50.4%
Simplified50.4%
frac-2neg50.4%
div-inv50.3%
Applied egg-rr50.3%
Taylor expanded in b around -inf 33.4%
*-commutative33.4%
associate-*l/33.5%
associate-/l*33.4%
Simplified33.4%
herbie shell --seed 2024095
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))