
(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 12 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 -31500000000.0)
(/ b (/ a -0.6666666666666666))
(if (<= b 1.75e-72)
(*
-0.3333333333333333
(/ 1.0 (/ a (- b (hypot b (sqrt (* c (* a -3.0))))))))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -31500000000.0) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 1.75e-72) {
tmp = -0.3333333333333333 * (1.0 / (a / (b - hypot(b, sqrt((c * (a * -3.0)))))));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
public static double code(double a, double b, double c) {
double tmp;
if (b <= -31500000000.0) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 1.75e-72) {
tmp = -0.3333333333333333 * (1.0 / (a / (b - Math.hypot(b, Math.sqrt((c * (a * -3.0)))))));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -31500000000.0: tmp = b / (a / -0.6666666666666666) elif b <= 1.75e-72: tmp = -0.3333333333333333 * (1.0 / (a / (b - math.hypot(b, math.sqrt((c * (a * -3.0))))))) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -31500000000.0) tmp = Float64(b / Float64(a / -0.6666666666666666)); elseif (b <= 1.75e-72) tmp = Float64(-0.3333333333333333 * Float64(1.0 / Float64(a / Float64(b - hypot(b, sqrt(Float64(c * 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 <= -31500000000.0) tmp = b / (a / -0.6666666666666666); elseif (b <= 1.75e-72) tmp = -0.3333333333333333 * (1.0 / (a / (b - hypot(b, sqrt((c * (a * -3.0))))))); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -31500000000.0], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.75e-72], N[(-0.3333333333333333 * N[(1.0 / N[(a / N[(b - N[Sqrt[b ^ 2 + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -31500000000:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{elif}\;b \leq 1.75 \cdot 10^{-72}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{1}{\frac{a}{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -3.15e10Initial program 62.7%
neg-sub062.7%
associate-+l-62.7%
sub0-neg62.7%
neg-mul-162.7%
associate-*r/62.7%
*-commutative62.7%
metadata-eval62.7%
metadata-eval62.7%
times-frac62.7%
*-commutative62.7%
times-frac62.7%
Simplified62.6%
Taylor expanded in b around -inf 95.8%
*-commutative95.8%
Simplified95.8%
Taylor expanded in b around 0 95.8%
*-commutative95.8%
associate-/r/95.9%
Simplified95.9%
if -3.15e10 < b < 1.75e-72Initial program 75.1%
/-rgt-identity75.1%
metadata-eval75.1%
associate-/l*75.1%
associate-*r/75.0%
*-commutative75.0%
associate-*l/75.1%
associate-*r/75.1%
metadata-eval75.1%
metadata-eval75.1%
times-frac75.1%
neg-mul-175.1%
distribute-rgt-neg-in75.1%
times-frac74.9%
metadata-eval74.9%
neg-mul-174.9%
Simplified74.9%
clear-num74.9%
inv-pow74.9%
fma-udef74.9%
add-sqr-sqrt72.5%
hypot-def77.5%
Applied egg-rr77.5%
unpow-177.5%
associate-*r*77.4%
*-commutative77.4%
associate-*r*77.5%
metadata-eval77.5%
distribute-lft-neg-in77.5%
*-commutative77.5%
*-commutative77.5%
distribute-rgt-neg-in77.5%
metadata-eval77.5%
Simplified77.5%
if 1.75e-72 < b Initial program 9.9%
neg-sub09.9%
associate-+l-9.9%
sub0-neg9.9%
neg-mul-19.9%
associate-*r/9.9%
*-commutative9.9%
metadata-eval9.9%
metadata-eval9.9%
times-frac9.9%
*-commutative9.9%
times-frac9.9%
Simplified9.9%
Taylor expanded in b around inf 87.1%
Final simplification86.6%
(FPCore (a b c)
:precision binary64
(if (<= b -5.8e+19)
(/ b (/ a -0.6666666666666666))
(if (<= b 2.2e-73)
(*
-0.3333333333333333
(- (/ b a) (/ (hypot b (sqrt (* a (* c -3.0)))) a)))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5.8e+19) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 2.2e-73) {
tmp = -0.3333333333333333 * ((b / a) - (hypot(b, sqrt((a * (c * -3.0)))) / a));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5.8e+19) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 2.2e-73) {
tmp = -0.3333333333333333 * ((b / a) - (Math.hypot(b, Math.sqrt((a * (c * -3.0)))) / a));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5.8e+19: tmp = b / (a / -0.6666666666666666) elif b <= 2.2e-73: tmp = -0.3333333333333333 * ((b / a) - (math.hypot(b, math.sqrt((a * (c * -3.0)))) / a)) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5.8e+19) tmp = Float64(b / Float64(a / -0.6666666666666666)); elseif (b <= 2.2e-73) tmp = Float64(-0.3333333333333333 * Float64(Float64(b / a) - Float64(hypot(b, sqrt(Float64(a * Float64(c * -3.0)))) / 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.8e+19) tmp = b / (a / -0.6666666666666666); elseif (b <= 2.2e-73) tmp = -0.3333333333333333 * ((b / a) - (hypot(b, sqrt((a * (c * -3.0)))) / a)); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5.8e+19], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.2e-73], N[(-0.3333333333333333 * N[(N[(b / a), $MachinePrecision] - N[(N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.8 \cdot 10^{+19}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{elif}\;b \leq 2.2 \cdot 10^{-73}:\\
\;\;\;\;-0.3333333333333333 \cdot \left(\frac{b}{a} - \frac{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -5.8e19Initial program 62.1%
neg-sub062.1%
associate-+l-62.1%
sub0-neg62.1%
neg-mul-162.1%
associate-*r/62.1%
*-commutative62.1%
metadata-eval62.1%
metadata-eval62.1%
times-frac62.1%
*-commutative62.1%
times-frac62.1%
Simplified62.1%
Taylor expanded in b around -inf 95.7%
*-commutative95.7%
Simplified95.7%
Taylor expanded in b around 0 95.7%
*-commutative95.7%
associate-/r/95.8%
Simplified95.8%
if -5.8e19 < b < 2.2e-73Initial program 75.4%
/-rgt-identity75.4%
metadata-eval75.4%
associate-/l*75.4%
associate-*r/75.3%
*-commutative75.3%
associate-*l/75.4%
associate-*r/75.4%
metadata-eval75.4%
metadata-eval75.4%
times-frac75.4%
neg-mul-175.4%
distribute-rgt-neg-in75.4%
times-frac75.2%
metadata-eval75.2%
neg-mul-175.2%
Simplified75.2%
div-sub75.1%
fma-udef75.1%
add-sqr-sqrt72.7%
hypot-def77.7%
Applied egg-rr77.7%
if 2.2e-73 < b Initial program 9.9%
neg-sub09.9%
associate-+l-9.9%
sub0-neg9.9%
neg-mul-19.9%
associate-*r/9.9%
*-commutative9.9%
metadata-eval9.9%
metadata-eval9.9%
times-frac9.9%
*-commutative9.9%
times-frac9.9%
Simplified9.9%
Taylor expanded in b around inf 87.1%
Final simplification86.5%
(FPCore (a b c)
:precision binary64
(if (<= b -1.45e+53)
(/ b (/ a -0.6666666666666666))
(if (<= b 5.4e-73)
(* (- (sqrt (+ (* a (* c -3.0)) (* b b))) b) (/ 0.3333333333333333 a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.45e+53) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 5.4e-73) {
tmp = (sqrt(((a * (c * -3.0)) + (b * b))) - b) * (0.3333333333333333 / 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 <= (-1.45d+53)) then
tmp = b / (a / (-0.6666666666666666d0))
else if (b <= 5.4d-73) then
tmp = (sqrt(((a * (c * (-3.0d0))) + (b * b))) - b) * (0.3333333333333333d0 / 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 <= -1.45e+53) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 5.4e-73) {
tmp = (Math.sqrt(((a * (c * -3.0)) + (b * b))) - b) * (0.3333333333333333 / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.45e+53: tmp = b / (a / -0.6666666666666666) elif b <= 5.4e-73: tmp = (math.sqrt(((a * (c * -3.0)) + (b * b))) - b) * (0.3333333333333333 / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.45e+53) tmp = Float64(b / Float64(a / -0.6666666666666666)); elseif (b <= 5.4e-73) tmp = Float64(Float64(sqrt(Float64(Float64(a * Float64(c * -3.0)) + Float64(b * b))) - b) * Float64(0.3333333333333333 / 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 <= -1.45e+53) tmp = b / (a / -0.6666666666666666); elseif (b <= 5.4e-73) tmp = (sqrt(((a * (c * -3.0)) + (b * b))) - b) * (0.3333333333333333 / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.45e+53], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.4e-73], N[(N[(N[Sqrt[N[(N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.45 \cdot 10^{+53}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{elif}\;b \leq 5.4 \cdot 10^{-73}:\\
\;\;\;\;\left(\sqrt{a \cdot \left(c \cdot -3\right) + b \cdot b} - b\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.4500000000000001e53Initial program 58.2%
neg-sub058.2%
associate-+l-58.2%
sub0-neg58.2%
neg-mul-158.2%
associate-*r/58.2%
*-commutative58.2%
metadata-eval58.2%
metadata-eval58.2%
times-frac58.2%
*-commutative58.2%
times-frac58.2%
Simplified58.2%
Taylor expanded in b around -inf 96.8%
*-commutative96.8%
Simplified96.8%
Taylor expanded in b around 0 96.8%
*-commutative96.8%
associate-/r/96.8%
Simplified96.8%
if -1.4500000000000001e53 < b < 5.39999999999999989e-73Initial program 77.2%
neg-sub077.2%
associate-+l-77.2%
sub0-neg77.2%
neg-mul-177.2%
associate-*r/77.2%
*-commutative77.2%
metadata-eval77.2%
metadata-eval77.2%
times-frac77.2%
*-commutative77.2%
times-frac77.2%
Simplified77.0%
fma-udef77.0%
Applied egg-rr77.0%
if 5.39999999999999989e-73 < b Initial program 9.9%
neg-sub09.9%
associate-+l-9.9%
sub0-neg9.9%
neg-mul-19.9%
associate-*r/9.9%
*-commutative9.9%
metadata-eval9.9%
metadata-eval9.9%
times-frac9.9%
*-commutative9.9%
times-frac9.9%
Simplified9.9%
Taylor expanded in b around inf 87.1%
Final simplification86.0%
(FPCore (a b c)
:precision binary64
(if (<= b -2.6e+55)
(/ b (/ a -0.6666666666666666))
(if (<= b 2.8e-74)
(/ (- (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 <= -2.6e+55) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 2.8e-74) {
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 <= (-2.6d+55)) then
tmp = b / (a / (-0.6666666666666666d0))
else if (b <= 2.8d-74) 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 <= -2.6e+55) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 2.8e-74) {
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 <= -2.6e+55: tmp = b / (a / -0.6666666666666666) elif b <= 2.8e-74: 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 <= -2.6e+55) tmp = Float64(b / Float64(a / -0.6666666666666666)); elseif (b <= 2.8e-74) 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 <= -2.6e+55) tmp = b / (a / -0.6666666666666666); elseif (b <= 2.8e-74) 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, -2.6e+55], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.8e-74], 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 -2.6 \cdot 10^{+55}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{elif}\;b \leq 2.8 \cdot 10^{-74}:\\
\;\;\;\;\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 < -2.6e55Initial program 57.5%
neg-sub057.5%
associate-+l-57.5%
sub0-neg57.5%
neg-mul-157.5%
associate-*r/57.5%
*-commutative57.5%
metadata-eval57.5%
metadata-eval57.5%
times-frac57.5%
*-commutative57.5%
times-frac57.5%
Simplified57.5%
Taylor expanded in b around -inf 96.7%
*-commutative96.7%
Simplified96.7%
Taylor expanded in b around 0 96.7%
*-commutative96.7%
associate-/r/96.8%
Simplified96.8%
if -2.6e55 < b < 2.79999999999999988e-74Initial program 77.5%
neg-sub077.5%
associate-+l-77.5%
sub0-neg77.5%
neg-mul-177.5%
associate-*r/77.5%
metadata-eval77.5%
metadata-eval77.5%
times-frac77.5%
*-commutative77.5%
times-frac77.4%
associate-*l/77.5%
Simplified77.4%
if 2.79999999999999988e-74 < b Initial program 9.9%
neg-sub09.9%
associate-+l-9.9%
sub0-neg9.9%
neg-mul-19.9%
associate-*r/9.9%
*-commutative9.9%
metadata-eval9.9%
metadata-eval9.9%
times-frac9.9%
*-commutative9.9%
times-frac9.9%
Simplified9.9%
Taylor expanded in b around inf 87.1%
Final simplification86.1%
(FPCore (a b c)
:precision binary64
(if (<= b -2.6e+55)
(/ b (/ a -0.6666666666666666))
(if (<= b 1.8e-79)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.6e+55) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 1.8e-79) {
tmp = (sqrt(((b * b) - (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 <= (-2.6d+55)) then
tmp = b / (a / (-0.6666666666666666d0))
else if (b <= 1.8d-79) then
tmp = (sqrt(((b * b) - (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 <= -2.6e+55) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 1.8e-79) {
tmp = (Math.sqrt(((b * b) - (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 <= -2.6e+55: tmp = b / (a / -0.6666666666666666) elif b <= 1.8e-79: tmp = (math.sqrt(((b * b) - (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 <= -2.6e+55) tmp = Float64(b / Float64(a / -0.6666666666666666)); elseif (b <= 1.8e-79) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - 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 <= -2.6e+55) tmp = b / (a / -0.6666666666666666); elseif (b <= 1.8e-79) tmp = (sqrt(((b * b) - (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, -2.6e+55], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.8e-79], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.6 \cdot 10^{+55}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{elif}\;b \leq 1.8 \cdot 10^{-79}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 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 < -2.6e55Initial program 57.5%
neg-sub057.5%
associate-+l-57.5%
sub0-neg57.5%
neg-mul-157.5%
associate-*r/57.5%
*-commutative57.5%
metadata-eval57.5%
metadata-eval57.5%
times-frac57.5%
*-commutative57.5%
times-frac57.5%
Simplified57.5%
Taylor expanded in b around -inf 96.7%
*-commutative96.7%
Simplified96.7%
Taylor expanded in b around 0 96.7%
*-commutative96.7%
associate-/r/96.8%
Simplified96.8%
if -2.6e55 < b < 1.8000000000000001e-79Initial program 77.5%
if 1.8000000000000001e-79 < b Initial program 9.9%
neg-sub09.9%
associate-+l-9.9%
sub0-neg9.9%
neg-mul-19.9%
associate-*r/9.9%
*-commutative9.9%
metadata-eval9.9%
metadata-eval9.9%
times-frac9.9%
*-commutative9.9%
times-frac9.9%
Simplified9.9%
Taylor expanded in b around inf 87.1%
Final simplification86.1%
(FPCore (a b c)
:precision binary64
(if (<= b -1.22e-57)
(/ b (/ a -0.6666666666666666))
(if (<= b 2e-73)
(* -0.3333333333333333 (/ (- b (sqrt (* a (* c -3.0)))) a))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.22e-57) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 2e-73) {
tmp = -0.3333333333333333 * ((b - sqrt((a * (c * -3.0)))) / 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 <= (-1.22d-57)) then
tmp = b / (a / (-0.6666666666666666d0))
else if (b <= 2d-73) then
tmp = (-0.3333333333333333d0) * ((b - sqrt((a * (c * (-3.0d0))))) / 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 <= -1.22e-57) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 2e-73) {
tmp = -0.3333333333333333 * ((b - Math.sqrt((a * (c * -3.0)))) / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.22e-57: tmp = b / (a / -0.6666666666666666) elif b <= 2e-73: tmp = -0.3333333333333333 * ((b - math.sqrt((a * (c * -3.0)))) / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.22e-57) tmp = Float64(b / Float64(a / -0.6666666666666666)); elseif (b <= 2e-73) tmp = Float64(-0.3333333333333333 * Float64(Float64(b - sqrt(Float64(a * Float64(c * -3.0)))) / 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 <= -1.22e-57) tmp = b / (a / -0.6666666666666666); elseif (b <= 2e-73) tmp = -0.3333333333333333 * ((b - sqrt((a * (c * -3.0)))) / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.22e-57], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2e-73], N[(-0.3333333333333333 * N[(N[(b - N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.22 \cdot 10^{-57}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{elif}\;b \leq 2 \cdot 10^{-73}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -1.2200000000000001e-57Initial program 65.1%
neg-sub065.1%
associate-+l-65.1%
sub0-neg65.1%
neg-mul-165.1%
associate-*r/65.1%
*-commutative65.1%
metadata-eval65.1%
metadata-eval65.1%
times-frac65.1%
*-commutative65.1%
times-frac65.1%
Simplified65.0%
Taylor expanded in b around -inf 91.6%
*-commutative91.6%
Simplified91.6%
Taylor expanded in b around 0 91.6%
*-commutative91.6%
associate-/r/91.6%
Simplified91.6%
if -1.2200000000000001e-57 < b < 1.99999999999999999e-73Initial program 73.8%
/-rgt-identity73.8%
metadata-eval73.8%
associate-/l*73.8%
associate-*r/73.7%
*-commutative73.7%
associate-*l/73.8%
associate-*r/73.8%
metadata-eval73.8%
metadata-eval73.8%
times-frac73.8%
neg-mul-173.8%
distribute-rgt-neg-in73.8%
times-frac73.6%
metadata-eval73.6%
neg-mul-173.6%
Simplified73.5%
Taylor expanded in b around 0 66.5%
associate-*r*66.5%
*-commutative66.5%
*-commutative66.5%
Simplified66.5%
if 1.99999999999999999e-73 < b Initial program 9.9%
neg-sub09.9%
associate-+l-9.9%
sub0-neg9.9%
neg-mul-19.9%
associate-*r/9.9%
*-commutative9.9%
metadata-eval9.9%
metadata-eval9.9%
times-frac9.9%
*-commutative9.9%
times-frac9.9%
Simplified9.9%
Taylor expanded in b around inf 87.1%
Final simplification82.5%
(FPCore (a b c)
:precision binary64
(if (<= b -6.2e-55)
(/ b (/ a -0.6666666666666666))
(if (<= b 1.28e-73)
(* (/ 0.3333333333333333 a) (- (sqrt (* c (* a -3.0))) b))
(* -0.5 (/ c b)))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.2e-55) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 1.28e-73) {
tmp = (0.3333333333333333 / a) * (sqrt((c * (a * -3.0))) - b);
} 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-55)) then
tmp = b / (a / (-0.6666666666666666d0))
else if (b <= 1.28d-73) then
tmp = (0.3333333333333333d0 / a) * (sqrt((c * (a * (-3.0d0)))) - b)
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-55) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 1.28e-73) {
tmp = (0.3333333333333333 / a) * (Math.sqrt((c * (a * -3.0))) - b);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.2e-55: tmp = b / (a / -0.6666666666666666) elif b <= 1.28e-73: tmp = (0.3333333333333333 / a) * (math.sqrt((c * (a * -3.0))) - b) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.2e-55) tmp = Float64(b / Float64(a / -0.6666666666666666)); elseif (b <= 1.28e-73) tmp = Float64(Float64(0.3333333333333333 / a) * Float64(sqrt(Float64(c * Float64(a * -3.0))) - b)); 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-55) tmp = b / (a / -0.6666666666666666); elseif (b <= 1.28e-73) tmp = (0.3333333333333333 / a) * (sqrt((c * (a * -3.0))) - b); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.2e-55], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.28e-73], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.2 \cdot 10^{-55}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{elif}\;b \leq 1.28 \cdot 10^{-73}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(\sqrt{c \cdot \left(a \cdot -3\right)} - b\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < -6.19999999999999993e-55Initial program 65.1%
neg-sub065.1%
associate-+l-65.1%
sub0-neg65.1%
neg-mul-165.1%
associate-*r/65.1%
*-commutative65.1%
metadata-eval65.1%
metadata-eval65.1%
times-frac65.1%
*-commutative65.1%
times-frac65.1%
Simplified65.0%
Taylor expanded in b around -inf 91.6%
*-commutative91.6%
Simplified91.6%
Taylor expanded in b around 0 91.6%
*-commutative91.6%
associate-/r/91.6%
Simplified91.6%
if -6.19999999999999993e-55 < b < 1.2799999999999999e-73Initial program 73.8%
neg-sub073.8%
associate-+l-73.8%
sub0-neg73.8%
neg-mul-173.8%
associate-*r/73.8%
*-commutative73.8%
metadata-eval73.8%
metadata-eval73.8%
times-frac73.8%
*-commutative73.8%
times-frac73.7%
Simplified73.5%
Taylor expanded in b around 0 66.5%
*-commutative66.5%
associate-*r*66.5%
metadata-eval66.5%
distribute-lft-neg-in66.5%
*-commutative66.5%
*-commutative66.5%
distribute-rgt-neg-in66.5%
metadata-eval66.5%
Simplified66.5%
if 1.2799999999999999e-73 < b Initial program 9.9%
neg-sub09.9%
associate-+l-9.9%
sub0-neg9.9%
neg-mul-19.9%
associate-*r/9.9%
*-commutative9.9%
metadata-eval9.9%
metadata-eval9.9%
times-frac9.9%
*-commutative9.9%
times-frac9.9%
Simplified9.9%
Taylor expanded in b around inf 87.1%
Final simplification82.5%
(FPCore (a b c)
:precision binary64
(if (<= b -6.8e-56)
(/ b (/ a -0.6666666666666666))
(if (<= b 4.4e-76)
(/ (- (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.8e-56) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 4.4e-76) {
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.8d-56)) then
tmp = b / (a / (-0.6666666666666666d0))
else if (b <= 4.4d-76) 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.8e-56) {
tmp = b / (a / -0.6666666666666666);
} else if (b <= 4.4e-76) {
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.8e-56: tmp = b / (a / -0.6666666666666666) elif b <= 4.4e-76: 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.8e-56) tmp = Float64(b / Float64(a / -0.6666666666666666)); elseif (b <= 4.4e-76) 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.8e-56) tmp = b / (a / -0.6666666666666666); elseif (b <= 4.4e-76) 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.8e-56], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.4e-76], 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.8 \cdot 10^{-56}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{elif}\;b \leq 4.4 \cdot 10^{-76}:\\
\;\;\;\;\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.79999999999999964e-56Initial program 65.1%
neg-sub065.1%
associate-+l-65.1%
sub0-neg65.1%
neg-mul-165.1%
associate-*r/65.1%
*-commutative65.1%
metadata-eval65.1%
metadata-eval65.1%
times-frac65.1%
*-commutative65.1%
times-frac65.1%
Simplified65.0%
Taylor expanded in b around -inf 91.6%
*-commutative91.6%
Simplified91.6%
Taylor expanded in b around 0 91.6%
*-commutative91.6%
associate-/r/91.6%
Simplified91.6%
if -6.79999999999999964e-56 < b < 4.39999999999999999e-76Initial program 73.8%
neg-sub073.8%
associate-+l-73.8%
sub0-neg73.8%
neg-mul-173.8%
associate-*r/73.8%
*-commutative73.8%
metadata-eval73.8%
metadata-eval73.8%
times-frac73.8%
*-commutative73.8%
times-frac73.7%
Simplified73.5%
Taylor expanded in b around 0 66.5%
*-commutative66.5%
associate-*r*66.5%
metadata-eval66.5%
distribute-lft-neg-in66.5%
*-commutative66.5%
*-commutative66.5%
distribute-rgt-neg-in66.5%
metadata-eval66.5%
Simplified66.5%
*-commutative66.5%
sqrt-prod40.7%
Applied egg-rr40.7%
clear-num40.7%
inv-pow40.7%
Applied egg-rr40.7%
unpow-140.7%
Simplified40.7%
un-div-inv40.8%
sqrt-unprod66.6%
div-inv66.7%
metadata-eval66.7%
Applied egg-rr66.7%
if 4.39999999999999999e-76 < b Initial program 9.9%
neg-sub09.9%
associate-+l-9.9%
sub0-neg9.9%
neg-mul-19.9%
associate-*r/9.9%
*-commutative9.9%
metadata-eval9.9%
metadata-eval9.9%
times-frac9.9%
*-commutative9.9%
times-frac9.9%
Simplified9.9%
Taylor expanded in b around inf 87.1%
Final simplification82.6%
(FPCore (a b c) :precision binary64 (if (<= b -5e-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 <= -5e-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 <= (-5d-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 <= -5e-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 <= -5e-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 <= -5e-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 <= -5e-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, -5e-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 -5 \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 < -4.999999999999985e-310Initial program 69.7%
neg-sub069.7%
associate-+l-69.7%
sub0-neg69.7%
neg-mul-169.7%
associate-*r/69.7%
*-commutative69.7%
metadata-eval69.7%
metadata-eval69.7%
times-frac69.7%
*-commutative69.7%
times-frac69.7%
Simplified69.5%
Taylor expanded in b around -inf 69.3%
if -4.999999999999985e-310 < b Initial program 23.2%
neg-sub023.2%
associate-+l-23.2%
sub0-neg23.2%
neg-mul-123.2%
associate-*r/23.2%
*-commutative23.2%
metadata-eval23.2%
metadata-eval23.2%
times-frac23.2%
*-commutative23.2%
times-frac23.3%
Simplified23.2%
Taylor expanded in b around inf 71.6%
Final simplification70.5%
(FPCore (a b c) :precision binary64 (if (<= b 2.3e-254) (* -0.6666666666666666 (/ b a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.3e-254) {
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 <= 2.3d-254) 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 <= 2.3e-254) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.3e-254: tmp = -0.6666666666666666 * (b / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.3e-254) 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 <= 2.3e-254) tmp = -0.6666666666666666 * (b / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.3e-254], 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.3 \cdot 10^{-254}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 2.2999999999999999e-254Initial program 70.6%
neg-sub070.6%
associate-+l-70.6%
sub0-neg70.6%
neg-mul-170.6%
associate-*r/70.6%
*-commutative70.6%
metadata-eval70.6%
metadata-eval70.6%
times-frac70.6%
*-commutative70.6%
times-frac70.5%
Simplified70.4%
Taylor expanded in b around -inf 65.6%
*-commutative65.6%
Simplified65.6%
if 2.2999999999999999e-254 < b Initial program 19.6%
neg-sub019.6%
associate-+l-19.6%
sub0-neg19.6%
neg-mul-119.6%
associate-*r/19.6%
*-commutative19.6%
metadata-eval19.6%
metadata-eval19.6%
times-frac19.6%
*-commutative19.6%
times-frac19.7%
Simplified19.6%
Taylor expanded in b around inf 75.5%
Final simplification70.3%
(FPCore (a b c) :precision binary64 (if (<= b 2.3e-254) (/ b (/ a -0.6666666666666666)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 2.3e-254) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 2.3d-254) then
tmp = b / (a / (-0.6666666666666666d0))
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 2.3e-254) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2.3e-254: tmp = b / (a / -0.6666666666666666) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2.3e-254) tmp = Float64(b / Float64(a / -0.6666666666666666)); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 2.3e-254) tmp = b / (a / -0.6666666666666666); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2.3e-254], N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.3 \cdot 10^{-254}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 2.2999999999999999e-254Initial program 70.6%
neg-sub070.6%
associate-+l-70.6%
sub0-neg70.6%
neg-mul-170.6%
associate-*r/70.6%
*-commutative70.6%
metadata-eval70.6%
metadata-eval70.6%
times-frac70.6%
*-commutative70.6%
times-frac70.5%
Simplified70.4%
Taylor expanded in b around -inf 65.6%
*-commutative65.6%
Simplified65.6%
Taylor expanded in b around 0 65.6%
*-commutative65.6%
associate-/r/65.6%
Simplified65.6%
if 2.2999999999999999e-254 < b Initial program 19.6%
neg-sub019.6%
associate-+l-19.6%
sub0-neg19.6%
neg-mul-119.6%
associate-*r/19.6%
*-commutative19.6%
metadata-eval19.6%
metadata-eval19.6%
times-frac19.6%
*-commutative19.6%
times-frac19.7%
Simplified19.6%
Taylor expanded in b around inf 75.5%
Final simplification70.3%
(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 46.3%
neg-sub046.3%
associate-+l-46.3%
sub0-neg46.3%
neg-mul-146.3%
associate-*r/46.3%
*-commutative46.3%
metadata-eval46.3%
metadata-eval46.3%
times-frac46.3%
*-commutative46.3%
times-frac46.3%
Simplified46.2%
Taylor expanded in b around inf 37.2%
Final simplification37.2%
herbie shell --seed 2023215
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))