
(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 11 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 -3900.0)
(/ (* b -0.6666666666666666) a)
(if (<= b 6.8e-61)
(/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3900.0) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 6.8e-61) {
tmp = (sqrt(((b * b) - ((a * 3.0) * 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 <= (-3900.0d0)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 6.8d-61) then
tmp = (sqrt(((b * b) - ((a * 3.0d0) * 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 <= -3900.0) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 6.8e-61) {
tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3900.0: tmp = (b * -0.6666666666666666) / a elif b <= 6.8e-61: tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3900.0) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 6.8e-61) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * 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 <= -3900.0) tmp = (b * -0.6666666666666666) / a; elseif (b <= 6.8e-61) tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3900.0], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 6.8e-61], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * 3.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3900:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 6.8 \cdot 10^{-61}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3900Initial program 65.7%
fma-neg65.7%
associate-*l*65.7%
distribute-lft-neg-in65.7%
metadata-eval65.7%
*-commutative65.7%
associate-*r*65.7%
*-un-lft-identity65.7%
*-un-lft-identity65.7%
add-cube-cbrt65.5%
sqrt-prod65.4%
Applied egg-rr65.4%
Taylor expanded in b around -inf 94.3%
associate-*r/94.4%
*-commutative94.4%
Simplified94.4%
if -3900 < b < 6.7999999999999996e-61Initial program 71.9%
if 6.7999999999999996e-61 < b Initial program 20.9%
Taylor expanded in b around inf 87.2%
associate-*r/87.2%
Simplified87.2%
Final simplification83.5%
(FPCore (a b c)
:precision binary64
(if (<= b -9.4e-60)
(/ (* b -0.6666666666666666) a)
(if (<= b 8.6e-61)
(/ (+ b (sqrt (* -3.0 (* a c)))) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -9.4e-60) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 8.6e-61) {
tmp = (b + sqrt((-3.0 * (a * c)))) / (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 <= (-9.4d-60)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 8.6d-61) then
tmp = (b + sqrt(((-3.0d0) * (a * c)))) / (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 <= -9.4e-60) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 8.6e-61) {
tmp = (b + Math.sqrt((-3.0 * (a * c)))) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -9.4e-60: tmp = (b * -0.6666666666666666) / a elif b <= 8.6e-61: tmp = (b + math.sqrt((-3.0 * (a * c)))) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -9.4e-60) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 8.6e-61) tmp = Float64(Float64(b + sqrt(Float64(-3.0 * Float64(a * c)))) / 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 <= -9.4e-60) tmp = (b * -0.6666666666666666) / a; elseif (b <= 8.6e-61) tmp = (b + sqrt((-3.0 * (a * c)))) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -9.4e-60], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 8.6e-61], N[(N[(b + N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $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 -9.4 \cdot 10^{-60}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 8.6 \cdot 10^{-61}:\\
\;\;\;\;\frac{b + \sqrt{-3 \cdot \left(a \cdot c\right)}}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -9.4e-60Initial program 70.5%
fma-neg70.5%
associate-*l*70.5%
distribute-lft-neg-in70.5%
metadata-eval70.5%
*-commutative70.5%
associate-*r*70.5%
*-un-lft-identity70.5%
*-un-lft-identity70.5%
add-cube-cbrt70.2%
sqrt-prod70.2%
Applied egg-rr70.2%
Taylor expanded in b around -inf 91.9%
associate-*r/91.9%
*-commutative91.9%
Simplified91.9%
if -9.4e-60 < b < 8.6000000000000007e-61Initial program 68.0%
Taylor expanded in b around 0 63.8%
associate-*r*63.8%
*-commutative63.8%
*-commutative63.8%
Simplified63.8%
+-commutative63.8%
*-un-lft-identity63.8%
fma-def63.8%
add-sqr-sqrt37.3%
sqrt-unprod63.6%
sqr-neg63.6%
sqrt-unprod27.0%
add-sqr-sqrt62.8%
Applied egg-rr62.8%
fma-udef62.8%
*-lft-identity62.8%
Simplified62.8%
Taylor expanded in c around 0 62.7%
if 8.6000000000000007e-61 < b Initial program 20.9%
Taylor expanded in b around inf 87.2%
associate-*r/87.2%
Simplified87.2%
Final simplification81.1%
(FPCore (a b c)
:precision binary64
(if (<= b -2.8e-60)
(/ (* b -0.6666666666666666) a)
(if (<= b 1.05e-60)
(/ (+ b (sqrt (* c (* a -3.0)))) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.8e-60) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 1.05e-60) {
tmp = (b + sqrt((c * (a * -3.0)))) / (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.8d-60)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 1.05d-60) then
tmp = (b + sqrt((c * (a * (-3.0d0))))) / (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.8e-60) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 1.05e-60) {
tmp = (b + Math.sqrt((c * (a * -3.0)))) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.8e-60: tmp = (b * -0.6666666666666666) / a elif b <= 1.05e-60: tmp = (b + math.sqrt((c * (a * -3.0)))) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.8e-60) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 1.05e-60) tmp = Float64(Float64(b + sqrt(Float64(c * Float64(a * -3.0)))) / 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.8e-60) tmp = (b * -0.6666666666666666) / a; elseif (b <= 1.05e-60) tmp = (b + sqrt((c * (a * -3.0)))) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.8e-60], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 1.05e-60], N[(N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $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.8 \cdot 10^{-60}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 1.05 \cdot 10^{-60}:\\
\;\;\;\;\frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.8000000000000002e-60Initial program 70.5%
fma-neg70.5%
associate-*l*70.5%
distribute-lft-neg-in70.5%
metadata-eval70.5%
*-commutative70.5%
associate-*r*70.5%
*-un-lft-identity70.5%
*-un-lft-identity70.5%
add-cube-cbrt70.2%
sqrt-prod70.2%
Applied egg-rr70.2%
Taylor expanded in b around -inf 91.9%
associate-*r/91.9%
*-commutative91.9%
Simplified91.9%
if -2.8000000000000002e-60 < b < 1.04999999999999996e-60Initial program 68.0%
Taylor expanded in b around 0 63.8%
associate-*r*63.8%
*-commutative63.8%
*-commutative63.8%
Simplified63.8%
+-commutative63.8%
*-un-lft-identity63.8%
fma-def63.8%
add-sqr-sqrt37.3%
sqrt-unprod63.6%
sqr-neg63.6%
sqrt-unprod27.0%
add-sqr-sqrt62.8%
Applied egg-rr62.8%
fma-udef62.8%
*-lft-identity62.8%
Simplified62.8%
if 1.04999999999999996e-60 < b Initial program 20.9%
Taylor expanded in b around inf 87.2%
associate-*r/87.2%
Simplified87.2%
Final simplification81.1%
(FPCore (a b c)
:precision binary64
(if (<= b -1.1e-54)
(/ (* b -0.6666666666666666) a)
(if (<= b 7e-61)
(/ (- (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.1e-54) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 7e-61) {
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.1d-54)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 7d-61) 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.1e-54) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 7e-61) {
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.1e-54: tmp = (b * -0.6666666666666666) / a elif b <= 7e-61: 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.1e-54) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 7e-61) 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.1e-54) tmp = (b * -0.6666666666666666) / a; elseif (b <= 7e-61) 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.1e-54], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 7e-61], 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.1 \cdot 10^{-54}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-61}:\\
\;\;\;\;\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.1e-54Initial program 70.5%
fma-neg70.5%
associate-*l*70.5%
distribute-lft-neg-in70.5%
metadata-eval70.5%
*-commutative70.5%
associate-*r*70.5%
*-un-lft-identity70.5%
*-un-lft-identity70.5%
add-cube-cbrt70.2%
sqrt-prod70.2%
Applied egg-rr70.2%
Taylor expanded in b around -inf 91.9%
associate-*r/91.9%
*-commutative91.9%
Simplified91.9%
if -1.1e-54 < b < 7.0000000000000006e-61Initial program 68.0%
Taylor expanded in b around 0 63.8%
if 7.0000000000000006e-61 < b Initial program 20.9%
Taylor expanded in b around inf 87.2%
associate-*r/87.2%
Simplified87.2%
Final simplification81.5%
(FPCore (a b c)
:precision binary64
(if (<= b -3.2e-54)
(/ (* b -0.6666666666666666) a)
(if (<= b 5.5e-61)
(/ (- (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 <= -3.2e-54) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 5.5e-61) {
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 <= (-3.2d-54)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 5.5d-61) 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 <= -3.2e-54) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 5.5e-61) {
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 <= -3.2e-54: tmp = (b * -0.6666666666666666) / a elif b <= 5.5e-61: 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 <= -3.2e-54) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 5.5e-61) 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 <= -3.2e-54) tmp = (b * -0.6666666666666666) / a; elseif (b <= 5.5e-61) 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, -3.2e-54], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 5.5e-61], 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 -3.2 \cdot 10^{-54}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 5.5 \cdot 10^{-61}:\\
\;\;\;\;\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 < -3.19999999999999998e-54Initial program 70.5%
fma-neg70.5%
associate-*l*70.5%
distribute-lft-neg-in70.5%
metadata-eval70.5%
*-commutative70.5%
associate-*r*70.5%
*-un-lft-identity70.5%
*-un-lft-identity70.5%
add-cube-cbrt70.2%
sqrt-prod70.2%
Applied egg-rr70.2%
Taylor expanded in b around -inf 91.9%
associate-*r/91.9%
*-commutative91.9%
Simplified91.9%
if -3.19999999999999998e-54 < b < 5.4999999999999997e-61Initial program 68.0%
Taylor expanded in b around 0 63.8%
associate-*r*63.8%
*-commutative63.8%
*-commutative63.8%
Simplified63.8%
if 5.4999999999999997e-61 < b Initial program 20.9%
Taylor expanded in b around inf 87.2%
associate-*r/87.2%
Simplified87.2%
Final simplification81.5%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (* -0.6666666666666666 (/ b a)) (/ -0.5 (/ b c))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 / (b / c);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-310)) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = (-0.5d0) / (b / c)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = -0.5 / (b / c);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = -0.6666666666666666 * (b / a) else: tmp = -0.5 / (b / c) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(-0.5 / Float64(b / c)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = -0.6666666666666666 * (b / a); else tmp = -0.5 / (b / c); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{\frac{b}{c}}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 72.6%
Taylor expanded in b around -inf 66.9%
*-commutative66.9%
Simplified66.9%
if -4.999999999999985e-310 < b Initial program 31.9%
Taylor expanded in b around inf 66.3%
associate-*r/66.3%
associate-/l*65.2%
Simplified65.2%
Final simplification66.0%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (/ b (* a -1.5)) (/ -0.5 (/ b c))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = b / (a * -1.5);
} else {
tmp = -0.5 / (b / c);
}
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 / (a * (-1.5d0))
else
tmp = (-0.5d0) / (b / c)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = b / (a * -1.5);
} else {
tmp = -0.5 / (b / c);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = b / (a * -1.5) else: tmp = -0.5 / (b / c) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(b / Float64(a * -1.5)); else tmp = Float64(-0.5 / Float64(b / c)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = b / (a * -1.5); else tmp = -0.5 / (b / c); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], N[(-0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{\frac{b}{c}}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 72.6%
Taylor expanded in b around -inf 66.9%
*-commutative66.9%
Simplified66.9%
add-exp-log32.2%
associate-*l/32.2%
Applied egg-rr32.2%
rem-exp-log66.9%
associate-/l*66.9%
div-inv66.9%
metadata-eval66.9%
Applied egg-rr66.9%
if -4.999999999999985e-310 < b Initial program 31.9%
Taylor expanded in b around inf 66.3%
associate-*r/66.3%
associate-/l*65.2%
Simplified65.2%
Final simplification66.0%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (/ b (* a -1.5)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = b / (a * -1.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 <= (-5d-310)) then
tmp = b / (a * (-1.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 <= -5e-310) {
tmp = b / (a * -1.5);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = b / (a * -1.5) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(b / Float64(a * -1.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 <= -5e-310) tmp = b / (a * -1.5); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(b / N[(a * -1.5), $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}{a \cdot -1.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 72.6%
Taylor expanded in b around -inf 66.9%
*-commutative66.9%
Simplified66.9%
add-exp-log32.2%
associate-*l/32.2%
Applied egg-rr32.2%
rem-exp-log66.9%
associate-/l*66.9%
div-inv66.9%
metadata-eval66.9%
Applied egg-rr66.9%
if -4.999999999999985e-310 < b Initial program 31.9%
Taylor expanded in b around inf 66.3%
associate-*r/66.3%
Simplified66.3%
Final simplification66.6%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (/ (* b -0.6666666666666666) a) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
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 <= (-5d-310)) 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 <= -5e-310) {
tmp = (b * -0.6666666666666666) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = (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(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 <= -5e-310) tmp = (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[(b * -0.6666666666666666), $MachinePrecision] / a), $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}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 72.6%
fma-neg72.6%
associate-*l*72.6%
distribute-lft-neg-in72.6%
metadata-eval72.6%
*-commutative72.6%
associate-*r*72.5%
*-un-lft-identity72.5%
*-un-lft-identity72.5%
add-cube-cbrt72.1%
sqrt-prod72.2%
Applied egg-rr72.2%
Taylor expanded in b around -inf 66.9%
associate-*r/66.9%
*-commutative66.9%
Simplified66.9%
if -4.999999999999985e-310 < b Initial program 31.9%
Taylor expanded in b around inf 66.3%
associate-*r/66.3%
Simplified66.3%
Final simplification66.6%
(FPCore (a b c) :precision binary64 (* (/ b a) 1.3333333333333333))
double code(double a, double b, double c) {
return (b / a) * 1.3333333333333333;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (b / a) * 1.3333333333333333d0
end function
public static double code(double a, double b, double c) {
return (b / a) * 1.3333333333333333;
}
def code(a, b, c): return (b / a) * 1.3333333333333333
function code(a, b, c) return Float64(Float64(b / a) * 1.3333333333333333) end
function tmp = code(a, b, c) tmp = (b / a) * 1.3333333333333333; end
code[a_, b_, c_] := N[(N[(b / a), $MachinePrecision] * 1.3333333333333333), $MachinePrecision]
\begin{array}{l}
\\
\frac{b}{a} \cdot 1.3333333333333333
\end{array}
Initial program 52.1%
+-commutative52.1%
sqr-neg52.1%
unsub-neg52.1%
div-sub51.6%
--rgt-identity51.6%
div-sub52.1%
Simplified52.1%
*-un-lft-identity52.1%
*-un-lft-identity52.1%
prod-diff52.1%
Applied egg-rr23.3%
+-commutative23.3%
associate-+l+23.3%
associate-*r*23.3%
*-commutative23.3%
associate-*l*23.3%
fma-udef23.3%
*-rgt-identity23.3%
Simplified23.3%
Taylor expanded in b around inf 2.7%
Final simplification2.7%
(FPCore (a b c) :precision binary64 (* -0.6666666666666666 (/ b a)))
double code(double a, double b, double c) {
return -0.6666666666666666 * (b / a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-0.6666666666666666d0) * (b / a)
end function
public static double code(double a, double b, double c) {
return -0.6666666666666666 * (b / a);
}
def code(a, b, c): return -0.6666666666666666 * (b / a)
function code(a, b, c) return Float64(-0.6666666666666666 * Float64(b / a)) end
function tmp = code(a, b, c) tmp = -0.6666666666666666 * (b / a); end
code[a_, b_, c_] := N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.6666666666666666 \cdot \frac{b}{a}
\end{array}
Initial program 52.1%
Taylor expanded in b around -inf 34.7%
*-commutative34.7%
Simplified34.7%
Final simplification34.7%
herbie shell --seed 2024031
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))