
(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 16 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.4e+136)
(/ 1.0 (/ (* -1.5 a) b))
(if (<= b 7e-53)
(/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.4e+136) {
tmp = 1.0 / ((-1.5 * a) / b);
} else if (b <= 7e-53) {
tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-7.4d+136)) then
tmp = 1.0d0 / (((-1.5d0) * a) / b)
else if (b <= 7d-53) then
tmp = (sqrt(((b * b) - ((a * 3.0d0) * c))) - b) / (a * 3.0d0)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -7.4e+136) {
tmp = 1.0 / ((-1.5 * a) / b);
} else if (b <= 7e-53) {
tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7.4e+136: tmp = 1.0 / ((-1.5 * a) / b) elif b <= 7e-53: tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7.4e+136) tmp = Float64(1.0 / Float64(Float64(-1.5 * a) / b)); elseif (b <= 7e-53) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -7.4e+136) tmp = 1.0 / ((-1.5 * a) / b); elseif (b <= 7e-53) tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7.4e+136], N[(1.0 / N[(N[(-1.5 * a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-53], 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 / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.4 \cdot 10^{+136}:\\
\;\;\;\;\frac{1}{\frac{-1.5 \cdot a}{b}}\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-53}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -7.4000000000000002e136Initial program 58.2%
neg-sub058.2%
sqr-neg58.2%
associate-+l-58.2%
sub0-neg58.2%
sub-neg58.2%
distribute-neg-in58.2%
remove-double-neg58.2%
sqr-neg58.2%
associate-*l*58.2%
Simplified58.2%
Applied egg-rr52.4%
clear-num52.3%
frac-times52.3%
metadata-eval52.3%
Applied egg-rr52.3%
Taylor expanded in b around -inf 95.7%
associate-*r/95.9%
Simplified95.9%
if -7.4000000000000002e136 < b < 6.99999999999999987e-53Initial program 82.8%
if 6.99999999999999987e-53 < b Initial program 16.3%
neg-sub016.3%
sqr-neg16.3%
associate-+l-16.3%
sub0-neg16.3%
sub-neg16.3%
distribute-neg-in16.3%
remove-double-neg16.3%
sqr-neg16.3%
associate-*l*16.3%
Simplified16.3%
Taylor expanded in b around inf 92.7%
*-commutative92.7%
Simplified92.7%
Final simplification88.4%
(FPCore (a b c)
:precision binary64
(if (<= b -1.75e+135)
(/ 1.0 (/ (* -1.5 a) b))
(if (<= b 8.6e-53)
(/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.75e+135) {
tmp = 1.0 / ((-1.5 * a) / b);
} else if (b <= 8.6e-53) {
tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
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.75d+135)) then
tmp = 1.0d0 / (((-1.5d0) * a) / b)
else if (b <= 8.6d-53) then
tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (a * 3.0d0)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.75e+135) {
tmp = 1.0 / ((-1.5 * a) / b);
} else if (b <= 8.6e-53) {
tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.75e+135: tmp = 1.0 / ((-1.5 * a) / b) elif b <= 8.6e-53: tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.75e+135) tmp = Float64(1.0 / Float64(Float64(-1.5 * a) / b)); elseif (b <= 8.6e-53) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.75e+135) tmp = 1.0 / ((-1.5 * a) / b); elseif (b <= 8.6e-53) tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.75e+135], N[(1.0 / N[(N[(-1.5 * a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.6e-53], 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 / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.75 \cdot 10^{+135}:\\
\;\;\;\;\frac{1}{\frac{-1.5 \cdot a}{b}}\\
\mathbf{elif}\;b \leq 8.6 \cdot 10^{-53}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.7500000000000001e135Initial program 58.2%
neg-sub058.2%
sqr-neg58.2%
associate-+l-58.2%
sub0-neg58.2%
sub-neg58.2%
distribute-neg-in58.2%
remove-double-neg58.2%
sqr-neg58.2%
associate-*l*58.2%
Simplified58.2%
Applied egg-rr52.4%
clear-num52.3%
frac-times52.3%
metadata-eval52.3%
Applied egg-rr52.3%
Taylor expanded in b around -inf 95.7%
associate-*r/95.9%
Simplified95.9%
if -1.7500000000000001e135 < b < 8.5999999999999999e-53Initial program 82.8%
neg-sub082.8%
sqr-neg82.8%
associate-+l-82.8%
sub0-neg82.8%
sub-neg82.8%
distribute-neg-in82.8%
remove-double-neg82.8%
sqr-neg82.8%
associate-*l*82.7%
Simplified82.7%
if 8.5999999999999999e-53 < b Initial program 16.3%
neg-sub016.3%
sqr-neg16.3%
associate-+l-16.3%
sub0-neg16.3%
sub-neg16.3%
distribute-neg-in16.3%
remove-double-neg16.3%
sqr-neg16.3%
associate-*l*16.3%
Simplified16.3%
Taylor expanded in b around inf 92.7%
*-commutative92.7%
Simplified92.7%
Final simplification88.4%
(FPCore (a b c)
:precision binary64
(if (<= b -3.1e-26)
(* (/ 1.0 a) (/ (* b 2.0) -3.0))
(if (<= b 6.4e-53)
(* 0.3333333333333333 (/ (+ b (sqrt (* a (* c -3.0)))) a))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -3.1e-26) {
tmp = (1.0 / a) * ((b * 2.0) / -3.0);
} else if (b <= 6.4e-53) {
tmp = 0.3333333333333333 * ((b + sqrt((a * (c * -3.0)))) / a);
} else {
tmp = (c / b) * -0.5;
}
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.1d-26)) then
tmp = (1.0d0 / a) * ((b * 2.0d0) / (-3.0d0))
else if (b <= 6.4d-53) then
tmp = 0.3333333333333333d0 * ((b + sqrt((a * (c * (-3.0d0))))) / a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -3.1e-26) {
tmp = (1.0 / a) * ((b * 2.0) / -3.0);
} else if (b <= 6.4e-53) {
tmp = 0.3333333333333333 * ((b + Math.sqrt((a * (c * -3.0)))) / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -3.1e-26: tmp = (1.0 / a) * ((b * 2.0) / -3.0) elif b <= 6.4e-53: tmp = 0.3333333333333333 * ((b + math.sqrt((a * (c * -3.0)))) / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -3.1e-26) tmp = Float64(Float64(1.0 / a) * Float64(Float64(b * 2.0) / -3.0)); elseif (b <= 6.4e-53) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(a * Float64(c * -3.0)))) / a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -3.1e-26) tmp = (1.0 / a) * ((b * 2.0) / -3.0); elseif (b <= 6.4e-53) tmp = 0.3333333333333333 * ((b + sqrt((a * (c * -3.0)))) / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -3.1e-26], N[(N[(1.0 / a), $MachinePrecision] * N[(N[(b * 2.0), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.4e-53], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.1 \cdot 10^{-26}:\\
\;\;\;\;\frac{1}{a} \cdot \frac{b \cdot 2}{-3}\\
\mathbf{elif}\;b \leq 6.4 \cdot 10^{-53}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -3.09999999999999983e-26Initial program 72.9%
neg-sub072.9%
sqr-neg72.9%
associate-+l-72.9%
sub0-neg72.9%
sub-neg72.9%
distribute-neg-in72.9%
remove-double-neg72.9%
sqr-neg72.9%
associate-*l*72.9%
Simplified72.9%
Applied egg-rr57.4%
Taylor expanded in b around -inf 88.2%
*-commutative88.2%
Simplified88.2%
if -3.09999999999999983e-26 < b < 6.4000000000000002e-53Initial program 79.2%
neg-sub079.2%
sqr-neg79.2%
associate-+l-79.2%
sub0-neg79.2%
sub-neg79.2%
distribute-neg-in79.2%
remove-double-neg79.2%
sqr-neg79.2%
associate-*l*79.1%
Simplified79.1%
Taylor expanded in b around 0 71.4%
*-commutative71.4%
*-commutative71.4%
associate-*r*71.5%
Simplified71.5%
+-commutative71.5%
*-un-lft-identity71.5%
fma-define71.5%
*-commutative71.5%
add-sqr-sqrt43.0%
sqrt-unprod71.2%
sqr-neg71.2%
sqrt-unprod28.5%
add-sqr-sqrt69.9%
Applied egg-rr69.9%
fma-undefine69.9%
*-lft-identity69.9%
associate-*r*69.7%
*-commutative69.7%
*-commutative69.7%
*-commutative69.7%
Simplified69.7%
*-un-lft-identity69.7%
*-un-lft-identity69.7%
times-frac69.6%
metadata-eval69.6%
+-commutative69.6%
*-commutative69.6%
Applied egg-rr69.6%
*-lft-identity69.6%
associate-*r*69.7%
*-commutative69.7%
*-commutative69.7%
associate-*r*69.6%
*-commutative69.6%
Simplified69.6%
if 6.4000000000000002e-53 < b Initial program 16.3%
neg-sub016.3%
sqr-neg16.3%
associate-+l-16.3%
sub0-neg16.3%
sub-neg16.3%
distribute-neg-in16.3%
remove-double-neg16.3%
sqr-neg16.3%
associate-*l*16.3%
Simplified16.3%
Taylor expanded in b around inf 92.7%
*-commutative92.7%
Simplified92.7%
Final simplification83.3%
(FPCore (a b c)
:precision binary64
(if (<= b -1.6e-24)
(* (/ 1.0 a) (/ (* b 2.0) -3.0))
(if (<= b 5.2e-53)
(/ (+ b (sqrt (* a (* c -3.0)))) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.6e-24) {
tmp = (1.0 / a) * ((b * 2.0) / -3.0);
} else if (b <= 5.2e-53) {
tmp = (b + sqrt((a * (c * -3.0)))) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
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.6d-24)) then
tmp = (1.0d0 / a) * ((b * 2.0d0) / (-3.0d0))
else if (b <= 5.2d-53) then
tmp = (b + sqrt((a * (c * (-3.0d0))))) / (a * 3.0d0)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.6e-24) {
tmp = (1.0 / a) * ((b * 2.0) / -3.0);
} else if (b <= 5.2e-53) {
tmp = (b + Math.sqrt((a * (c * -3.0)))) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.6e-24: tmp = (1.0 / a) * ((b * 2.0) / -3.0) elif b <= 5.2e-53: tmp = (b + math.sqrt((a * (c * -3.0)))) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.6e-24) tmp = Float64(Float64(1.0 / a) * Float64(Float64(b * 2.0) / -3.0)); elseif (b <= 5.2e-53) tmp = Float64(Float64(b + sqrt(Float64(a * Float64(c * -3.0)))) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.6e-24) tmp = (1.0 / a) * ((b * 2.0) / -3.0); elseif (b <= 5.2e-53) tmp = (b + sqrt((a * (c * -3.0)))) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.6e-24], N[(N[(1.0 / a), $MachinePrecision] * N[(N[(b * 2.0), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.2e-53], N[(N[(b + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.6 \cdot 10^{-24}:\\
\;\;\;\;\frac{1}{a} \cdot \frac{b \cdot 2}{-3}\\
\mathbf{elif}\;b \leq 5.2 \cdot 10^{-53}:\\
\;\;\;\;\frac{b + \sqrt{a \cdot \left(c \cdot -3\right)}}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -1.60000000000000006e-24Initial program 72.9%
neg-sub072.9%
sqr-neg72.9%
associate-+l-72.9%
sub0-neg72.9%
sub-neg72.9%
distribute-neg-in72.9%
remove-double-neg72.9%
sqr-neg72.9%
associate-*l*72.9%
Simplified72.9%
Applied egg-rr57.4%
Taylor expanded in b around -inf 88.2%
*-commutative88.2%
Simplified88.2%
if -1.60000000000000006e-24 < b < 5.19999999999999993e-53Initial program 79.2%
neg-sub079.2%
sqr-neg79.2%
associate-+l-79.2%
sub0-neg79.2%
sub-neg79.2%
distribute-neg-in79.2%
remove-double-neg79.2%
sqr-neg79.2%
associate-*l*79.1%
Simplified79.1%
Taylor expanded in b around 0 71.4%
*-commutative71.4%
*-commutative71.4%
associate-*r*71.5%
Simplified71.5%
+-commutative71.5%
*-un-lft-identity71.5%
fma-define71.5%
*-commutative71.5%
add-sqr-sqrt43.0%
sqrt-unprod71.2%
sqr-neg71.2%
sqrt-unprod28.5%
add-sqr-sqrt69.9%
Applied egg-rr69.9%
fma-undefine69.9%
*-lft-identity69.9%
associate-*r*69.7%
*-commutative69.7%
*-commutative69.7%
*-commutative69.7%
Simplified69.7%
if 5.19999999999999993e-53 < b Initial program 16.3%
neg-sub016.3%
sqr-neg16.3%
associate-+l-16.3%
sub0-neg16.3%
sub-neg16.3%
distribute-neg-in16.3%
remove-double-neg16.3%
sqr-neg16.3%
associate-*l*16.3%
Simplified16.3%
Taylor expanded in b around inf 92.7%
*-commutative92.7%
Simplified92.7%
Final simplification83.3%
(FPCore (a b c)
:precision binary64
(if (<= b -6e-25)
(* (/ 1.0 a) (/ (* b 2.0) -3.0))
(if (<= b 5.6e-53)
(/ (+ b (sqrt (* c (* a -3.0)))) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6e-25) {
tmp = (1.0 / a) * ((b * 2.0) / -3.0);
} else if (b <= 5.6e-53) {
tmp = (b + sqrt((c * (a * -3.0)))) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-6d-25)) then
tmp = (1.0d0 / a) * ((b * 2.0d0) / (-3.0d0))
else if (b <= 5.6d-53) then
tmp = (b + sqrt((c * (a * (-3.0d0))))) / (a * 3.0d0)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -6e-25) {
tmp = (1.0 / a) * ((b * 2.0) / -3.0);
} else if (b <= 5.6e-53) {
tmp = (b + Math.sqrt((c * (a * -3.0)))) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6e-25: tmp = (1.0 / a) * ((b * 2.0) / -3.0) elif b <= 5.6e-53: tmp = (b + math.sqrt((c * (a * -3.0)))) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6e-25) tmp = Float64(Float64(1.0 / a) * Float64(Float64(b * 2.0) / -3.0)); elseif (b <= 5.6e-53) tmp = Float64(Float64(b + sqrt(Float64(c * Float64(a * -3.0)))) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6e-25) tmp = (1.0 / a) * ((b * 2.0) / -3.0); elseif (b <= 5.6e-53) tmp = (b + sqrt((c * (a * -3.0)))) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6e-25], N[(N[(1.0 / a), $MachinePrecision] * N[(N[(b * 2.0), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.6e-53], N[(N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6 \cdot 10^{-25}:\\
\;\;\;\;\frac{1}{a} \cdot \frac{b \cdot 2}{-3}\\
\mathbf{elif}\;b \leq 5.6 \cdot 10^{-53}:\\
\;\;\;\;\frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -5.9999999999999995e-25Initial program 72.9%
neg-sub072.9%
sqr-neg72.9%
associate-+l-72.9%
sub0-neg72.9%
sub-neg72.9%
distribute-neg-in72.9%
remove-double-neg72.9%
sqr-neg72.9%
associate-*l*72.9%
Simplified72.9%
Applied egg-rr57.4%
Taylor expanded in b around -inf 88.2%
*-commutative88.2%
Simplified88.2%
if -5.9999999999999995e-25 < b < 5.59999999999999971e-53Initial program 79.2%
neg-sub079.2%
sqr-neg79.2%
associate-+l-79.2%
sub0-neg79.2%
sub-neg79.2%
distribute-neg-in79.2%
remove-double-neg79.2%
sqr-neg79.2%
associate-*l*79.1%
Simplified79.1%
Taylor expanded in b around 0 71.4%
*-commutative71.4%
*-commutative71.4%
associate-*r*71.5%
Simplified71.5%
+-commutative71.5%
*-un-lft-identity71.5%
fma-define71.5%
*-commutative71.5%
add-sqr-sqrt43.0%
sqrt-unprod71.2%
sqr-neg71.2%
sqrt-unprod28.5%
add-sqr-sqrt69.9%
Applied egg-rr69.9%
fma-undefine69.9%
*-lft-identity69.9%
*-commutative69.9%
Simplified69.9%
if 5.59999999999999971e-53 < b Initial program 16.3%
neg-sub016.3%
sqr-neg16.3%
associate-+l-16.3%
sub0-neg16.3%
sub-neg16.3%
distribute-neg-in16.3%
remove-double-neg16.3%
sqr-neg16.3%
associate-*l*16.3%
Simplified16.3%
Taylor expanded in b around inf 92.7%
*-commutative92.7%
Simplified92.7%
Final simplification83.3%
(FPCore (a b c)
:precision binary64
(if (<= b -1e-12)
(* (/ 1.0 a) (/ (* b 2.0) -3.0))
(if (<= b 5.2e-53)
(/ (- (sqrt (* (* a c) -3.0)) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1e-12) {
tmp = (1.0 / a) * ((b * 2.0) / -3.0);
} else if (b <= 5.2e-53) {
tmp = (sqrt(((a * c) * -3.0)) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
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-12)) then
tmp = (1.0d0 / a) * ((b * 2.0d0) / (-3.0d0))
else if (b <= 5.2d-53) then
tmp = (sqrt(((a * c) * (-3.0d0))) - b) / (a * 3.0d0)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1e-12) {
tmp = (1.0 / a) * ((b * 2.0) / -3.0);
} else if (b <= 5.2e-53) {
tmp = (Math.sqrt(((a * c) * -3.0)) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1e-12: tmp = (1.0 / a) * ((b * 2.0) / -3.0) elif b <= 5.2e-53: tmp = (math.sqrt(((a * c) * -3.0)) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1e-12) tmp = Float64(Float64(1.0 / a) * Float64(Float64(b * 2.0) / -3.0)); elseif (b <= 5.2e-53) tmp = Float64(Float64(sqrt(Float64(Float64(a * c) * -3.0)) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1e-12) tmp = (1.0 / a) * ((b * 2.0) / -3.0); elseif (b <= 5.2e-53) tmp = (sqrt(((a * c) * -3.0)) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1e-12], N[(N[(1.0 / a), $MachinePrecision] * N[(N[(b * 2.0), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.2e-53], N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-12}:\\
\;\;\;\;\frac{1}{a} \cdot \frac{b \cdot 2}{-3}\\
\mathbf{elif}\;b \leq 5.2 \cdot 10^{-53}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -9.9999999999999998e-13Initial program 72.2%
neg-sub072.2%
sqr-neg72.2%
associate-+l-72.2%
sub0-neg72.2%
sub-neg72.2%
distribute-neg-in72.2%
remove-double-neg72.2%
sqr-neg72.2%
associate-*l*72.2%
Simplified72.2%
Applied egg-rr56.4%
Taylor expanded in b around -inf 89.1%
*-commutative89.1%
Simplified89.1%
if -9.9999999999999998e-13 < b < 5.19999999999999993e-53Initial program 79.6%
/-rgt-identity79.6%
metadata-eval79.6%
Simplified79.5%
Taylor expanded in a around inf 79.5%
Taylor expanded in a around inf 71.1%
if 5.19999999999999993e-53 < b Initial program 16.3%
neg-sub016.3%
sqr-neg16.3%
associate-+l-16.3%
sub0-neg16.3%
sub-neg16.3%
distribute-neg-in16.3%
remove-double-neg16.3%
sqr-neg16.3%
associate-*l*16.3%
Simplified16.3%
Taylor expanded in b around inf 92.7%
*-commutative92.7%
Simplified92.7%
Final simplification83.9%
(FPCore (a b c)
:precision binary64
(if (<= b -7.2e-13)
(* (/ 1.0 a) (/ (* b 2.0) -3.0))
(if (<= b 7.5e-53)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -7.2e-13) {
tmp = (1.0 / a) * ((b * 2.0) / -3.0);
} else if (b <= 7.5e-53) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-7.2d-13)) then
tmp = (1.0d0 / a) * ((b * 2.0d0) / (-3.0d0))
else if (b <= 7.5d-53) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -7.2e-13) {
tmp = (1.0 / a) * ((b * 2.0) / -3.0);
} else if (b <= 7.5e-53) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -7.2e-13: tmp = (1.0 / a) * ((b * 2.0) / -3.0) elif b <= 7.5e-53: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -7.2e-13) tmp = Float64(Float64(1.0 / a) * Float64(Float64(b * 2.0) / -3.0)); elseif (b <= 7.5e-53) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -7.2e-13) tmp = (1.0 / a) * ((b * 2.0) / -3.0); elseif (b <= 7.5e-53) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -7.2e-13], N[(N[(1.0 / a), $MachinePrecision] * N[(N[(b * 2.0), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.5e-53], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.2 \cdot 10^{-13}:\\
\;\;\;\;\frac{1}{a} \cdot \frac{b \cdot 2}{-3}\\
\mathbf{elif}\;b \leq 7.5 \cdot 10^{-53}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -7.1999999999999996e-13Initial program 72.2%
neg-sub072.2%
sqr-neg72.2%
associate-+l-72.2%
sub0-neg72.2%
sub-neg72.2%
distribute-neg-in72.2%
remove-double-neg72.2%
sqr-neg72.2%
associate-*l*72.2%
Simplified72.2%
Applied egg-rr56.4%
Taylor expanded in b around -inf 89.1%
*-commutative89.1%
Simplified89.1%
if -7.1999999999999996e-13 < b < 7.5000000000000001e-53Initial program 79.6%
neg-sub079.6%
sqr-neg79.6%
associate-+l-79.6%
sub0-neg79.6%
sub-neg79.6%
distribute-neg-in79.6%
remove-double-neg79.6%
sqr-neg79.6%
associate-*l*79.5%
Simplified79.5%
Taylor expanded in b around 0 71.1%
*-commutative71.1%
*-commutative71.1%
associate-*r*71.2%
Simplified71.2%
*-commutative71.2%
sqrt-prod39.1%
*-commutative39.1%
Applied egg-rr39.1%
+-commutative39.1%
unsub-neg39.1%
*-commutative39.1%
sqrt-unprod71.2%
*-commutative71.2%
Applied egg-rr71.2%
if 7.5000000000000001e-53 < b Initial program 16.3%
neg-sub016.3%
sqr-neg16.3%
associate-+l-16.3%
sub0-neg16.3%
sub-neg16.3%
distribute-neg-in16.3%
remove-double-neg16.3%
sqr-neg16.3%
associate-*l*16.3%
Simplified16.3%
Taylor expanded in b around inf 92.7%
*-commutative92.7%
Simplified92.7%
Final simplification84.0%
(FPCore (a b c)
:precision binary64
(if (<= b -6.5e-13)
(* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
(if (<= b 6.5e-53)
(/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
(* (/ c b) -0.5))))
double code(double a, double b, double c) {
double tmp;
if (b <= -6.5e-13) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
} else if (b <= 6.5e-53) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
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.5d-13)) then
tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.5d0) * (c / (b ** 2.0d0))))
else if (b <= 6.5d-53) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -6.5e-13) {
tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
} else if (b <= 6.5e-53) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -6.5e-13: tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0)))) elif b <= 6.5e-53: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= -6.5e-13) tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0))))); elseif (b <= 6.5e-53) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -6.5e-13) tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0)))); elseif (b <= 6.5e-53) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -6.5e-13], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.5e-53], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.5 \cdot 10^{-13}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\
\mathbf{elif}\;b \leq 6.5 \cdot 10^{-53}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < -6.49999999999999957e-13Initial program 72.2%
neg-sub072.2%
sqr-neg72.2%
associate-+l-72.2%
sub0-neg72.2%
sub-neg72.2%
distribute-neg-in72.2%
remove-double-neg72.2%
sqr-neg72.2%
associate-*l*72.2%
Simplified72.2%
Taylor expanded in b around -inf 89.5%
if -6.49999999999999957e-13 < b < 6.4999999999999997e-53Initial program 79.6%
neg-sub079.6%
sqr-neg79.6%
associate-+l-79.6%
sub0-neg79.6%
sub-neg79.6%
distribute-neg-in79.6%
remove-double-neg79.6%
sqr-neg79.6%
associate-*l*79.5%
Simplified79.5%
Taylor expanded in b around 0 71.1%
*-commutative71.1%
*-commutative71.1%
associate-*r*71.2%
Simplified71.2%
*-commutative71.2%
sqrt-prod39.1%
*-commutative39.1%
Applied egg-rr39.1%
+-commutative39.1%
unsub-neg39.1%
*-commutative39.1%
sqrt-unprod71.2%
*-commutative71.2%
Applied egg-rr71.2%
if 6.4999999999999997e-53 < b Initial program 16.3%
neg-sub016.3%
sqr-neg16.3%
associate-+l-16.3%
sub0-neg16.3%
sub-neg16.3%
distribute-neg-in16.3%
remove-double-neg16.3%
sqr-neg16.3%
associate-*l*16.3%
Simplified16.3%
Taylor expanded in b around inf 92.7%
*-commutative92.7%
Simplified92.7%
Final simplification84.1%
(FPCore (a b c) :precision binary64 (if (<= b 1.16e-262) (/ 1.0 (* -1.5 (/ a b))) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.16e-262) {
tmp = 1.0 / (-1.5 * (a / b));
} else {
tmp = (c / b) * -0.5;
}
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.16d-262) then
tmp = 1.0d0 / ((-1.5d0) * (a / b))
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.16e-262) {
tmp = 1.0 / (-1.5 * (a / b));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.16e-262: tmp = 1.0 / (-1.5 * (a / b)) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.16e-262) tmp = Float64(1.0 / Float64(-1.5 * Float64(a / b))); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.16e-262) tmp = 1.0 / (-1.5 * (a / b)); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.16e-262], N[(1.0 / N[(-1.5 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.16 \cdot 10^{-262}:\\
\;\;\;\;\frac{1}{-1.5 \cdot \frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 1.16000000000000001e-262Initial program 77.5%
neg-sub077.5%
sqr-neg77.5%
associate-+l-77.5%
sub0-neg77.5%
sub-neg77.5%
distribute-neg-in77.5%
remove-double-neg77.5%
sqr-neg77.5%
associate-*l*77.5%
Simplified77.5%
Applied egg-rr67.4%
clear-num67.3%
frac-times67.4%
metadata-eval67.4%
Applied egg-rr67.4%
Taylor expanded in b around -inf 60.5%
if 1.16000000000000001e-262 < b Initial program 31.5%
neg-sub031.5%
sqr-neg31.5%
associate-+l-31.5%
sub0-neg31.5%
sub-neg31.5%
distribute-neg-in31.5%
remove-double-neg31.5%
sqr-neg31.5%
associate-*l*31.4%
Simplified31.4%
Taylor expanded in b around inf 73.1%
*-commutative73.1%
Simplified73.1%
Final simplification66.3%
(FPCore (a b c) :precision binary64 (if (<= b 1.16e-262) (/ 1.0 (/ (* -1.5 a) b)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.16e-262) {
tmp = 1.0 / ((-1.5 * a) / b);
} else {
tmp = (c / b) * -0.5;
}
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.16d-262) then
tmp = 1.0d0 / (((-1.5d0) * a) / b)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.16e-262) {
tmp = 1.0 / ((-1.5 * a) / b);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.16e-262: tmp = 1.0 / ((-1.5 * a) / b) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.16e-262) tmp = Float64(1.0 / Float64(Float64(-1.5 * a) / b)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.16e-262) tmp = 1.0 / ((-1.5 * a) / b); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.16e-262], N[(1.0 / N[(N[(-1.5 * a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.16 \cdot 10^{-262}:\\
\;\;\;\;\frac{1}{\frac{-1.5 \cdot a}{b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 1.16000000000000001e-262Initial program 77.5%
neg-sub077.5%
sqr-neg77.5%
associate-+l-77.5%
sub0-neg77.5%
sub-neg77.5%
distribute-neg-in77.5%
remove-double-neg77.5%
sqr-neg77.5%
associate-*l*77.5%
Simplified77.5%
Applied egg-rr67.4%
clear-num67.3%
frac-times67.4%
metadata-eval67.4%
Applied egg-rr67.4%
Taylor expanded in b around -inf 60.5%
associate-*r/60.5%
Simplified60.5%
if 1.16000000000000001e-262 < b Initial program 31.5%
neg-sub031.5%
sqr-neg31.5%
associate-+l-31.5%
sub0-neg31.5%
sub-neg31.5%
distribute-neg-in31.5%
remove-double-neg31.5%
sqr-neg31.5%
associate-*l*31.4%
Simplified31.4%
Taylor expanded in b around inf 73.1%
*-commutative73.1%
Simplified73.1%
Final simplification66.3%
(FPCore (a b c) :precision binary64 (if (<= b 1.16e-262) (/ (* b -2.0) (* a 3.0)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.16e-262) {
tmp = (b * -2.0) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
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.16d-262) then
tmp = (b * (-2.0d0)) / (a * 3.0d0)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.16e-262) {
tmp = (b * -2.0) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.16e-262: tmp = (b * -2.0) / (a * 3.0) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.16e-262) tmp = Float64(Float64(b * -2.0) / Float64(a * 3.0)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.16e-262) tmp = (b * -2.0) / (a * 3.0); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.16e-262], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.16 \cdot 10^{-262}:\\
\;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 1.16000000000000001e-262Initial program 77.5%
neg-sub077.5%
sqr-neg77.5%
associate-+l-77.5%
sub0-neg77.5%
sub-neg77.5%
distribute-neg-in77.5%
remove-double-neg77.5%
sqr-neg77.5%
associate-*l*77.5%
Simplified77.5%
Taylor expanded in b around -inf 60.6%
*-commutative60.6%
Simplified60.6%
if 1.16000000000000001e-262 < b Initial program 31.5%
neg-sub031.5%
sqr-neg31.5%
associate-+l-31.5%
sub0-neg31.5%
sub-neg31.5%
distribute-neg-in31.5%
remove-double-neg31.5%
sqr-neg31.5%
associate-*l*31.4%
Simplified31.4%
Taylor expanded in b around inf 73.1%
*-commutative73.1%
Simplified73.1%
Final simplification66.3%
(FPCore (a b c) :precision binary64 (if (<= b 1.16e-262) (* b (/ -0.6666666666666666 a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.16e-262) {
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 <= 1.16d-262) 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 <= 1.16e-262) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.16e-262: tmp = b * (-0.6666666666666666 / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.16e-262) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.16e-262) tmp = b * (-0.6666666666666666 / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.16e-262], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.16 \cdot 10^{-262}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 1.16000000000000001e-262Initial program 77.5%
neg-sub077.5%
sqr-neg77.5%
associate-+l-77.5%
sub0-neg77.5%
sub-neg77.5%
distribute-neg-in77.5%
remove-double-neg77.5%
sqr-neg77.5%
associate-*l*77.5%
Simplified77.5%
Applied egg-rr67.4%
Taylor expanded in b around -inf 60.4%
*-commutative60.4%
associate-*l/60.4%
associate-/l*60.4%
Simplified60.4%
if 1.16000000000000001e-262 < b Initial program 31.5%
neg-sub031.5%
sqr-neg31.5%
associate-+l-31.5%
sub0-neg31.5%
sub-neg31.5%
distribute-neg-in31.5%
remove-double-neg31.5%
sqr-neg31.5%
associate-*l*31.4%
Simplified31.4%
Taylor expanded in c around 0 65.7%
associate-*r/65.7%
metadata-eval65.7%
Simplified65.7%
Taylor expanded in a around 0 72.9%
Final simplification66.2%
(FPCore (a b c) :precision binary64 (if (<= b 1.16e-262) (* b (/ -0.6666666666666666 a)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.16e-262) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * -0.5;
}
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.16d-262) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = (c / b) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.16e-262) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.16e-262: tmp = b * (-0.6666666666666666 / a) else: tmp = (c / b) * -0.5 return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.16e-262) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(Float64(c / b) * -0.5); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.16e-262) tmp = b * (-0.6666666666666666 / a); else tmp = (c / b) * -0.5; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.16e-262], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.16 \cdot 10^{-262}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\end{array}
\end{array}
if b < 1.16000000000000001e-262Initial program 77.5%
neg-sub077.5%
sqr-neg77.5%
associate-+l-77.5%
sub0-neg77.5%
sub-neg77.5%
distribute-neg-in77.5%
remove-double-neg77.5%
sqr-neg77.5%
associate-*l*77.5%
Simplified77.5%
Applied egg-rr67.4%
Taylor expanded in b around -inf 60.4%
*-commutative60.4%
associate-*l/60.4%
associate-/l*60.4%
Simplified60.4%
if 1.16000000000000001e-262 < b Initial program 31.5%
neg-sub031.5%
sqr-neg31.5%
associate-+l-31.5%
sub0-neg31.5%
sub-neg31.5%
distribute-neg-in31.5%
remove-double-neg31.5%
sqr-neg31.5%
associate-*l*31.4%
Simplified31.4%
Taylor expanded in b around inf 73.1%
*-commutative73.1%
Simplified73.1%
Final simplification66.3%
(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 56.3%
/-rgt-identity56.3%
metadata-eval56.3%
Simplified55.8%
sub-neg55.8%
fma-undefine55.8%
add-sqr-sqrt46.8%
hypot-define51.8%
add-sqr-sqrt35.5%
sqrt-unprod43.9%
sqr-neg43.9%
sqrt-prod11.3%
add-sqr-sqrt27.8%
Applied egg-rr27.8%
Taylor expanded in b around inf 2.4%
Final simplification2.4%
(FPCore (a b c) :precision binary64 (* 1.3333333333333333 (/ b a)))
double code(double a, double b, double c) {
return 1.3333333333333333 * (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 = 1.3333333333333333d0 * (b / a)
end function
public static double code(double a, double b, double c) {
return 1.3333333333333333 * (b / a);
}
def code(a, b, c): return 1.3333333333333333 * (b / a)
function code(a, b, c) return Float64(1.3333333333333333 * Float64(b / a)) end
function tmp = code(a, b, c) tmp = 1.3333333333333333 * (b / a); end
code[a_, b_, c_] := N[(1.3333333333333333 * N[(b / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1.3333333333333333 \cdot \frac{b}{a}
\end{array}
Initial program 56.3%
/-rgt-identity56.3%
metadata-eval56.3%
Simplified55.8%
*-un-lft-identity55.8%
*-un-lft-identity55.8%
prod-diff55.8%
*-commutative55.8%
*-un-lft-identity55.8%
fma-define55.8%
*-un-lft-identity55.8%
+-commutative55.8%
add-sqr-sqrt40.5%
sqrt-unprod52.0%
sqr-neg52.0%
sqrt-prod11.5%
add-sqr-sqrt36.4%
fma-undefine36.4%
add-sqr-sqrt33.2%
hypot-define27.8%
Applied egg-rr27.4%
+-commutative27.4%
associate-+l+27.4%
associate-*r*27.4%
*-commutative27.4%
associate-*r*27.5%
fma-undefine27.5%
*-rgt-identity27.5%
Simplified27.5%
Taylor expanded in b around inf 2.4%
Final simplification2.4%
(FPCore (a b c) :precision binary64 (* b (/ -0.6666666666666666 a)))
double code(double a, double b, double c) {
return b * (-0.6666666666666666 / 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 * ((-0.6666666666666666d0) / a)
end function
public static double code(double a, double b, double c) {
return b * (-0.6666666666666666 / a);
}
def code(a, b, c): return b * (-0.6666666666666666 / a)
function code(a, b, c) return Float64(b * Float64(-0.6666666666666666 / a)) end
function tmp = code(a, b, c) tmp = b * (-0.6666666666666666 / a); end
code[a_, b_, c_] := N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
b \cdot \frac{-0.6666666666666666}{a}
\end{array}
Initial program 56.3%
neg-sub056.3%
sqr-neg56.3%
associate-+l-56.3%
sub0-neg56.3%
sub-neg56.3%
distribute-neg-in56.3%
remove-double-neg56.3%
sqr-neg56.3%
associate-*l*56.2%
Simplified56.2%
Applied egg-rr51.8%
Taylor expanded in b around -inf 33.8%
*-commutative33.8%
associate-*l/33.8%
associate-/l*33.8%
Simplified33.8%
Final simplification33.8%
herbie shell --seed 2024085
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))