
(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 -1e+151)
(/ (* b -2.0) (* 3.0 a))
(if (<= b 2.05e-47)
(/ (- (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 <= -1e+151) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 2.05e-47) {
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 <= (-1d+151)) then
tmp = (b * (-2.0d0)) / (3.0d0 * a)
else if (b <= 2.05d-47) 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 <= -1e+151) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 2.05e-47) {
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 <= -1e+151: tmp = (b * -2.0) / (3.0 * a) elif b <= 2.05e-47: 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 <= -1e+151) tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a)); elseif (b <= 2.05e-47) 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 <= -1e+151) tmp = (b * -2.0) / (3.0 * a); elseif (b <= 2.05e-47) 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, -1e+151], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.05e-47], 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 -1 \cdot 10^{+151}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq 2.05 \cdot 10^{-47}:\\
\;\;\;\;\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 < -1.00000000000000002e151Initial program 39.7%
sqr-neg39.7%
sqr-neg39.7%
associate-*l*39.7%
Simplified39.7%
Taylor expanded in b around -inf 99.8%
*-commutative99.8%
Simplified99.8%
if -1.00000000000000002e151 < b < 2.05000000000000001e-47Initial program 88.7%
if 2.05000000000000001e-47 < b Initial program 18.6%
neg-sub018.6%
sqr-neg18.6%
associate-+l-18.6%
sub0-neg18.6%
neg-mul-118.6%
Simplified18.6%
associate-*r*18.6%
metadata-eval18.6%
distribute-rgt-neg-in18.6%
*-commutative18.6%
fma-neg18.6%
associate-*r*18.6%
*-commutative18.6%
associate-*l*18.6%
Applied egg-rr18.6%
Taylor expanded in b around inf 85.0%
associate-*r/85.0%
*-commutative85.0%
Simplified85.0%
Final simplification89.0%
(FPCore (a b c)
:precision binary64
(if (<= b -3.4e+107)
(+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
(if (<= b 2.7e-47)
(* (/ (- (sqrt (- (* b b) (* a (* 3.0 c)))) b) a) 0.3333333333333333)
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.4e+107) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 2.7e-47) {
tmp = ((sqrt(((b * b) - (a * (3.0 * c)))) - b) / 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 <= (-3.4d+107)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
else if (b <= 2.7d-47) then
tmp = ((sqrt(((b * b) - (a * (3.0d0 * c)))) - b) / 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 <= -3.4e+107) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 2.7e-47) {
tmp = ((Math.sqrt(((b * b) - (a * (3.0 * c)))) - b) / a) * 0.3333333333333333;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.4e+107: tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)) elif b <= 2.7e-47: tmp = ((math.sqrt(((b * b) - (a * (3.0 * c)))) - b) / a) * 0.3333333333333333 else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.4e+107) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); elseif (b <= 2.7e-47) tmp = Float64(Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(a * Float64(3.0 * c)))) - b) / 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 <= -3.4e+107) tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)); elseif (b <= 2.7e-47) tmp = ((sqrt(((b * b) - (a * (3.0 * c)))) - b) / a) * 0.3333333333333333; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.4e+107], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.7e-47], N[(N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(a * N[(3.0 * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.4 \cdot 10^{+107}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 2.7 \cdot 10^{-47}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} - b}{a} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3.3999999999999997e107Initial program 51.2%
sqr-neg51.2%
sqr-neg51.2%
associate-*l*51.2%
Simplified51.2%
Taylor expanded in b around -inf 99.5%
associate-*r/99.7%
Applied egg-rr99.7%
if -3.3999999999999997e107 < b < 2.6999999999999998e-47Initial program 87.9%
neg-sub087.9%
sqr-neg87.9%
associate-+l-87.9%
sub0-neg87.9%
neg-mul-187.9%
Simplified87.7%
associate-*r*87.7%
metadata-eval87.7%
distribute-rgt-neg-in87.7%
*-commutative87.7%
fma-neg87.7%
associate-*r*87.7%
*-commutative87.7%
associate-*l*87.7%
Applied egg-rr87.7%
associate-/r/87.8%
Applied egg-rr87.8%
if 2.6999999999999998e-47 < b Initial program 18.6%
neg-sub018.6%
sqr-neg18.6%
associate-+l-18.6%
sub0-neg18.6%
neg-mul-118.6%
Simplified18.6%
associate-*r*18.6%
metadata-eval18.6%
distribute-rgt-neg-in18.6%
*-commutative18.6%
fma-neg18.6%
associate-*r*18.6%
*-commutative18.6%
associate-*l*18.6%
Applied egg-rr18.6%
Taylor expanded in b around inf 85.0%
associate-*r/85.0%
*-commutative85.0%
Simplified85.0%
Final simplification88.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2e+154)
(/ (* b -2.0) (* 3.0 a))
(if (<= b 2.4e-46)
(/ (- (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 <= -2e+154) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 2.4e-46) {
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 <= (-2d+154)) then
tmp = (b * (-2.0d0)) / (3.0d0 * a)
else if (b <= 2.4d-46) 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 <= -2e+154) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 2.4e-46) {
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 <= -2e+154: tmp = (b * -2.0) / (3.0 * a) elif b <= 2.4e-46: 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 <= -2e+154) tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a)); elseif (b <= 2.4e-46) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(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 <= -2e+154) tmp = (b * -2.0) / (3.0 * a); elseif (b <= 2.4e-46) 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, -2e+154], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.4e-46], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $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 -2 \cdot 10^{+154}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq 2.4 \cdot 10^{-46}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 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 < -2.00000000000000007e154Initial program 39.7%
sqr-neg39.7%
sqr-neg39.7%
associate-*l*39.7%
Simplified39.7%
Taylor expanded in b around -inf 99.8%
*-commutative99.8%
Simplified99.8%
if -2.00000000000000007e154 < b < 2.40000000000000013e-46Initial program 88.7%
sqr-neg88.7%
sqr-neg88.7%
associate-*l*88.7%
Simplified88.7%
if 2.40000000000000013e-46 < b Initial program 18.6%
neg-sub018.6%
sqr-neg18.6%
associate-+l-18.6%
sub0-neg18.6%
neg-mul-118.6%
Simplified18.6%
associate-*r*18.6%
metadata-eval18.6%
distribute-rgt-neg-in18.6%
*-commutative18.6%
fma-neg18.6%
associate-*r*18.6%
*-commutative18.6%
associate-*l*18.6%
Applied egg-rr18.6%
Taylor expanded in b around inf 85.0%
associate-*r/85.0%
*-commutative85.0%
Simplified85.0%
Final simplification89.0%
(FPCore (a b c)
:precision binary64
(if (<= b -3500.0)
(+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
(if (<= b 1.15e-46)
(* (- (sqrt (* c (* a -3.0))) b) (/ 0.3333333333333333 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3500.0) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 1.15e-46) {
tmp = (sqrt((c * (a * -3.0))) - b) * (0.3333333333333333 / 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 <= (-3500.0d0)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
else if (b <= 1.15d-46) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) * (0.3333333333333333d0 / 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 <= -3500.0) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 1.15e-46) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) * (0.3333333333333333 / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3500.0: tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)) elif b <= 1.15e-46: tmp = (math.sqrt((c * (a * -3.0))) - b) * (0.3333333333333333 / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3500.0) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); elseif (b <= 1.15e-46) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) * Float64(0.3333333333333333 / 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 <= -3500.0) tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)); elseif (b <= 1.15e-46) tmp = (sqrt((c * (a * -3.0))) - b) * (0.3333333333333333 / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3500.0], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.15e-46], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3500:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.15 \cdot 10^{-46}:\\
\;\;\;\;\left(\sqrt{c \cdot \left(a \cdot -3\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3500Initial program 66.7%
sqr-neg66.7%
sqr-neg66.7%
associate-*l*66.7%
Simplified66.7%
Taylor expanded in b around -inf 95.6%
associate-*r/95.7%
Applied egg-rr95.7%
if -3500 < b < 1.15e-46Initial program 85.6%
neg-sub085.6%
sqr-neg85.6%
associate-+l-85.6%
sub0-neg85.6%
neg-mul-185.6%
Simplified85.4%
associate-*r*85.4%
metadata-eval85.4%
distribute-rgt-neg-in85.4%
*-commutative85.4%
fma-neg85.4%
associate-*r*85.4%
*-commutative85.4%
associate-*l*85.4%
Applied egg-rr85.4%
Taylor expanded in b around 0 71.4%
*-commutative71.4%
*-commutative71.4%
*-commutative71.4%
associate-*l*71.4%
Simplified71.4%
expm1-log1p-u51.8%
expm1-udef22.3%
associate-/r/22.3%
Applied egg-rr22.3%
expm1-def51.8%
expm1-log1p71.4%
*-commutative71.4%
associate-*r/71.3%
associate-*l/71.4%
Simplified71.4%
if 1.15e-46 < b Initial program 18.6%
neg-sub018.6%
sqr-neg18.6%
associate-+l-18.6%
sub0-neg18.6%
neg-mul-118.6%
Simplified18.6%
associate-*r*18.6%
metadata-eval18.6%
distribute-rgt-neg-in18.6%
*-commutative18.6%
fma-neg18.6%
associate-*r*18.6%
*-commutative18.6%
associate-*l*18.6%
Applied egg-rr18.6%
Taylor expanded in b around inf 85.0%
associate-*r/85.0%
*-commutative85.0%
Simplified85.0%
Final simplification83.3%
(FPCore (a b c)
:precision binary64
(if (<= b -9500000000.0)
(+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
(if (<= b 3.7e-47)
(* 0.3333333333333333 (/ (- (sqrt (* (* a c) -3.0)) b) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -9500000000.0) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 3.7e-47) {
tmp = 0.3333333333333333 * ((sqrt(((a * c) * -3.0)) - 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 <= (-9500000000.0d0)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
else if (b <= 3.7d-47) then
tmp = 0.3333333333333333d0 * ((sqrt(((a * c) * (-3.0d0))) - 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 <= -9500000000.0) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 3.7e-47) {
tmp = 0.3333333333333333 * ((Math.sqrt(((a * c) * -3.0)) - b) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -9500000000.0: tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)) elif b <= 3.7e-47: tmp = 0.3333333333333333 * ((math.sqrt(((a * c) * -3.0)) - b) / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -9500000000.0) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); elseif (b <= 3.7e-47) tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(Float64(a * c) * -3.0)) - 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 <= -9500000000.0) tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)); elseif (b <= 3.7e-47) tmp = 0.3333333333333333 * ((sqrt(((a * c) * -3.0)) - b) / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -9500000000.0], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.7e-47], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9500000000:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 3.7 \cdot 10^{-47}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -9.5e9Initial program 66.7%
sqr-neg66.7%
sqr-neg66.7%
associate-*l*66.7%
Simplified66.7%
Taylor expanded in b around -inf 95.6%
associate-*r/95.7%
Applied egg-rr95.7%
if -9.5e9 < b < 3.7e-47Initial program 85.6%
neg-sub085.6%
sqr-neg85.6%
associate-+l-85.6%
sub0-neg85.6%
neg-mul-185.6%
Simplified85.4%
associate-*r*85.4%
metadata-eval85.4%
distribute-rgt-neg-in85.4%
*-commutative85.4%
fma-neg85.4%
associate-*r*85.4%
*-commutative85.4%
associate-*l*85.4%
Applied egg-rr85.4%
associate-/r/85.6%
Applied egg-rr85.6%
Taylor expanded in b around 0 71.4%
if 3.7e-47 < b Initial program 18.6%
neg-sub018.6%
sqr-neg18.6%
associate-+l-18.6%
sub0-neg18.6%
neg-mul-118.6%
Simplified18.6%
associate-*r*18.6%
metadata-eval18.6%
distribute-rgt-neg-in18.6%
*-commutative18.6%
fma-neg18.6%
associate-*r*18.6%
*-commutative18.6%
associate-*l*18.6%
Applied egg-rr18.6%
Taylor expanded in b around inf 85.0%
associate-*r/85.0%
*-commutative85.0%
Simplified85.0%
Final simplification83.3%
(FPCore (a b c)
:precision binary64
(if (<= b -0.15)
(+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
(if (<= b 1.75e-47)
(/ (- (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 <= -0.15) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 1.75e-47) {
tmp = (sqrt((c * (a * -3.0))) - 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 <= (-0.15d0)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
else if (b <= 1.75d-47) then
tmp = (sqrt((c * (a * (-3.0d0)))) - 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 <= -0.15) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else if (b <= 1.75e-47) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (3.0 * a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -0.15: tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)) elif b <= 1.75e-47: tmp = (math.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 <= -0.15) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); elseif (b <= 1.75e-47) 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
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -0.15) tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)); elseif (b <= 1.75e-47) tmp = (sqrt((c * (a * -3.0))) - b) / (3.0 * a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -0.15], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.75e-47], 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 -0.15:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 1.75 \cdot 10^{-47}:\\
\;\;\;\;\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 < -0.149999999999999994Initial program 66.7%
sqr-neg66.7%
sqr-neg66.7%
associate-*l*66.7%
Simplified66.7%
Taylor expanded in b around -inf 95.6%
associate-*r/95.7%
Applied egg-rr95.7%
if -0.149999999999999994 < b < 1.7499999999999999e-47Initial program 85.6%
neg-sub085.6%
sqr-neg85.6%
associate-+l-85.6%
sub0-neg85.6%
neg-mul-185.6%
Simplified85.4%
associate-*r*85.4%
metadata-eval85.4%
distribute-rgt-neg-in85.4%
*-commutative85.4%
fma-neg85.4%
associate-*r*85.4%
*-commutative85.4%
associate-*l*85.4%
Applied egg-rr85.4%
Taylor expanded in b around 0 71.4%
*-commutative71.4%
*-commutative71.4%
*-commutative71.4%
associate-*l*71.4%
Simplified71.4%
Taylor expanded in a around 0 71.5%
*-commutative71.5%
Simplified71.5%
if 1.7499999999999999e-47 < b Initial program 18.6%
neg-sub018.6%
sqr-neg18.6%
associate-+l-18.6%
sub0-neg18.6%
neg-mul-118.6%
Simplified18.6%
associate-*r*18.6%
metadata-eval18.6%
distribute-rgt-neg-in18.6%
*-commutative18.6%
fma-neg18.6%
associate-*r*18.6%
*-commutative18.6%
associate-*l*18.6%
Applied egg-rr18.6%
Taylor expanded in b around inf 85.0%
associate-*r/85.0%
*-commutative85.0%
Simplified85.0%
Final simplification83.4%
(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.9%
sqr-neg74.9%
sqr-neg74.9%
associate-*l*74.9%
Simplified74.9%
Taylor expanded in b around -inf 69.6%
if -4.999999999999985e-310 < b Initial program 36.9%
neg-sub036.9%
sqr-neg36.9%
associate-+l-36.9%
sub0-neg36.9%
neg-mul-136.9%
Simplified36.8%
associate-*r*36.8%
metadata-eval36.8%
distribute-rgt-neg-in36.8%
*-commutative36.8%
fma-neg36.8%
associate-*r*36.8%
*-commutative36.8%
associate-*l*36.8%
Applied egg-rr36.8%
Taylor expanded in b around inf 66.1%
associate-*r/66.1%
*-commutative66.1%
Simplified66.1%
Final simplification67.8%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (+ (* 0.5 (/ c b)) (* b (/ -0.6666666666666666 a))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (0.5 * (c / b)) + (b * (-0.6666666666666666 / a));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-310)) then
tmp = (0.5d0 * (c / b)) + (b * ((-0.6666666666666666d0) / a))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (0.5 * (c / b)) + (b * (-0.6666666666666666 / 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)) + (b * (-0.6666666666666666 / 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(b * Float64(-0.6666666666666666 / a))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = (0.5 * (c / b)) + (b * (-0.6666666666666666 / 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[(b * N[(-0.6666666666666666 / 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} + b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 74.9%
sqr-neg74.9%
sqr-neg74.9%
associate-*l*74.9%
Simplified74.9%
Taylor expanded in b around -inf 69.6%
associate-*r/69.7%
Applied egg-rr69.7%
Taylor expanded in b around 0 69.6%
*-commutative69.6%
associate-*l/69.7%
associate-*r/69.7%
Simplified69.7%
if -4.999999999999985e-310 < b Initial program 36.9%
neg-sub036.9%
sqr-neg36.9%
associate-+l-36.9%
sub0-neg36.9%
neg-mul-136.9%
Simplified36.8%
associate-*r*36.8%
metadata-eval36.8%
distribute-rgt-neg-in36.8%
*-commutative36.8%
fma-neg36.8%
associate-*r*36.8%
*-commutative36.8%
associate-*l*36.8%
Applied egg-rr36.8%
Taylor expanded in b around inf 66.1%
associate-*r/66.1%
*-commutative66.1%
Simplified66.1%
Final simplification67.8%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-310)) then
tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 74.9%
sqr-neg74.9%
sqr-neg74.9%
associate-*l*74.9%
Simplified74.9%
Taylor expanded in b around -inf 69.6%
associate-*r/69.7%
Applied egg-rr69.7%
if -4.999999999999985e-310 < b Initial program 36.9%
neg-sub036.9%
sqr-neg36.9%
associate-+l-36.9%
sub0-neg36.9%
neg-mul-136.9%
Simplified36.8%
associate-*r*36.8%
metadata-eval36.8%
distribute-rgt-neg-in36.8%
*-commutative36.8%
fma-neg36.8%
associate-*r*36.8%
*-commutative36.8%
associate-*l*36.8%
Applied egg-rr36.8%
Taylor expanded in b around inf 66.1%
associate-*r/66.1%
*-commutative66.1%
Simplified66.1%
Final simplification67.8%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-277) (/ (* b -2.0) (* 3.0 a)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-277) {
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 <= 4.2d-277) 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 <= 4.2e-277) {
tmp = (b * -2.0) / (3.0 * a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-277: 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 <= 4.2e-277) 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 <= 4.2e-277) 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, 4.2e-277], 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 4.2 \cdot 10^{-277}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 4.1999999999999999e-277Initial program 75.3%
sqr-neg75.3%
sqr-neg75.3%
associate-*l*75.4%
Simplified75.4%
Taylor expanded in b around -inf 68.4%
*-commutative68.4%
Simplified68.4%
if 4.1999999999999999e-277 < b Initial program 35.9%
neg-sub035.9%
sqr-neg35.9%
associate-+l-35.9%
sub0-neg35.9%
neg-mul-135.9%
Simplified35.9%
associate-*r*35.8%
metadata-eval35.8%
distribute-rgt-neg-in35.8%
*-commutative35.8%
fma-neg35.8%
associate-*r*35.9%
*-commutative35.9%
associate-*l*35.9%
Applied egg-rr35.9%
Taylor expanded in b around inf 67.0%
associate-*r/67.0%
*-commutative67.0%
Simplified67.0%
Final simplification67.7%
(FPCore (a b c) :precision binary64 (if (<= b 6.4e-277) (* (/ b a) -0.3333333333333333) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 6.4e-277) {
tmp = (b / 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 <= 6.4d-277) then
tmp = (b / 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 <= 6.4e-277) {
tmp = (b / a) * -0.3333333333333333;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 6.4e-277: tmp = (b / a) * -0.3333333333333333 else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 6.4e-277) tmp = Float64(Float64(b / a) * -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 <= 6.4e-277) tmp = (b / a) * -0.3333333333333333; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 6.4e-277], N[(N[(b / a), $MachinePrecision] * -0.3333333333333333), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 6.4 \cdot 10^{-277}:\\
\;\;\;\;\frac{b}{a} \cdot -0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 6.3999999999999996e-277Initial program 75.3%
neg-sub075.3%
sqr-neg75.3%
associate-+l-75.3%
sub0-neg75.3%
neg-mul-175.3%
Simplified75.2%
associate-*r*75.2%
metadata-eval75.2%
distribute-rgt-neg-in75.2%
*-commutative75.2%
fma-neg75.2%
associate-*r*75.2%
*-commutative75.2%
associate-*l*75.2%
Applied egg-rr75.2%
Taylor expanded in b around 0 43.2%
*-commutative43.2%
*-commutative43.2%
*-commutative43.2%
associate-*l*43.2%
Simplified43.2%
Taylor expanded in c around 0 26.0%
if 6.3999999999999996e-277 < b Initial program 35.9%
sqr-neg35.9%
sqr-neg35.9%
associate-*l*35.9%
Simplified35.9%
Taylor expanded in b around inf 67.0%
Final simplification47.0%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-277) (* -0.6666666666666666 (/ b a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-277) {
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 <= 4.2d-277) 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 <= 4.2e-277) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-277: tmp = -0.6666666666666666 * (b / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 4.2e-277) 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 <= 4.2e-277) tmp = -0.6666666666666666 * (b / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 4.2e-277], 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 4.2 \cdot 10^{-277}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 4.1999999999999999e-277Initial program 75.3%
sqr-neg75.3%
sqr-neg75.3%
associate-*l*75.4%
Simplified75.4%
Taylor expanded in b around -inf 68.2%
*-commutative68.2%
Simplified68.2%
if 4.1999999999999999e-277 < b Initial program 35.9%
sqr-neg35.9%
sqr-neg35.9%
associate-*l*35.9%
Simplified35.9%
Taylor expanded in b around inf 67.0%
Final simplification67.6%
(FPCore (a b c) :precision binary64 (if (<= b 4.2e-277) (* -0.6666666666666666 (/ b a)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 4.2e-277) {
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 <= 4.2d-277) 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 <= 4.2e-277) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 4.2e-277: tmp = -0.6666666666666666 * (b / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 4.2e-277) 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 <= 4.2e-277) tmp = -0.6666666666666666 * (b / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 4.2e-277], 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 4.2 \cdot 10^{-277}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 4.1999999999999999e-277Initial program 75.3%
sqr-neg75.3%
sqr-neg75.3%
associate-*l*75.4%
Simplified75.4%
Taylor expanded in b around -inf 68.2%
*-commutative68.2%
Simplified68.2%
if 4.1999999999999999e-277 < b Initial program 35.9%
neg-sub035.9%
sqr-neg35.9%
associate-+l-35.9%
sub0-neg35.9%
neg-mul-135.9%
Simplified35.9%
associate-*r*35.8%
metadata-eval35.8%
distribute-rgt-neg-in35.8%
*-commutative35.8%
fma-neg35.8%
associate-*r*35.9%
*-commutative35.9%
associate-*l*35.9%
Applied egg-rr35.9%
Taylor expanded in b around inf 67.0%
associate-*r/67.0%
*-commutative67.0%
Simplified67.0%
Final simplification67.6%
(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.2%
sqr-neg55.2%
sqr-neg55.2%
associate-*l*55.1%
Simplified55.1%
Taylor expanded in b around inf 35.3%
Final simplification35.3%
herbie shell --seed 2023272
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))