
(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 -1.7e+90)
(/ (* b -0.6666666666666666) a)
(if (<= b 1.15e-25)
(/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.7e+90) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 1.15e-25) {
tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} 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.7d+90)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 1.15d-25) then
tmp = (sqrt(((b * b) - ((a * 3.0d0) * c))) - b) / (a * 3.0d0)
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.7e+90) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 1.15e-25) {
tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.7e+90: tmp = (b * -0.6666666666666666) / a elif b <= 1.15e-25: tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.7e+90) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 1.15e-25) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0)); 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.7e+90) tmp = (b * -0.6666666666666666) / a; elseif (b <= 1.15e-25) tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.7e+90], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 1.15e-25], 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[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.7 \cdot 10^{+90}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 1.15 \cdot 10^{-25}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.70000000000000009e90Initial program 63.9%
add-cube-cbrt63.9%
pow363.9%
Applied egg-rr63.9%
Taylor expanded in b around -inf 99.7%
associate-*r/99.8%
*-commutative99.8%
Simplified99.8%
if -1.70000000000000009e90 < b < 1.15e-25Initial program 83.1%
if 1.15e-25 < b Initial program 17.6%
Simplified17.6%
Taylor expanded in b around inf 92.3%
Final simplification89.9%
(FPCore (a b c)
:precision binary64
(if (<= b -3.3e+87)
(/ (* b -0.6666666666666666) a)
(if (<= b 1.3e-25)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.3e+87) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 1.3e-25) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} 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 <= (-3.3d+87)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 1.3d-25) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (a * 3.0d0)
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 <= -3.3e+87) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 1.3e-25) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.3e+87: tmp = (b * -0.6666666666666666) / a elif b <= 1.3e-25: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.3e+87) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 1.3e-25) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.3e+87) tmp = (b * -0.6666666666666666) / a; elseif (b <= 1.3e-25) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.3e+87], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 1.3e-25], 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[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.3 \cdot 10^{+87}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 1.3 \cdot 10^{-25}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -3.3000000000000001e87Initial program 63.9%
add-cube-cbrt63.9%
pow363.9%
Applied egg-rr63.9%
Taylor expanded in b around -inf 99.7%
associate-*r/99.8%
*-commutative99.8%
Simplified99.8%
if -3.3000000000000001e87 < b < 1.3e-25Initial program 83.1%
sqr-neg83.1%
sqr-neg83.1%
associate-*l*83.0%
Simplified83.0%
if 1.3e-25 < b Initial program 17.6%
Simplified17.6%
Taylor expanded in b around inf 92.3%
Final simplification89.9%
(FPCore (a b c)
:precision binary64
(if (<= b -6.2e-82)
(* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
(if (<= b 1.5e-26)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.2e-82) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else if (b <= 1.5e-26) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} 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 <= (-6.2d-82)) then
tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.5d0) * (c / (b ** 2.0d0))))
else if (b <= 1.5d-26) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
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 <= -6.2e-82) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
} else if (b <= 1.5e-26) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.2e-82: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) elif b <= 1.5e-26: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.2e-82) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); elseif (b <= 1.5e-26) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6.2e-82) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); elseif (b <= 1.5e-26) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.2e-82], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.5e-26], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.2 \cdot 10^{-82}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{-26}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -6.19999999999999999e-82Initial program 75.1%
Simplified75.1%
Taylor expanded in b around -inf 86.4%
if -6.19999999999999999e-82 < b < 1.50000000000000006e-26Initial program 79.1%
Simplified78.9%
Taylor expanded in b around 0 75.7%
associate-*r*75.9%
*-commutative75.9%
Simplified75.9%
if 1.50000000000000006e-26 < b Initial program 17.6%
Simplified17.6%
Taylor expanded in b around inf 92.3%
Final simplification85.7%
(FPCore (a b c)
:precision binary64
(if (<= b -3.2e-83)
(+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5))
(if (<= b 1.25e-26)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.2e-83) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 1.25e-26) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} 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 <= (-3.2d-83)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else if (b <= 1.25d-26) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
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 <= -3.2e-83) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 1.25e-26) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.2e-83: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) elif b <= 1.25e-26: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.2e-83) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); elseif (b <= 1.25e-26) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.2e-83) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); elseif (b <= 1.25e-26) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.2e-83], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.25e-26], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.2 \cdot 10^{-83}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 1.25 \cdot 10^{-26}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -3.2000000000000001e-83Initial program 75.1%
Simplified75.1%
Taylor expanded in b around -inf 85.4%
associate-*r*85.4%
mul-1-neg85.4%
associate-*r/85.4%
associate-*r*85.4%
Simplified85.4%
Taylor expanded in a around inf 86.4%
if -3.2000000000000001e-83 < b < 1.25000000000000005e-26Initial program 79.1%
Simplified78.9%
Taylor expanded in b around 0 75.7%
associate-*r*75.9%
*-commutative75.9%
Simplified75.9%
if 1.25000000000000005e-26 < b Initial program 17.6%
Simplified17.6%
Taylor expanded in b around inf 92.3%
Final simplification85.7%
(FPCore (a b c)
:precision binary64
(if (<= b -4.8e-82)
(+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5))
(if (<= b 3.8e-25)
(/ (- (sqrt (* (* a c) -3.0)) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.8e-82) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 3.8e-25) {
tmp = (sqrt(((a * c) * -3.0)) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4.8d-82)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else if (b <= 3.8d-25) then
tmp = (sqrt(((a * c) * (-3.0d0))) - b) / (a * 3.0d0)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4.8e-82) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 3.8e-25) {
tmp = (Math.sqrt(((a * c) * -3.0)) - b) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.8e-82: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) elif b <= 3.8e-25: tmp = (math.sqrt(((a * c) * -3.0)) - b) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.8e-82) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); elseif (b <= 3.8e-25) tmp = Float64(Float64(sqrt(Float64(Float64(a * c) * -3.0)) - b) / Float64(a * 3.0)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.8e-82) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); elseif (b <= 3.8e-25) tmp = (sqrt(((a * c) * -3.0)) - b) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.8e-82], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.8e-25], N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.8 \cdot 10^{-82}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-25}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -4.80000000000000017e-82Initial program 75.1%
Simplified75.1%
Taylor expanded in b around -inf 85.4%
associate-*r*85.4%
mul-1-neg85.4%
associate-*r/85.4%
associate-*r*85.4%
Simplified85.4%
Taylor expanded in a around inf 86.4%
if -4.80000000000000017e-82 < b < 3.7999999999999998e-25Initial program 79.1%
Simplified78.9%
Taylor expanded in b around 0 75.7%
if 3.7999999999999998e-25 < b Initial program 17.6%
Simplified17.6%
Taylor expanded in b around inf 92.3%
Final simplification85.7%
(FPCore (a b c)
:precision binary64
(if (<= b -5.5e-82)
(+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5))
(if (<= b 1.95e-26)
(* 0.3333333333333333 (/ (- (sqrt (* c (* a -3.0))) b) a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.5e-82) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 1.95e-26) {
tmp = 0.3333333333333333 * ((sqrt((c * (a * -3.0))) - b) / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5.5d-82)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else if (b <= 1.95d-26) then
tmp = 0.3333333333333333d0 * ((sqrt((c * (a * (-3.0d0)))) - b) / a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5.5e-82) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 1.95e-26) {
tmp = 0.3333333333333333 * ((Math.sqrt((c * (a * -3.0))) - b) / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.5e-82: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) elif b <= 1.95e-26: tmp = 0.3333333333333333 * ((math.sqrt((c * (a * -3.0))) - b) / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.5e-82) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); elseif (b <= 1.95e-26) tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5.5e-82) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); elseif (b <= 1.95e-26) tmp = 0.3333333333333333 * ((sqrt((c * (a * -3.0))) - b) / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.5e-82], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.95e-26], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.5 \cdot 10^{-82}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 1.95 \cdot 10^{-26}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -5.4999999999999998e-82Initial program 75.1%
Simplified75.1%
Taylor expanded in b around -inf 85.4%
associate-*r*85.4%
mul-1-neg85.4%
associate-*r/85.4%
associate-*r*85.4%
Simplified85.4%
Taylor expanded in a around inf 86.4%
if -5.4999999999999998e-82 < b < 1.94999999999999993e-26Initial program 79.1%
Simplified78.9%
Taylor expanded in b around 0 75.7%
div-sub75.7%
*-un-lft-identity75.7%
times-frac75.6%
metadata-eval75.6%
*-un-lft-identity75.6%
times-frac75.6%
metadata-eval75.6%
Applied egg-rr75.6%
distribute-lft-out--75.6%
*-commutative75.6%
associate-*r*75.7%
Simplified75.7%
pow175.7%
sub-div75.7%
Applied egg-rr75.7%
unpow175.7%
associate-*r*75.6%
*-commutative75.6%
associate-*l*75.7%
Simplified75.7%
if 1.94999999999999993e-26 < b Initial program 17.6%
Simplified17.6%
Taylor expanded in b around inf 92.3%
Final simplification85.7%
(FPCore (a b c) :precision binary64 (if (<= b -2.05e-82) (+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5)) (if (<= b 3.6e-26) (/ (sqrt (* a (* c -3.0))) (* a 3.0)) (* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.05e-82) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 3.6e-26) {
tmp = sqrt((a * (c * -3.0))) / (a * 3.0);
} 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.05d-82)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else if (b <= 3.6d-26) then
tmp = sqrt((a * (c * (-3.0d0)))) / (a * 3.0d0)
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.05e-82) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 3.6e-26) {
tmp = Math.sqrt((a * (c * -3.0))) / (a * 3.0);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.05e-82: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) elif b <= 3.6e-26: tmp = math.sqrt((a * (c * -3.0))) / (a * 3.0) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.05e-82) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); elseif (b <= 3.6e-26) tmp = Float64(sqrt(Float64(a * Float64(c * -3.0))) / Float64(a * 3.0)); 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.05e-82) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); elseif (b <= 3.6e-26) tmp = sqrt((a * (c * -3.0))) / (a * 3.0); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.05e-82], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.6e-26], N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.05 \cdot 10^{-82}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 3.6 \cdot 10^{-26}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -2.04999999999999998e-82Initial program 75.1%
Simplified75.1%
Taylor expanded in b around -inf 85.4%
associate-*r*85.4%
mul-1-neg85.4%
associate-*r/85.4%
associate-*r*85.4%
Simplified85.4%
Taylor expanded in a around inf 86.4%
if -2.04999999999999998e-82 < b < 3.6000000000000001e-26Initial program 79.1%
add-cube-cbrt78.5%
pow378.6%
Applied egg-rr78.6%
Taylor expanded in a around -inf 0.0%
mul-1-neg0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt74.5%
rem-cube-cbrt74.7%
associate-*r*74.7%
*-commutative74.7%
distribute-lft-neg-in74.7%
metadata-eval74.7%
*-lft-identity74.7%
*-commutative74.7%
associate-*r*74.7%
Simplified74.7%
if 3.6000000000000001e-26 < b Initial program 17.6%
Simplified17.6%
Taylor expanded in b around inf 92.3%
Final simplification85.4%
(FPCore (a b c)
:precision binary64
(if (<= b -4.35e-218)
(+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5))
(if (<= b 1.15e-51)
(* (sqrt (* c (/ -3.0 a))) (- -0.3333333333333333))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.35e-218) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 1.15e-51) {
tmp = sqrt((c * (-3.0 / a))) * -(-0.3333333333333333);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4.35d-218)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
else if (b <= 1.15d-51) then
tmp = sqrt((c * ((-3.0d0) / a))) * -(-0.3333333333333333d0)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4.35e-218) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else if (b <= 1.15e-51) {
tmp = Math.sqrt((c * (-3.0 / a))) * -(-0.3333333333333333);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.35e-218: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) elif b <= 1.15e-51: tmp = math.sqrt((c * (-3.0 / a))) * -(-0.3333333333333333) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.35e-218) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); elseif (b <= 1.15e-51) tmp = Float64(sqrt(Float64(c * Float64(-3.0 / a))) * Float64(-(-0.3333333333333333))); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.35e-218) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); elseif (b <= 1.15e-51) tmp = sqrt((c * (-3.0 / a))) * -(-0.3333333333333333); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.35e-218], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.15e-51], N[(N[Sqrt[N[(c * N[(-3.0 / a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (--0.3333333333333333)), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.35 \cdot 10^{-218}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{elif}\;b \leq 1.15 \cdot 10^{-51}:\\
\;\;\;\;\sqrt{c \cdot \frac{-3}{a}} \cdot \left(--0.3333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -4.34999999999999982e-218Initial program 77.1%
Simplified77.0%
Taylor expanded in b around -inf 73.3%
associate-*r*73.3%
mul-1-neg73.3%
associate-*r/73.3%
associate-*r*73.3%
Simplified73.3%
Taylor expanded in a around inf 76.0%
if -4.34999999999999982e-218 < b < 1.15000000000000001e-51Initial program 77.9%
add-cube-cbrt77.4%
pow377.4%
Applied egg-rr77.4%
Taylor expanded in a around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.8%
rem-cube-cbrt44.9%
associate-/l*44.9%
Simplified44.9%
if 1.15000000000000001e-51 < b Initial program 19.8%
Simplified19.8%
Taylor expanded in b around inf 89.9%
Final simplification75.9%
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} 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 <= (-2d-310)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
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 <= -2e-310) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e-310: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e-310) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2e-310) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 77.0%
Simplified77.0%
Taylor expanded in b around -inf 65.9%
associate-*r*65.9%
mul-1-neg65.9%
associate-*r/65.9%
associate-*r*65.9%
Simplified65.9%
Taylor expanded in a around inf 68.6%
if -1.999999999999994e-310 < b Initial program 34.1%
Simplified34.1%
Taylor expanded in b around inf 70.5%
Final simplification69.6%
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (/ (* b -0.6666666666666666) a) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
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 <= (-2d-310)) 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 <= -2e-310) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e-310: tmp = (b * -0.6666666666666666) / a else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e-310) 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 <= -2e-310) tmp = (b * -0.6666666666666666) / a; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], 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 \cdot 10^{-310}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 77.0%
add-cube-cbrt76.8%
pow376.8%
Applied egg-rr76.8%
Taylor expanded in b around -inf 68.4%
associate-*r/68.5%
*-commutative68.5%
Simplified68.5%
if -1.999999999999994e-310 < b Initial program 34.1%
Simplified34.1%
Taylor expanded in b around inf 70.5%
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (* -0.6666666666666666 (/ b a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-2d-310)) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e-310: tmp = -0.6666666666666666 * (b / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e-310) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2e-310) tmp = -0.6666666666666666 * (b / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 77.0%
Simplified77.0%
Taylor expanded in b around -inf 68.4%
*-commutative68.4%
Simplified68.4%
if -1.999999999999994e-310 < b Initial program 34.1%
Simplified34.1%
Taylor expanded in b around inf 70.5%
Final simplification69.5%
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (* b (/ -0.6666666666666666 a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
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 <= (-2d-310)) 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 <= -2e-310) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e-310: tmp = b * (-0.6666666666666666 / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e-310) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2e-310) tmp = b * (-0.6666666666666666 / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 77.0%
add-cube-cbrt76.8%
pow376.8%
Applied egg-rr76.0%
Taylor expanded in b around -inf 67.9%
associate-*r/67.9%
*-commutative67.9%
rem-cube-cbrt68.5%
*-commutative68.5%
associate-*r/68.4%
associate-/r*68.4%
metadata-eval68.4%
Simplified68.4%
if -1.999999999999994e-310 < b Initial program 34.1%
Simplified34.1%
Taylor expanded in b around inf 70.5%
(FPCore (a b c) :precision binary64 (* -0.5 (/ c b)))
double code(double a, double b, double c) {
return -0.5 * (c / b);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-0.5d0) * (c / b)
end function
public static double code(double a, double b, double c) {
return -0.5 * (c / b);
}
def code(a, b, c): return -0.5 * (c / b)
function code(a, b, c) return Float64(-0.5 * Float64(c / b)) end
function tmp = code(a, b, c) tmp = -0.5 * (c / b); end
code[a_, b_, c_] := N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \frac{c}{b}
\end{array}
Initial program 55.1%
Simplified55.0%
Taylor expanded in b around inf 37.2%
herbie shell --seed 2024180
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))