
(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 -3e+135)
(/ (* b -2.0) (* 3.0 a))
(if (<= b 1.05e-152)
(/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3e+135) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 1.05e-152) {
tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (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 <= (-3d+135)) then
tmp = (b * (-2.0d0)) / (3.0d0 * a)
else if (b <= 1.05d-152) then
tmp = (sqrt(((b * b) - ((3.0d0 * a) * c))) - b) / (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 <= -3e+135) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 1.05e-152) {
tmp = (Math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3e+135: tmp = (b * -2.0) / (3.0 * a) elif b <= 1.05e-152: tmp = (math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3e+135) tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a)); elseif (b <= 1.05e-152) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(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 <= -3e+135) tmp = (b * -2.0) / (3.0 * a); elseif (b <= 1.05e-152) tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3e+135], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.05e-152], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3 \cdot 10^{+135}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq 1.05 \cdot 10^{-152}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3e135Initial program 53.9%
Taylor expanded in b around -inf 98.1%
*-commutative98.1%
Simplified98.1%
if -3e135 < b < 1.04999999999999999e-152Initial program 86.5%
if 1.04999999999999999e-152 < b Initial program 22.9%
Taylor expanded in b around inf 64.8%
associate-/l*71.3%
associate-/r/65.0%
Simplified65.0%
Taylor expanded in a around 0 82.7%
associate-*r/82.8%
Simplified82.8%
Final simplification87.4%
(FPCore (a b c)
:precision binary64
(if (<= b -650000.0)
(fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
(if (<= b 1.05e-152)
(- (/ (/ (sqrt (* c (* a -3.0))) a) 3.0) (/ b (* 3.0 a)))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -650000.0) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else if (b <= 1.05e-152) {
tmp = ((sqrt((c * (a * -3.0))) / a) / 3.0) - (b / (3.0 * a));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -650000.0) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); elseif (b <= 1.05e-152) tmp = Float64(Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) / a) / 3.0) - Float64(b / Float64(3.0 * a))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -650000.0], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.05e-152], N[(N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision] - N[(b / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -650000:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 1.05 \cdot 10^{-152}:\\
\;\;\;\;\frac{\frac{\sqrt{c \cdot \left(a \cdot -3\right)}}{a}}{3} - \frac{b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -6.5e5Initial program 69.4%
Taylor expanded in b around -inf 94.1%
fma-define94.2%
Simplified94.2%
if -6.5e5 < b < 1.04999999999999999e-152Initial program 81.0%
associate-*l*80.9%
prod-diff80.6%
*-commutative80.6%
associate-*l*80.6%
*-commutative80.6%
distribute-rgt-neg-in80.6%
*-commutative80.6%
distribute-rgt-neg-in80.6%
metadata-eval80.6%
*-commutative80.6%
associate-*l*80.6%
*-commutative80.6%
associate-*l*80.6%
Applied egg-rr80.6%
Taylor expanded in b around 0 68.3%
distribute-rgt-out68.7%
*-commutative68.7%
metadata-eval68.7%
associate-*r*68.7%
mul-1-neg68.7%
unsub-neg68.7%
associate-*r*68.7%
*-commutative68.7%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt68.7%
Simplified68.7%
div-sub68.7%
associate-*r*68.7%
*-commutative68.7%
*-commutative68.7%
*-commutative68.7%
Applied egg-rr68.7%
associate-/r*68.8%
Simplified68.8%
if 1.04999999999999999e-152 < b Initial program 22.9%
Taylor expanded in b around inf 64.8%
associate-/l*71.3%
associate-/r/65.0%
Simplified65.0%
Taylor expanded in a around 0 82.7%
associate-*r/82.8%
Simplified82.8%
Final simplification82.8%
(FPCore (a b c)
:precision binary64
(if (<= b -10000.0)
(fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
(if (<= b 1.9e-156)
(/ (- (sqrt (* -3.0 (* a c))) b) (* 3.0 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -10000.0) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else if (b <= 1.9e-156) {
tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -10000.0) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); elseif (b <= 1.9e-156) tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(3.0 * a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -10000.0], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.9e-156], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -10000:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 1.9 \cdot 10^{-156}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1e4Initial program 69.4%
Taylor expanded in b around -inf 94.1%
fma-define94.2%
Simplified94.2%
if -1e4 < b < 1.90000000000000004e-156Initial program 81.0%
associate-*l*80.9%
prod-diff80.6%
*-commutative80.6%
associate-*l*80.6%
*-commutative80.6%
distribute-rgt-neg-in80.6%
*-commutative80.6%
distribute-rgt-neg-in80.6%
metadata-eval80.6%
*-commutative80.6%
associate-*l*80.6%
*-commutative80.6%
associate-*l*80.6%
Applied egg-rr80.6%
Taylor expanded in b around 0 68.3%
distribute-rgt-out68.7%
*-commutative68.7%
metadata-eval68.7%
associate-*r*68.7%
mul-1-neg68.7%
unsub-neg68.7%
associate-*r*68.7%
*-commutative68.7%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt68.7%
Simplified68.7%
Taylor expanded in a around 0 68.7%
if 1.90000000000000004e-156 < b Initial program 22.9%
Taylor expanded in b around inf 64.8%
associate-/l*71.3%
associate-/r/65.0%
Simplified65.0%
Taylor expanded in a around 0 82.7%
associate-*r/82.8%
Simplified82.8%
Final simplification82.8%
(FPCore (a b c)
:precision binary64
(if (<= b -10000.0)
(fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
(if (<= b 1.05e-152)
(/ (- (sqrt (* a (* c -3.0))) b) (* 3.0 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -10000.0) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else if (b <= 1.05e-152) {
tmp = (sqrt((a * (c * -3.0))) - b) / (3.0 * a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -10000.0) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); elseif (b <= 1.05e-152) tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / Float64(3.0 * a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -10000.0], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.05e-152], N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -10000:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 1.05 \cdot 10^{-152}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1e4Initial program 69.4%
Taylor expanded in b around -inf 94.1%
fma-define94.2%
Simplified94.2%
if -1e4 < b < 1.04999999999999999e-152Initial program 81.0%
associate-*l*80.9%
prod-diff80.6%
*-commutative80.6%
associate-*l*80.6%
*-commutative80.6%
distribute-rgt-neg-in80.6%
*-commutative80.6%
distribute-rgt-neg-in80.6%
metadata-eval80.6%
*-commutative80.6%
associate-*l*80.6%
*-commutative80.6%
associate-*l*80.6%
Applied egg-rr80.6%
Taylor expanded in b around 0 68.3%
distribute-rgt-out68.7%
*-commutative68.7%
metadata-eval68.7%
associate-*r*68.7%
mul-1-neg68.7%
unsub-neg68.7%
associate-*r*68.7%
*-commutative68.7%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt68.7%
Simplified68.7%
if 1.04999999999999999e-152 < b Initial program 22.9%
Taylor expanded in b around inf 64.8%
associate-/l*71.3%
associate-/r/65.0%
Simplified65.0%
Taylor expanded in a around 0 82.7%
associate-*r/82.8%
Simplified82.8%
Final simplification82.8%
(FPCore (a b c)
:precision binary64
(if (<= b -19000.0)
(fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
(if (<= b 1e-152)
(/ (- (sqrt (* c (* a -3.0))) b) (* 3.0 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -19000.0) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else if (b <= 1e-152) {
tmp = (sqrt((c * (a * -3.0))) - b) / (3.0 * a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -19000.0) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); elseif (b <= 1e-152) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(3.0 * a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -19000.0], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1e-152], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -19000:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 10^{-152}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -19000Initial program 69.4%
Taylor expanded in b around -inf 94.1%
fma-define94.2%
Simplified94.2%
if -19000 < b < 1.00000000000000007e-152Initial program 81.0%
Taylor expanded in b around 0 68.7%
associate-*r*68.7%
*-commutative68.7%
*-commutative68.7%
Simplified68.7%
if 1.00000000000000007e-152 < b Initial program 22.9%
Taylor expanded in b around inf 64.8%
associate-/l*71.3%
associate-/r/65.0%
Simplified65.0%
Taylor expanded in a around 0 82.7%
associate-*r/82.8%
Simplified82.8%
Final simplification82.8%
(FPCore (a b c)
:precision binary64
(if (<= b -2.1e-67)
(+ (* 0.5 (/ c b)) (* -0.6666666666666666 (/ b a)))
(if (<= b 9.4e-153)
(* 0.3333333333333333 (/ (sqrt (* a (* c -3.0))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.1e-67) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else if (b <= 9.4e-153) {
tmp = 0.3333333333333333 * (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.1d-67)) then
tmp = (0.5d0 * (c / b)) + ((-0.6666666666666666d0) * (b / a))
else if (b <= 9.4d-153) then
tmp = 0.3333333333333333d0 * (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.1e-67) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else if (b <= 9.4e-153) {
tmp = 0.3333333333333333 * (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.1e-67: tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)) elif b <= 9.4e-153: tmp = 0.3333333333333333 * (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.1e-67) tmp = Float64(Float64(0.5 * Float64(c / b)) + Float64(-0.6666666666666666 * Float64(b / a))); elseif (b <= 9.4e-153) tmp = Float64(0.3333333333333333 * Float64(sqrt(Float64(a * Float64(c * -3.0))) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.1e-67) tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)); elseif (b <= 9.4e-153) tmp = 0.3333333333333333 * (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.1e-67], N[(N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9.4e-153], N[(0.3333333333333333 * N[(N[Sqrt[N[(a * N[(c * -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.1 \cdot 10^{-67}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} + -0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq 9.4 \cdot 10^{-153}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.1000000000000002e-67Initial program 71.6%
Taylor expanded in b around -inf 88.7%
if -2.1000000000000002e-67 < b < 9.3999999999999998e-153Initial program 79.4%
associate-*l*79.3%
prod-diff79.0%
*-commutative79.0%
associate-*l*79.0%
*-commutative79.0%
distribute-rgt-neg-in79.0%
*-commutative79.0%
distribute-rgt-neg-in79.0%
metadata-eval79.0%
*-commutative79.0%
associate-*l*79.0%
*-commutative79.0%
associate-*l*78.9%
Applied egg-rr78.9%
Taylor expanded in b around 0 69.7%
associate-*l/69.7%
distribute-rgt-out70.0%
*-commutative70.0%
metadata-eval70.0%
associate-*r*70.1%
*-lft-identity70.1%
associate-*r*70.0%
*-commutative70.0%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt70.0%
Simplified70.0%
if 9.3999999999999998e-153 < b Initial program 22.9%
Taylor expanded in b around inf 64.8%
associate-/l*71.3%
associate-/r/65.0%
Simplified65.0%
Taylor expanded in a around 0 82.7%
associate-*r/82.8%
Simplified82.8%
Final simplification82.1%
(FPCore (a b c)
:precision binary64
(if (<= b -7.8e-69)
(+ (* 0.5 (/ c b)) (* -0.6666666666666666 (/ b a)))
(if (<= b 1.05e-152)
(* (/ (sqrt (* c (* a -3.0))) a) 0.3333333333333333)
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.8e-69) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else if (b <= 1.05e-152) {
tmp = (sqrt((c * (a * -3.0))) / a) * 0.3333333333333333;
} 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.8d-69)) then
tmp = (0.5d0 * (c / b)) + ((-0.6666666666666666d0) * (b / a))
else if (b <= 1.05d-152) then
tmp = (sqrt((c * (a * (-3.0d0)))) / a) * 0.3333333333333333d0
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.8e-69) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else if (b <= 1.05e-152) {
tmp = (Math.sqrt((c * (a * -3.0))) / a) * 0.3333333333333333;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7.8e-69: tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)) elif b <= 1.05e-152: tmp = (math.sqrt((c * (a * -3.0))) / a) * 0.3333333333333333 else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7.8e-69) tmp = Float64(Float64(0.5 * Float64(c / b)) + Float64(-0.6666666666666666 * Float64(b / a))); elseif (b <= 1.05e-152) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) / a) * 0.3333333333333333); 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.8e-69) tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)); elseif (b <= 1.05e-152) tmp = (sqrt((c * (a * -3.0))) / a) * 0.3333333333333333; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7.8e-69], N[(N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.05e-152], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.8 \cdot 10^{-69}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} + -0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq 1.05 \cdot 10^{-152}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)}}{a} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -7.79999999999999961e-69Initial program 71.6%
Taylor expanded in b around -inf 88.7%
if -7.79999999999999961e-69 < b < 1.04999999999999999e-152Initial program 79.4%
associate-*l*79.3%
prod-diff79.0%
*-commutative79.0%
associate-*l*79.0%
*-commutative79.0%
distribute-rgt-neg-in79.0%
*-commutative79.0%
distribute-rgt-neg-in79.0%
metadata-eval79.0%
*-commutative79.0%
associate-*l*79.0%
*-commutative79.0%
associate-*l*78.9%
Applied egg-rr78.9%
Taylor expanded in b around 0 69.7%
associate-*l/69.7%
distribute-rgt-out70.0%
*-commutative70.0%
metadata-eval70.0%
associate-*r*70.1%
*-lft-identity70.1%
Simplified70.1%
if 1.04999999999999999e-152 < b Initial program 22.9%
Taylor expanded in b around inf 64.8%
associate-/l*71.3%
associate-/r/65.0%
Simplified65.0%
Taylor expanded in a around 0 82.7%
associate-*r/82.8%
Simplified82.8%
Final simplification82.1%
(FPCore (a b c)
:precision binary64
(if (<= b -6e-67)
(+ (* 0.5 (/ c b)) (* -0.6666666666666666 (/ b a)))
(if (<= b 1.05e-152)
(/ (sqrt (* a (* c -3.0))) (* 3.0 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6e-67) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else if (b <= 1.05e-152) {
tmp = sqrt((a * (c * -3.0))) / (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 <= (-6d-67)) then
tmp = (0.5d0 * (c / b)) + ((-0.6666666666666666d0) * (b / a))
else if (b <= 1.05d-152) then
tmp = sqrt((a * (c * (-3.0d0)))) / (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 <= -6e-67) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else if (b <= 1.05e-152) {
tmp = Math.sqrt((a * (c * -3.0))) / (3.0 * a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6e-67: tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)) elif b <= 1.05e-152: tmp = math.sqrt((a * (c * -3.0))) / (3.0 * a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6e-67) tmp = Float64(Float64(0.5 * Float64(c / b)) + Float64(-0.6666666666666666 * Float64(b / a))); elseif (b <= 1.05e-152) tmp = Float64(sqrt(Float64(a * Float64(c * -3.0))) / Float64(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 <= -6e-67) tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)); elseif (b <= 1.05e-152) tmp = sqrt((a * (c * -3.0))) / (3.0 * a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6e-67], N[(N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.05e-152], N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6 \cdot 10^{-67}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} + -0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq 1.05 \cdot 10^{-152}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -6.00000000000000065e-67Initial program 71.6%
Taylor expanded in b around -inf 88.7%
if -6.00000000000000065e-67 < b < 1.04999999999999999e-152Initial program 79.4%
prod-diff79.0%
distribute-rgt-neg-in79.0%
*-commutative79.0%
distribute-rgt-neg-in79.0%
metadata-eval79.0%
*-commutative79.0%
fma-undefine79.0%
distribute-lft-neg-in79.0%
distribute-rgt-neg-in79.0%
*-commutative79.0%
distribute-rgt-neg-in79.0%
metadata-eval79.0%
*-commutative79.0%
associate-*l*78.9%
Applied egg-rr78.9%
Taylor expanded in b around 0 69.7%
metadata-eval69.7%
associate-*l/69.7%
distribute-rgt-out70.0%
*-commutative70.0%
metadata-eval70.0%
associate-*r*70.1%
*-lft-identity70.1%
times-frac70.1%
*-lft-identity70.1%
*-commutative70.1%
associate-*r*70.1%
*-commutative70.1%
associate-*r*70.1%
Simplified70.1%
if 1.04999999999999999e-152 < b Initial program 22.9%
Taylor expanded in b around inf 64.8%
associate-/l*71.3%
associate-/r/65.0%
Simplified65.0%
Taylor expanded in a around 0 82.7%
associate-*r/82.8%
Simplified82.8%
Final simplification82.1%
(FPCore (a b c)
:precision binary64
(if (<= b -1.12e-66)
(fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
(if (<= b 1.05e-152)
(/ (sqrt (* a (* c -3.0))) (* 3.0 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.12e-66) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else if (b <= 1.05e-152) {
tmp = sqrt((a * (c * -3.0))) / (3.0 * a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -1.12e-66) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); elseif (b <= 1.05e-152) tmp = Float64(sqrt(Float64(a * Float64(c * -3.0))) / Float64(3.0 * a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -1.12e-66], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.05e-152], N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.12 \cdot 10^{-66}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 1.05 \cdot 10^{-152}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.12000000000000004e-66Initial program 71.6%
Taylor expanded in b around -inf 88.7%
fma-define88.8%
Simplified88.8%
if -1.12000000000000004e-66 < b < 1.04999999999999999e-152Initial program 79.4%
prod-diff79.0%
distribute-rgt-neg-in79.0%
*-commutative79.0%
distribute-rgt-neg-in79.0%
metadata-eval79.0%
*-commutative79.0%
fma-undefine79.0%
distribute-lft-neg-in79.0%
distribute-rgt-neg-in79.0%
*-commutative79.0%
distribute-rgt-neg-in79.0%
metadata-eval79.0%
*-commutative79.0%
associate-*l*78.9%
Applied egg-rr78.9%
Taylor expanded in b around 0 69.7%
metadata-eval69.7%
associate-*l/69.7%
distribute-rgt-out70.0%
*-commutative70.0%
metadata-eval70.0%
associate-*r*70.1%
*-lft-identity70.1%
times-frac70.1%
*-lft-identity70.1%
*-commutative70.1%
associate-*r*70.1%
*-commutative70.1%
associate-*r*70.1%
Simplified70.1%
if 1.04999999999999999e-152 < b Initial program 22.9%
Taylor expanded in b around inf 64.8%
associate-/l*71.3%
associate-/r/65.0%
Simplified65.0%
Taylor expanded in a around 0 82.7%
associate-*r/82.8%
Simplified82.8%
Final simplification82.1%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (+ (* 0.5 (/ c b)) (* -0.6666666666666666 (/ b a))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-310)) then
tmp = (0.5d0 * (c / b)) + ((-0.6666666666666666d0) * (b / a))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(0.5 * Float64(c / b)) + Float64(-0.6666666666666666 * Float64(b / a))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} + -0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 74.4%
Taylor expanded in b around -inf 71.2%
if -4.999999999999985e-310 < b Initial program 31.1%
Taylor expanded in b around inf 55.4%
associate-/l*60.9%
associate-/r/55.5%
Simplified55.5%
Taylor expanded in a around 0 71.3%
associate-*r/71.3%
Simplified71.3%
Final simplification71.2%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (/ (* b -2.0) (* 3.0 a)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (b * -2.0) / (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 <= (-5d-310)) then
tmp = (b * (-2.0d0)) / (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 <= -5e-310) {
tmp = (b * -2.0) / (3.0 * a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = (b * -2.0) / (3.0 * a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(b * -2.0) / Float64(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 <= -5e-310) tmp = (b * -2.0) / (3.0 * a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 74.4%
Taylor expanded in b around -inf 70.7%
*-commutative70.7%
Simplified70.7%
if -4.999999999999985e-310 < b Initial program 31.1%
Taylor expanded in b around inf 55.4%
associate-/l*60.9%
associate-/r/55.5%
Simplified55.5%
Taylor expanded in a around 0 71.3%
associate-*r/71.3%
Simplified71.3%
Final simplification71.0%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (* -0.6666666666666666 (/ b a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-310)) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = -0.6666666666666666 * (b / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = -0.6666666666666666 * (b / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 74.4%
Taylor expanded in b around -inf 70.7%
*-commutative70.7%
Simplified70.7%
if -4.999999999999985e-310 < b Initial program 31.1%
Taylor expanded in b around inf 71.3%
Final simplification71.0%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (* -0.6666666666666666 (/ b a)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-310)) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = -0.6666666666666666 * (b / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = -0.6666666666666666 * (b / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 74.4%
Taylor expanded in b around -inf 70.7%
*-commutative70.7%
Simplified70.7%
if -4.999999999999985e-310 < b Initial program 31.1%
Taylor expanded in b around inf 55.4%
associate-/l*60.9%
associate-/r/55.5%
Simplified55.5%
Taylor expanded in a around 0 71.3%
associate-*r/71.3%
Simplified71.3%
Final simplification71.0%
(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 52.8%
Taylor expanded in b around inf 36.7%
Final simplification36.7%
herbie shell --seed 2024039
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))