
(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 15 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 -7.5e-54)
(/ (* b -0.6666666666666666) a)
(if (<= b 3.5e-65)
(* (/ (- b (hypot b (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.5e-54) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 3.5e-65) {
tmp = ((b - hypot(b, sqrt((c * (a * -3.0))))) / a) * -0.3333333333333333;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
public static double code(double a, double b, double c) {
double tmp;
if (b <= -7.5e-54) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 3.5e-65) {
tmp = ((b - Math.hypot(b, 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.5e-54: tmp = (b * -0.6666666666666666) / a elif b <= 3.5e-65: tmp = ((b - math.hypot(b, 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.5e-54) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 3.5e-65) tmp = Float64(Float64(Float64(b - hypot(b, 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.5e-54) tmp = (b * -0.6666666666666666) / a; elseif (b <= 3.5e-65) tmp = ((b - hypot(b, 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.5e-54], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 3.5e-65], N[(N[(N[(b - N[Sqrt[b ^ 2 + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $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.5 \cdot 10^{-54}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 3.5 \cdot 10^{-65}:\\
\;\;\;\;\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot -0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -7.5000000000000005e-54Initial program 68.2%
Taylor expanded in b around -inf 93.8%
*-commutative93.8%
Simplified93.8%
associate-*l/93.9%
Applied egg-rr93.9%
if -7.5000000000000005e-54 < b < 3.50000000000000005e-65Initial program 76.5%
/-rgt-identity76.5%
metadata-eval76.5%
associate-/r/76.5%
metadata-eval76.5%
metadata-eval76.5%
times-frac76.5%
*-commutative76.5%
times-frac76.5%
*-commutative76.5%
associate-/r*76.4%
associate-*l/76.3%
Simplified76.2%
clear-num76.2%
inv-pow76.2%
*-commutative76.2%
fma-udef76.2%
associate-*r*76.3%
add-sqr-sqrt76.3%
hypot-def79.0%
Applied egg-rr79.0%
unpow-179.0%
*-commutative79.0%
associate-*r*78.9%
*-commutative78.9%
associate-*l*79.0%
Simplified79.0%
expm1-log1p-u54.0%
expm1-udef28.6%
associate-/r/28.6%
*-commutative28.6%
Applied egg-rr28.6%
expm1-def54.0%
expm1-log1p79.1%
associate-*r*79.1%
associate-*l/79.1%
*-lft-identity79.1%
Simplified79.1%
if 3.50000000000000005e-65 < b Initial program 14.6%
Taylor expanded in b around inf 67.4%
associate-/l*68.4%
Simplified68.4%
div-inv68.3%
associate-/r/73.6%
*-commutative73.6%
Applied egg-rr73.6%
associate-*l/67.3%
associate-*r/67.3%
associate-*l/77.1%
*-commutative77.1%
associate-*r*77.2%
*-commutative77.2%
associate-/r*77.1%
metadata-eval77.1%
Simplified77.1%
Taylor expanded in a around 0 87.8%
*-commutative87.8%
Simplified87.8%
Final simplification87.0%
(FPCore (a b c)
:precision binary64
(if (<= b -1e+64)
(/ (* b -0.6666666666666666) a)
(if (<= b 6.6e-64)
(* -0.3333333333333333 (/ (- b (sqrt (- (* b b) (* 3.0 (* a c))))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e+64) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 6.6e-64) {
tmp = -0.3333333333333333 * ((b - sqrt(((b * b) - (3.0 * (a * c))))) / 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+64)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 6.6d-64) then
tmp = (-0.3333333333333333d0) * ((b - sqrt(((b * b) - (3.0d0 * (a * c))))) / 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+64) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 6.6e-64) {
tmp = -0.3333333333333333 * ((b - Math.sqrt(((b * b) - (3.0 * (a * c))))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e+64: tmp = (b * -0.6666666666666666) / a elif b <= 6.6e-64: tmp = -0.3333333333333333 * ((b - math.sqrt(((b * b) - (3.0 * (a * c))))) / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e+64) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 6.6e-64) tmp = Float64(-0.3333333333333333 * Float64(Float64(b - sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c))))) / 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+64) tmp = (b * -0.6666666666666666) / a; elseif (b <= 6.6e-64) tmp = -0.3333333333333333 * ((b - sqrt(((b * b) - (3.0 * (a * c))))) / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e+64], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 6.6e-64], N[(-0.3333333333333333 * N[(N[(b - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+64}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 6.6 \cdot 10^{-64}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.00000000000000002e64Initial program 59.9%
Taylor expanded in b around -inf 96.5%
*-commutative96.5%
Simplified96.5%
associate-*l/96.7%
Applied egg-rr96.7%
if -1.00000000000000002e64 < b < 6.5999999999999999e-64Initial program 79.6%
/-rgt-identity79.6%
metadata-eval79.6%
associate-/l*79.6%
associate-*r/79.4%
*-commutative79.4%
associate-*l/79.6%
associate-*r/79.6%
metadata-eval79.6%
metadata-eval79.6%
times-frac79.6%
neg-mul-179.6%
distribute-rgt-neg-in79.6%
times-frac79.4%
metadata-eval79.4%
neg-mul-179.4%
Simplified79.4%
fma-udef79.5%
associate-*r*79.4%
*-commutative79.4%
metadata-eval79.4%
cancel-sign-sub-inv79.4%
Applied egg-rr79.4%
if 6.5999999999999999e-64 < b Initial program 14.6%
Taylor expanded in b around inf 67.4%
associate-/l*68.4%
Simplified68.4%
div-inv68.3%
associate-/r/73.6%
*-commutative73.6%
Applied egg-rr73.6%
associate-*l/67.3%
associate-*r/67.3%
associate-*l/77.1%
*-commutative77.1%
associate-*r*77.2%
*-commutative77.2%
associate-/r*77.1%
metadata-eval77.1%
Simplified77.1%
Taylor expanded in a around 0 87.8%
*-commutative87.8%
Simplified87.8%
Final simplification86.5%
(FPCore (a b c)
:precision binary64
(if (<= b -3.65e-6)
(/ (* b -0.6666666666666666) a)
(if (<= b 5.5e-64)
(* (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (/ 0.3333333333333333 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.65e-6) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 5.5e-64) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - 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 <= (-3.65d-6)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 5.5d-64) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - 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 <= -3.65e-6) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 5.5e-64) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) * (0.3333333333333333 / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.65e-6: tmp = (b * -0.6666666666666666) / a elif b <= 5.5e-64: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) * (0.3333333333333333 / a) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.65e-6) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 5.5e-64) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - 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 <= -3.65e-6) tmp = (b * -0.6666666666666666) / a; elseif (b <= 5.5e-64) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) * (0.3333333333333333 / a); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.65e-6], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 5.5e-64], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $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 -3.65 \cdot 10^{-6}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 5.5 \cdot 10^{-64}:\\
\;\;\;\;\left(\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3.65000000000000021e-6Initial program 65.7%
Taylor expanded in b around -inf 95.8%
*-commutative95.8%
Simplified95.8%
associate-*l/95.9%
Applied egg-rr95.9%
if -3.65000000000000021e-6 < b < 5.4999999999999999e-64Initial program 77.8%
neg-sub077.8%
associate-+l-77.8%
sub0-neg77.8%
neg-mul-177.8%
associate-*r/77.8%
*-commutative77.8%
metadata-eval77.8%
metadata-eval77.8%
times-frac77.8%
*-commutative77.8%
times-frac77.7%
Simplified77.7%
fma-udef77.7%
associate-*r*77.6%
*-commutative77.6%
metadata-eval77.6%
cancel-sign-sub-inv77.6%
Applied egg-rr77.6%
if 5.4999999999999999e-64 < b Initial program 14.6%
Taylor expanded in b around inf 67.4%
associate-/l*68.4%
Simplified68.4%
div-inv68.3%
associate-/r/73.6%
*-commutative73.6%
Applied egg-rr73.6%
associate-*l/67.3%
associate-*r/67.3%
associate-*l/77.1%
*-commutative77.1%
associate-*r*77.2%
*-commutative77.2%
associate-/r*77.1%
metadata-eval77.1%
Simplified77.1%
Taylor expanded in a around 0 87.8%
*-commutative87.8%
Simplified87.8%
Final simplification86.5%
(FPCore (a b c)
:precision binary64
(if (<= b -4.8e+39)
(/ (* b -0.6666666666666666) a)
(if (<= b 9.6e-64)
(/ (- (sqrt (+ (* b b) (* a (* c -3.0)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.8e+39) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 9.6e-64) {
tmp = (sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0);
} 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.8d+39)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 9.6d-64) then
tmp = (sqrt(((b * b) + (a * (c * (-3.0d0))))) - b) / (a * 3.0d0)
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.8e+39) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 9.6e-64) {
tmp = (Math.sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.8e+39: tmp = (b * -0.6666666666666666) / a elif b <= 9.6e-64: tmp = (math.sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.8e+39) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 9.6e-64) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(a * Float64(c * -3.0)))) - b) / Float64(a * 3.0)); 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.8e+39) tmp = (b * -0.6666666666666666) / a; elseif (b <= 9.6e-64) tmp = (sqrt(((b * b) + (a * (c * -3.0)))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.8e+39], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 9.6e-64], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.8 \cdot 10^{+39}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 9.6 \cdot 10^{-64}:\\
\;\;\;\;\frac{\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.8000000000000002e39Initial program 62.4%
Taylor expanded in b around -inf 96.7%
*-commutative96.7%
Simplified96.7%
associate-*l/96.8%
Applied egg-rr96.8%
if -4.8000000000000002e39 < b < 9.59999999999999994e-64Initial program 78.8%
associate-*r*78.7%
cancel-sign-sub-inv78.7%
metadata-eval78.7%
*-commutative78.7%
associate-*r*78.7%
Applied egg-rr78.7%
if 9.59999999999999994e-64 < b Initial program 14.6%
Taylor expanded in b around inf 67.4%
associate-/l*68.4%
Simplified68.4%
div-inv68.3%
associate-/r/73.6%
*-commutative73.6%
Applied egg-rr73.6%
associate-*l/67.3%
associate-*r/67.3%
associate-*l/77.1%
*-commutative77.1%
associate-*r*77.2%
*-commutative77.2%
associate-/r*77.1%
metadata-eval77.1%
Simplified77.1%
Taylor expanded in a around 0 87.8%
*-commutative87.8%
Simplified87.8%
Final simplification86.5%
(FPCore (a b c)
:precision binary64
(if (<= b -4.8e+39)
(/ (* b -0.6666666666666666) a)
(if (<= b 2.8e-64)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.8e+39) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 2.8e-64) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} 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.8d+39)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 2.8d-64) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (a * 3.0d0)
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.8e+39) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 2.8e-64) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.8e+39: tmp = (b * -0.6666666666666666) / a elif b <= 2.8e-64: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.8e+39) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 2.8e-64) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0)); 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.8e+39) tmp = (b * -0.6666666666666666) / a; elseif (b <= 2.8e-64) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.8e+39], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 2.8e-64], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.8 \cdot 10^{+39}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 2.8 \cdot 10^{-64}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.8000000000000002e39Initial program 62.4%
Taylor expanded in b around -inf 96.7%
*-commutative96.7%
Simplified96.7%
associate-*l/96.8%
Applied egg-rr96.8%
if -4.8000000000000002e39 < b < 2.80000000000000004e-64Initial program 78.8%
neg-sub078.8%
associate-+l-78.8%
sub0-neg78.8%
neg-mul-178.8%
associate-*r/78.8%
metadata-eval78.8%
metadata-eval78.8%
times-frac78.8%
*-commutative78.8%
times-frac78.6%
associate-*l/78.8%
Simplified78.7%
if 2.80000000000000004e-64 < b Initial program 14.6%
Taylor expanded in b around inf 67.4%
associate-/l*68.4%
Simplified68.4%
div-inv68.3%
associate-/r/73.6%
*-commutative73.6%
Applied egg-rr73.6%
associate-*l/67.3%
associate-*r/67.3%
associate-*l/77.1%
*-commutative77.1%
associate-*r*77.2%
*-commutative77.2%
associate-/r*77.1%
metadata-eval77.1%
Simplified77.1%
Taylor expanded in a around 0 87.8%
*-commutative87.8%
Simplified87.8%
Final simplification86.5%
(FPCore (a b c)
:precision binary64
(if (<= b -4.8e+39)
(/ (* b -0.6666666666666666) a)
(if (<= b 4.3e-63)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.8e+39) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 4.3e-63) {
tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} 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.8d+39)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 4.3d-63) then
tmp = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
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.8e+39) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 4.3e-63) {
tmp = (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.8e+39: tmp = (b * -0.6666666666666666) / a elif b <= 4.3e-63: tmp = (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.8e+39) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 4.3e-63) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)); 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.8e+39) tmp = (b * -0.6666666666666666) / a; elseif (b <= 4.3e-63) tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.8e+39], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 4.3e-63], 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[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.8 \cdot 10^{+39}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 4.3 \cdot 10^{-63}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.8000000000000002e39Initial program 62.4%
Taylor expanded in b around -inf 96.7%
*-commutative96.7%
Simplified96.7%
associate-*l/96.8%
Applied egg-rr96.8%
if -4.8000000000000002e39 < b < 4.2999999999999999e-63Initial program 78.8%
if 4.2999999999999999e-63 < b Initial program 14.6%
Taylor expanded in b around inf 67.4%
associate-/l*68.4%
Simplified68.4%
div-inv68.3%
associate-/r/73.6%
*-commutative73.6%
Applied egg-rr73.6%
associate-*l/67.3%
associate-*r/67.3%
associate-*l/77.1%
*-commutative77.1%
associate-*r*77.2%
*-commutative77.2%
associate-/r*77.1%
metadata-eval77.1%
Simplified77.1%
Taylor expanded in a around 0 87.8%
*-commutative87.8%
Simplified87.8%
Final simplification86.5%
(FPCore (a b c)
:precision binary64
(if (<= b -1.65e-56)
(/ (* b -0.6666666666666666) a)
(if (<= b 4.8e-65)
(/ (- (sqrt (* -3.0 (* a c))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.65e-56) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 4.8e-65) {
tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 3.0);
} 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 <= (-1.65d-56)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 4.8d-65) then
tmp = (sqrt(((-3.0d0) * (a * c))) - b) / (a * 3.0d0)
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 <= -1.65e-56) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 4.8e-65) {
tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.65e-56: tmp = (b * -0.6666666666666666) / a elif b <= 4.8e-65: tmp = (math.sqrt((-3.0 * (a * c))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.65e-56) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 4.8e-65) tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.65e-56) tmp = (b * -0.6666666666666666) / a; elseif (b <= 4.8e-65) tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.65e-56], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 4.8e-65], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.65 \cdot 10^{-56}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 4.8 \cdot 10^{-65}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.64999999999999992e-56Initial program 68.2%
Taylor expanded in b around -inf 93.8%
*-commutative93.8%
Simplified93.8%
associate-*l/93.9%
Applied egg-rr93.9%
if -1.64999999999999992e-56 < b < 4.8000000000000003e-65Initial program 76.5%
Taylor expanded in b around 0 72.4%
if 4.8000000000000003e-65 < b Initial program 14.6%
Taylor expanded in b around inf 67.4%
associate-/l*68.4%
Simplified68.4%
div-inv68.3%
associate-/r/73.6%
*-commutative73.6%
Applied egg-rr73.6%
associate-*l/67.3%
associate-*r/67.3%
associate-*l/77.1%
*-commutative77.1%
associate-*r*77.2%
*-commutative77.2%
associate-/r*77.1%
metadata-eval77.1%
Simplified77.1%
Taylor expanded in a around 0 87.8%
*-commutative87.8%
Simplified87.8%
Final simplification84.8%
(FPCore (a b c)
:precision binary64
(if (<= b -2.02e-56)
(/ (* b -0.6666666666666666) a)
(if (<= b 7.6e-65)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.02e-56) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 7.6e-65) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} 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.02d-56)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 7.6d-65) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
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.02e-56) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 7.6e-65) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.02e-56: tmp = (b * -0.6666666666666666) / a elif b <= 7.6e-65: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.02e-56) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 7.6e-65) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); 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.02e-56) tmp = (b * -0.6666666666666666) / a; elseif (b <= 7.6e-65) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.02e-56], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 7.6e-65], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.02 \cdot 10^{-56}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 7.6 \cdot 10^{-65}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.02000000000000003e-56Initial program 68.2%
Taylor expanded in b around -inf 93.8%
*-commutative93.8%
Simplified93.8%
associate-*l/93.9%
Applied egg-rr93.9%
if -2.02000000000000003e-56 < b < 7.6000000000000003e-65Initial program 76.5%
Taylor expanded in b around 0 72.4%
*-commutative72.4%
*-commutative72.4%
*-commutative72.4%
associate-*l*72.5%
Simplified72.5%
if 7.6000000000000003e-65 < b Initial program 14.6%
Taylor expanded in b around inf 67.4%
associate-/l*68.4%
Simplified68.4%
div-inv68.3%
associate-/r/73.6%
*-commutative73.6%
Applied egg-rr73.6%
associate-*l/67.3%
associate-*r/67.3%
associate-*l/77.1%
*-commutative77.1%
associate-*r*77.2%
*-commutative77.2%
associate-/r*77.1%
metadata-eval77.1%
Simplified77.1%
Taylor expanded in a around 0 87.8%
*-commutative87.8%
Simplified87.8%
Final simplification84.9%
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (/ (- (- (* a (* 1.5 (/ c b))) b) b) (* a 3.0)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = (((a * (1.5 * (c / b))) - b) - b) / (a * 3.0);
} 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-310)) then
tmp = (((a * (1.5d0 * (c / b))) - b) - b) / (a * 3.0d0)
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-310) {
tmp = (((a * (1.5 * (c / b))) - b) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e-310: tmp = (((a * (1.5 * (c / b))) - b) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e-310) tmp = Float64(Float64(Float64(Float64(a * Float64(1.5 * Float64(c / b))) - b) - b) / Float64(a * 3.0)); 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-310) tmp = (((a * (1.5 * (c / b))) - b) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[(N[(N[(N[(a * N[(1.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(a \cdot \left(1.5 \cdot \frac{c}{b}\right) - b\right) - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 71.5%
associate-*r*71.5%
cancel-sign-sub-inv71.5%
metadata-eval71.5%
*-commutative71.5%
associate-*r*71.5%
Applied egg-rr71.5%
Taylor expanded in b around -inf 64.5%
neg-mul-164.5%
unsub-neg64.5%
associate-*l/67.1%
*-commutative67.1%
*-commutative67.1%
associate-*l*67.1%
*-commutative67.1%
Simplified67.1%
if -1.999999999999994e-310 < b Initial program 31.7%
Taylor expanded in b around inf 49.7%
associate-/l*52.8%
Simplified52.8%
div-inv52.7%
associate-/r/56.7%
*-commutative56.7%
Applied egg-rr56.7%
associate-*l/49.7%
associate-*r/49.6%
associate-*l/56.7%
*-commutative56.7%
associate-*r*56.8%
*-commutative56.8%
associate-/r*56.7%
metadata-eval56.7%
Simplified56.7%
Taylor expanded in a around 0 68.9%
*-commutative68.9%
Simplified68.9%
Final simplification68.0%
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (+ (* -0.6666666666666666 (/ b a)) (* (/ c b) 0.5)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else {
tmp = (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-310)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + ((c / b) * 0.5d0)
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-310) {
tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e-310: tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2e-310) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(Float64(c / b) * 0.5)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2e-310) tmp = (-0.6666666666666666 * (b / a)) + ((c / b) * 0.5); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 71.5%
Taylor expanded in b around -inf 67.1%
if -1.999999999999994e-310 < b Initial program 31.7%
Taylor expanded in b around inf 49.7%
associate-/l*52.8%
Simplified52.8%
div-inv52.7%
associate-/r/56.7%
*-commutative56.7%
Applied egg-rr56.7%
associate-*l/49.7%
associate-*r/49.6%
associate-*l/56.7%
*-commutative56.7%
associate-*r*56.8%
*-commutative56.8%
associate-/r*56.7%
metadata-eval56.7%
Simplified56.7%
Taylor expanded in a around 0 68.9%
*-commutative68.9%
Simplified68.9%
Final simplification68.0%
(FPCore (a b c) :precision binary64 (if (<= b 9.2e-281) (* -0.6666666666666666 (/ b a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 9.2e-281) {
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 <= 9.2d-281) 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 <= 9.2e-281) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 9.2e-281: tmp = -0.6666666666666666 * (b / a) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 9.2e-281) 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 <= 9.2e-281) tmp = -0.6666666666666666 * (b / a); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 9.2e-281], 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 9.2 \cdot 10^{-281}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 9.19999999999999956e-281Initial program 72.2%
Taylor expanded in b around -inf 65.4%
*-commutative65.4%
Simplified65.4%
if 9.19999999999999956e-281 < b Initial program 30.1%
Taylor expanded in b around inf 70.5%
Final simplification67.9%
(FPCore (a b c) :precision binary64 (if (<= b 9.2e-281) (/ b (/ a -0.6666666666666666)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 9.2e-281) {
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 <= 9.2d-281) 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 <= 9.2e-281) {
tmp = b / (a / -0.6666666666666666);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 9.2e-281: tmp = b / (a / -0.6666666666666666) else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 9.2e-281) 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 <= 9.2e-281) tmp = b / (a / -0.6666666666666666); else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 9.2e-281], 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 9.2 \cdot 10^{-281}:\\
\;\;\;\;\frac{b}{\frac{a}{-0.6666666666666666}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 9.19999999999999956e-281Initial program 72.2%
neg-sub072.2%
associate-+l-72.2%
sub0-neg72.2%
neg-mul-172.2%
associate-*r/72.2%
*-commutative72.2%
metadata-eval72.2%
metadata-eval72.2%
times-frac72.2%
*-commutative72.2%
times-frac72.1%
Simplified72.1%
fma-udef72.1%
associate-*r*72.1%
*-commutative72.1%
metadata-eval72.1%
cancel-sign-sub-inv72.1%
Applied egg-rr72.1%
div-inv72.0%
Applied egg-rr72.0%
Taylor expanded in b around -inf 65.4%
*-commutative65.4%
associate-/r/65.4%
Simplified65.4%
if 9.19999999999999956e-281 < b Initial program 30.1%
Taylor expanded in b around inf 70.5%
Final simplification67.9%
(FPCore (a b c) :precision binary64 (if (<= b 9.2e-281) (/ (* b -0.6666666666666666) a) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 9.2e-281) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 9.2d-281) then
tmp = (b * (-0.6666666666666666d0)) / a
else
tmp = (-0.5d0) * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 9.2e-281) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 9.2e-281: tmp = (b * -0.6666666666666666) / a else: tmp = -0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 9.2e-281) tmp = Float64(Float64(b * -0.6666666666666666) / a); else tmp = Float64(-0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 9.2e-281) tmp = (b * -0.6666666666666666) / a; else tmp = -0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 9.2e-281], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9.2 \cdot 10^{-281}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 9.19999999999999956e-281Initial program 72.2%
Taylor expanded in b around -inf 65.4%
*-commutative65.4%
Simplified65.4%
associate-*l/65.4%
Applied egg-rr65.4%
if 9.19999999999999956e-281 < b Initial program 30.1%
Taylor expanded in b around inf 70.5%
Final simplification67.9%
(FPCore (a b c) :precision binary64 (if (<= b 9.2e-281) (/ (* b -0.6666666666666666) a) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 9.2e-281) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 9.2d-281) then
tmp = (b * (-0.6666666666666666d0)) / a
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 9.2e-281) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 9.2e-281: tmp = (b * -0.6666666666666666) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 9.2e-281) tmp = Float64(Float64(b * -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 <= 9.2e-281) tmp = (b * -0.6666666666666666) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 9.2e-281], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9.2 \cdot 10^{-281}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 9.19999999999999956e-281Initial program 72.2%
Taylor expanded in b around -inf 65.4%
*-commutative65.4%
Simplified65.4%
associate-*l/65.4%
Applied egg-rr65.4%
if 9.19999999999999956e-281 < b Initial program 30.1%
Taylor expanded in b around inf 50.8%
associate-/l*54.0%
Simplified54.0%
div-inv53.9%
associate-/r/57.9%
*-commutative57.9%
Applied egg-rr57.9%
associate-*l/50.8%
associate-*r/50.8%
associate-*l/58.0%
*-commutative58.0%
associate-*r*58.1%
*-commutative58.1%
associate-/r*58.0%
metadata-eval58.0%
Simplified58.0%
Taylor expanded in a around 0 70.5%
*-commutative70.5%
Simplified70.5%
Final simplification67.9%
(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 51.6%
Taylor expanded in b around inf 35.6%
Final simplification35.6%
herbie shell --seed 2023252
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))