
(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 19 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 -1.8e+64)
(/ (* b -0.6666666666666666) a)
(if (<= b 7.4e-110)
(/ (- (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 <= -1.8e+64) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 7.4e-110) {
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 <= (-1.8d+64)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 7.4d-110) 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 <= -1.8e+64) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 7.4e-110) {
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 <= -1.8e+64: tmp = (b * -0.6666666666666666) / a elif b <= 7.4e-110: 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 <= -1.8e+64) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 7.4e-110) 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 <= -1.8e+64) tmp = (b * -0.6666666666666666) / a; elseif (b <= 7.4e-110) 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, -1.8e+64], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 7.4e-110], 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 -1.8 \cdot 10^{+64}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 7.4 \cdot 10^{-110}:\\
\;\;\;\;\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 < -1.80000000000000007e64Initial program 59.9%
sqr-neg59.9%
sqr-neg59.9%
associate-*l*59.9%
Simplified59.9%
Taylor expanded in b around -inf 94.0%
*-commutative94.0%
associate-*l/94.2%
Simplified94.2%
if -1.80000000000000007e64 < b < 7.40000000000000032e-110Initial program 85.2%
if 7.40000000000000032e-110 < b Initial program 12.4%
sqr-neg12.4%
sqr-neg12.4%
associate-*l*12.4%
Simplified12.4%
Taylor expanded in b around inf 89.6%
*-commutative89.6%
associate-*l/89.6%
Simplified89.6%
Final simplification88.9%
(FPCore (a b c)
:precision binary64
(if (<= b -6.2e+63)
(/ (* b -0.6666666666666666) a)
(if (<= b 4e-109)
(/ (- (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 <= -6.2e+63) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 4e-109) {
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 <= (-6.2d+63)) then
tmp = (b * (-0.6666666666666666d0)) / a
else if (b <= 4d-109) 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 <= -6.2e+63) {
tmp = (b * -0.6666666666666666) / a;
} else if (b <= 4e-109) {
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 <= -6.2e+63: tmp = (b * -0.6666666666666666) / a elif b <= 4e-109: 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 <= -6.2e+63) tmp = Float64(Float64(b * -0.6666666666666666) / a); elseif (b <= 4e-109) 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 <= -6.2e+63) tmp = (b * -0.6666666666666666) / a; elseif (b <= 4e-109) 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, -6.2e+63], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 4e-109], 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 -6.2 \cdot 10^{+63}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 4 \cdot 10^{-109}:\\
\;\;\;\;\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 < -6.2000000000000001e63Initial program 59.9%
sqr-neg59.9%
sqr-neg59.9%
associate-*l*59.9%
Simplified59.9%
Taylor expanded in b around -inf 94.0%
*-commutative94.0%
associate-*l/94.2%
Simplified94.2%
if -6.2000000000000001e63 < b < 4e-109Initial program 85.2%
sqr-neg85.2%
sqr-neg85.2%
associate-*l*85.0%
Simplified85.0%
if 4e-109 < b Initial program 12.4%
sqr-neg12.4%
sqr-neg12.4%
associate-*l*12.4%
Simplified12.4%
Taylor expanded in b around inf 89.6%
*-commutative89.6%
associate-*l/89.6%
Simplified89.6%
Final simplification88.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2.35e-129)
(fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
(if (<= b 7e-109)
(* 0.3333333333333333 (/ (+ b (sqrt (* c (* a -3.0)))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.35e-129) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else if (b <= 7e-109) {
tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.35e-129) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); elseif (b <= 7e-109) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(c * Float64(a * -3.0)))) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.35e-129], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-109], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(c * N[(a * -3.0), $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 -2.35 \cdot 10^{-129}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-109}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.3500000000000001e-129Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.5%
Simplified74.5%
Taylor expanded in b around -inf 84.0%
fma-define84.0%
Simplified84.0%
if -2.3500000000000001e-129 < b < 7e-109Initial program 77.0%
sqr-neg77.0%
sqr-neg77.0%
associate-*l*76.8%
Simplified76.8%
Taylor expanded in b around 0 76.7%
*-commutative76.7%
associate-*r*76.7%
Simplified76.7%
*-un-lft-identity76.7%
+-commutative76.7%
add-sqr-sqrt32.7%
sqrt-unprod76.1%
sqr-neg76.1%
sqrt-unprod43.7%
add-sqr-sqrt76.3%
*-commutative76.3%
Applied egg-rr76.3%
associate-*r/76.3%
*-commutative76.3%
times-frac76.2%
metadata-eval76.2%
+-commutative76.2%
associate-*r*76.2%
*-commutative76.2%
associate-*r*76.1%
*-commutative76.1%
Simplified76.1%
if 7e-109 < b Initial program 12.4%
sqr-neg12.4%
sqr-neg12.4%
associate-*l*12.4%
Simplified12.4%
Taylor expanded in b around inf 89.6%
*-commutative89.6%
associate-*l/89.6%
Simplified89.6%
Final simplification83.8%
(FPCore (a b c)
:precision binary64
(if (<= b -2.75e-125)
(fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
(if (<= b 6.6e-109)
(* 0.3333333333333333 (/ (+ b (sqrt (* a (* c -3.0)))) a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.75e-125) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else if (b <= 6.6e-109) {
tmp = 0.3333333333333333 * ((b + sqrt((a * (c * -3.0)))) / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.75e-125) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); elseif (b <= 6.6e-109) tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(a * Float64(c * -3.0)))) / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.75e-125], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.6e-109], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(a * N[(c * -3.0), $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 -2.75 \cdot 10^{-125}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 6.6 \cdot 10^{-109}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.7499999999999999e-125Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.5%
Simplified74.5%
Taylor expanded in b around -inf 84.0%
fma-define84.0%
Simplified84.0%
if -2.7499999999999999e-125 < b < 6.59999999999999981e-109Initial program 77.0%
sqr-neg77.0%
sqr-neg77.0%
associate-*l*76.8%
Simplified76.8%
Taylor expanded in b around 0 76.7%
*-commutative76.7%
associate-*r*76.7%
Simplified76.7%
*-un-lft-identity76.7%
times-frac76.6%
metadata-eval76.6%
+-commutative76.6%
add-sqr-sqrt32.8%
sqrt-unprod76.0%
sqr-neg76.0%
sqrt-unprod43.5%
add-sqr-sqrt76.2%
Applied egg-rr76.2%
if 6.59999999999999981e-109 < b Initial program 12.4%
sqr-neg12.4%
sqr-neg12.4%
associate-*l*12.4%
Simplified12.4%
Taylor expanded in b around inf 89.6%
*-commutative89.6%
associate-*l/89.6%
Simplified89.6%
Final simplification83.9%
(FPCore (a b c)
:precision binary64
(if (<= b -2.75e-125)
(fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
(if (<= b 7e-109)
(* (+ b (sqrt (* a (* c -3.0)))) (/ 0.3333333333333333 a))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.75e-125) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else if (b <= 7e-109) {
tmp = (b + sqrt((a * (c * -3.0)))) * (0.3333333333333333 / a);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.75e-125) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); elseif (b <= 7e-109) tmp = Float64(Float64(b + sqrt(Float64(a * Float64(c * -3.0)))) * Float64(0.3333333333333333 / a)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.75e-125], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-109], N[(N[(b + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $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 -2.75 \cdot 10^{-125}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-109}:\\
\;\;\;\;\left(b + \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -2.7499999999999999e-125Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.5%
Simplified74.5%
Taylor expanded in b around -inf 84.0%
fma-define84.0%
Simplified84.0%
if -2.7499999999999999e-125 < b < 7e-109Initial program 77.0%
sqr-neg77.0%
sqr-neg77.0%
associate-*l*76.8%
Simplified76.8%
Taylor expanded in b around 0 76.7%
*-commutative76.7%
associate-*r*76.7%
Simplified76.7%
*-un-lft-identity76.7%
+-commutative76.7%
add-sqr-sqrt32.7%
sqrt-unprod76.1%
sqr-neg76.1%
sqrt-unprod43.7%
add-sqr-sqrt76.3%
*-commutative76.3%
Applied egg-rr76.3%
associate-*r/76.3%
*-commutative76.3%
times-frac76.2%
metadata-eval76.2%
+-commutative76.2%
associate-*r*76.2%
*-commutative76.2%
associate-*r*76.1%
*-commutative76.1%
Simplified76.1%
clear-num76.2%
un-div-inv76.2%
*-commutative76.2%
associate-*r*76.3%
Applied egg-rr76.3%
associate-/r/76.3%
*-commutative76.3%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt76.2%
Simplified76.2%
if 7e-109 < b Initial program 12.4%
sqr-neg12.4%
sqr-neg12.4%
associate-*l*12.4%
Simplified12.4%
Taylor expanded in b around inf 89.6%
*-commutative89.6%
associate-*l/89.6%
Simplified89.6%
Final simplification83.9%
(FPCore (a b c)
:precision binary64
(if (<= b -5e-124)
(fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
(if (<= b 7e-109)
(/ (* 0.3333333333333333 (+ b (sqrt (* (* a c) -3.0)))) a)
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-124) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else if (b <= 7e-109) {
tmp = (0.3333333333333333 * (b + sqrt(((a * c) * -3.0)))) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -5e-124) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); elseif (b <= 7e-109) tmp = Float64(Float64(0.3333333333333333 * Float64(b + sqrt(Float64(Float64(a * c) * -3.0)))) / a); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -5e-124], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-109], N[(N[(0.3333333333333333 * N[(b + N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-124}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-109}:\\
\;\;\;\;\frac{0.3333333333333333 \cdot \left(b + \sqrt{\left(a \cdot c\right) \cdot -3}\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -5.0000000000000003e-124Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.5%
Simplified74.5%
Taylor expanded in b around -inf 84.0%
fma-define84.0%
Simplified84.0%
if -5.0000000000000003e-124 < b < 7e-109Initial program 77.0%
sqr-neg77.0%
sqr-neg77.0%
associate-*l*76.8%
Simplified76.8%
Taylor expanded in b around 0 76.7%
*-commutative76.7%
associate-*r*76.7%
Simplified76.7%
*-un-lft-identity76.7%
+-commutative76.7%
add-sqr-sqrt32.7%
sqrt-unprod76.1%
sqr-neg76.1%
sqrt-unprod43.7%
add-sqr-sqrt76.3%
*-commutative76.3%
Applied egg-rr76.3%
associate-*r/76.3%
*-commutative76.3%
times-frac76.2%
metadata-eval76.2%
+-commutative76.2%
associate-*r*76.2%
*-commutative76.2%
associate-*r*76.1%
*-commutative76.1%
Simplified76.1%
associate-*r/76.1%
*-commutative76.1%
associate-*r*76.3%
Applied egg-rr76.3%
if 7e-109 < b Initial program 12.4%
sqr-neg12.4%
sqr-neg12.4%
associate-*l*12.4%
Simplified12.4%
Taylor expanded in b around inf 89.6%
*-commutative89.6%
associate-*l/89.6%
Simplified89.6%
Final simplification83.9%
(FPCore (a b c)
:precision binary64
(if (<= b -4.5e-129)
(fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
(if (<= b 2.3e-109)
(/ (+ b (sqrt (* a (* c -3.0)))) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.5e-129) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else if (b <= 2.3e-109) {
tmp = (b + sqrt((a * (c * -3.0)))) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -4.5e-129) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); elseif (b <= 2.3e-109) tmp = Float64(Float64(b + sqrt(Float64(a * Float64(c * -3.0)))) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -4.5e-129], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.3e-109], N[(N[(b + N[Sqrt[N[(a * N[(c * -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 -4.5 \cdot 10^{-129}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{-109}:\\
\;\;\;\;\frac{b + \sqrt{a \cdot \left(c \cdot -3\right)}}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.50000000000000031e-129Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.5%
Simplified74.5%
Taylor expanded in b around -inf 84.0%
fma-define84.0%
Simplified84.0%
if -4.50000000000000031e-129 < b < 2.3000000000000001e-109Initial program 77.0%
sqr-neg77.0%
sqr-neg77.0%
associate-*l*76.8%
Simplified76.8%
Taylor expanded in b around 0 76.7%
*-commutative76.7%
associate-*r*76.7%
Simplified76.7%
*-un-lft-identity76.7%
+-commutative76.7%
add-sqr-sqrt32.7%
sqrt-unprod76.1%
sqr-neg76.1%
sqrt-unprod43.7%
add-sqr-sqrt76.3%
*-commutative76.3%
Applied egg-rr76.3%
*-lft-identity76.3%
+-commutative76.3%
Simplified76.3%
if 2.3000000000000001e-109 < b Initial program 12.4%
sqr-neg12.4%
sqr-neg12.4%
associate-*l*12.4%
Simplified12.4%
Taylor expanded in b around inf 89.6%
*-commutative89.6%
associate-*l/89.6%
Simplified89.6%
Final simplification83.9%
(FPCore (a b c)
:precision binary64
(if (<= b -4e-124)
(fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
(if (<= b 3.8e-109)
(/ (- (sqrt (* (* a c) -3.0)) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4e-124) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else if (b <= 3.8e-109) {
tmp = (sqrt(((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 <= -4e-124) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); elseif (b <= 3.8e-109) tmp = Float64(Float64(sqrt(Float64(Float64(a * c) * -3.0)) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -4e-124], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.8e-109], N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $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 \cdot 10^{-124}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-109}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -3.99999999999999973e-124Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.5%
Simplified74.5%
Taylor expanded in b around -inf 84.0%
fma-define84.0%
Simplified84.0%
if -3.99999999999999973e-124 < b < 3.80000000000000002e-109Initial program 77.0%
sqr-neg77.0%
sqr-neg77.0%
associate-*l*76.8%
Simplified76.8%
Taylor expanded in b around 0 76.7%
if 3.80000000000000002e-109 < b Initial program 12.4%
sqr-neg12.4%
sqr-neg12.4%
associate-*l*12.4%
Simplified12.4%
Taylor expanded in b around inf 89.6%
*-commutative89.6%
associate-*l/89.6%
Simplified89.6%
Final simplification84.0%
(FPCore (a b c)
:precision binary64
(if (<= b -5e-124)
(fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
(if (<= b 8e-110)
(/ (- (sqrt (* a (* c -3.0))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-124) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else if (b <= 8e-110) {
tmp = (sqrt((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 <= -5e-124) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); elseif (b <= 8e-110) tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -5e-124], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8e-110], N[(N[(N[Sqrt[N[(a * N[(c * -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 -5 \cdot 10^{-124}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 8 \cdot 10^{-110}:\\
\;\;\;\;\frac{\sqrt{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 < -5.0000000000000003e-124Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.5%
Simplified74.5%
Taylor expanded in b around -inf 84.0%
fma-define84.0%
Simplified84.0%
if -5.0000000000000003e-124 < b < 8.0000000000000004e-110Initial program 77.0%
sqr-neg77.0%
sqr-neg77.0%
associate-*l*76.8%
Simplified76.8%
Taylor expanded in b around 0 76.7%
*-commutative76.7%
associate-*r*76.7%
Simplified76.7%
if 8.0000000000000004e-110 < b Initial program 12.4%
sqr-neg12.4%
sqr-neg12.4%
associate-*l*12.4%
Simplified12.4%
Taylor expanded in b around inf 89.6%
*-commutative89.6%
associate-*l/89.6%
Simplified89.6%
Final simplification84.0%
(FPCore (a b c)
:precision binary64
(if (<= b -5e-124)
(fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
(if (<= b 7e-109)
(/ (- (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 <= -5e-124) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else if (b <= 7e-109) {
tmp = (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 <= -5e-124) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); elseif (b <= 7e-109) 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
code[a_, b_, c_] := If[LessEqual[b, -5e-124], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-109], 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 -5 \cdot 10^{-124}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-109}:\\
\;\;\;\;\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 < -5.0000000000000003e-124Initial program 74.6%
sqr-neg74.6%
sqr-neg74.6%
associate-*l*74.5%
Simplified74.5%
Taylor expanded in b around -inf 84.0%
fma-define84.0%
Simplified84.0%
if -5.0000000000000003e-124 < b < 7e-109Initial program 77.0%
sqr-neg77.0%
sqr-neg77.0%
associate-*l*76.8%
Simplified76.8%
Taylor expanded in b around 0 76.7%
*-commutative76.7%
associate-*r*76.7%
Simplified76.7%
Taylor expanded in a around 0 76.7%
associate-*r*76.9%
*-commutative76.9%
Simplified76.9%
if 7e-109 < b Initial program 12.4%
sqr-neg12.4%
sqr-neg12.4%
associate-*l*12.4%
Simplified12.4%
Taylor expanded in b around inf 89.6%
*-commutative89.6%
associate-*l/89.6%
Simplified89.6%
Final simplification84.0%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 77.4%
sqr-neg77.4%
sqr-neg77.4%
associate-*l*77.4%
Simplified77.4%
Taylor expanded in b around -inf 70.3%
fma-define70.3%
Simplified70.3%
if -4.999999999999985e-310 < b Initial program 31.3%
sqr-neg31.3%
sqr-neg31.3%
associate-*l*31.2%
Simplified31.2%
Taylor expanded in b around inf 65.6%
*-commutative65.6%
associate-*l/65.7%
Simplified65.7%
Final simplification68.1%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (+ (* 0.5 (/ c b)) (* -0.6666666666666666 (/ b a))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-310)) then
tmp = (0.5d0 * (c / b)) + ((-0.6666666666666666d0) * (b / a))
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(0.5 * Float64(c / b)) + Float64(-0.6666666666666666 * Float64(b / a))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = (0.5 * (c / b)) + (-0.6666666666666666 * (b / a)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} + -0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 77.4%
sqr-neg77.4%
sqr-neg77.4%
associate-*l*77.4%
Simplified77.4%
Taylor expanded in b around -inf 70.3%
if -4.999999999999985e-310 < b Initial program 31.3%
sqr-neg31.3%
sqr-neg31.3%
associate-*l*31.2%
Simplified31.2%
Taylor expanded in b around inf 65.6%
*-commutative65.6%
associate-*l/65.7%
Simplified65.7%
Final simplification68.1%
(FPCore (a b c) :precision binary64 (if (<= b 1.4e-308) (* b (/ -0.6666666666666666 a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.4e-308) {
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.4d-308) 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.4e-308) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.4e-308: tmp = b * (-0.6666666666666666 / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.4e-308) 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.4e-308) tmp = b * (-0.6666666666666666 / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.4e-308], 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.4 \cdot 10^{-308}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 1.4000000000000002e-308Initial program 77.4%
sqr-neg77.4%
sqr-neg77.4%
associate-*l*77.4%
Simplified77.4%
Applied egg-rr63.8%
associate-/r*63.8%
Simplified63.8%
Taylor expanded in b around -inf 70.2%
associate-*r/70.3%
*-commutative70.3%
associate-/l*70.2%
Simplified70.2%
if 1.4000000000000002e-308 < b Initial program 31.3%
sqr-neg31.3%
sqr-neg31.3%
associate-*l*31.2%
Simplified31.2%
Taylor expanded in b around inf 53.4%
associate-/l*57.1%
Simplified57.1%
*-commutative57.1%
*-commutative57.1%
times-frac57.3%
metadata-eval57.3%
Applied egg-rr57.3%
expm1-log1p-u49.9%
expm1-undefine27.8%
associate-/l*27.1%
Applied egg-rr27.1%
expm1-define53.2%
associate-*r/49.9%
*-commutative49.9%
associate-*r/58.2%
*-inverses58.2%
*-rgt-identity58.2%
Simplified58.2%
Taylor expanded in c around 0 65.6%
associate-*r/65.7%
*-commutative65.7%
associate-/l*65.5%
Simplified65.5%
Final simplification67.9%
(FPCore (a b c) :precision binary64 (if (<= b 2e-309) (* -0.6666666666666666 (/ b a)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 2e-309) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 2d-309) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = c * ((-0.5d0) / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 2e-309) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 2e-309: tmp = -0.6666666666666666 * (b / a) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 2e-309) tmp = Float64(-0.6666666666666666 * Float64(b / 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 <= 2e-309) tmp = -0.6666666666666666 * (b / a); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 2e-309], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2 \cdot 10^{-309}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < 1.9999999999999988e-309Initial program 77.4%
sqr-neg77.4%
sqr-neg77.4%
associate-*l*77.4%
Simplified77.4%
Taylor expanded in b around -inf 70.2%
*-commutative70.2%
Simplified70.2%
if 1.9999999999999988e-309 < b Initial program 31.3%
sqr-neg31.3%
sqr-neg31.3%
associate-*l*31.2%
Simplified31.2%
Taylor expanded in b around inf 53.4%
associate-/l*57.1%
Simplified57.1%
*-commutative57.1%
*-commutative57.1%
times-frac57.3%
metadata-eval57.3%
Applied egg-rr57.3%
expm1-log1p-u49.9%
expm1-undefine27.8%
associate-/l*27.1%
Applied egg-rr27.1%
expm1-define53.2%
associate-*r/49.9%
*-commutative49.9%
associate-*r/58.2%
*-inverses58.2%
*-rgt-identity58.2%
Simplified58.2%
Taylor expanded in c around 0 65.6%
associate-*r/65.7%
*-commutative65.7%
associate-/l*65.5%
Simplified65.5%
Final simplification67.9%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (/ -0.6666666666666666 (/ a b)) (* c (/ -0.5 b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-5d-310)) then
tmp = (-0.6666666666666666d0) / (a / b)
else
tmp = c * ((-0.5d0) / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = c * (-0.5 / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = -0.6666666666666666 / (a / b) else: tmp = c * (-0.5 / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(-0.6666666666666666 / Float64(a / b)); else tmp = Float64(c * Float64(-0.5 / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -5e-310) tmp = -0.6666666666666666 / (a / b); else tmp = c * (-0.5 / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 77.4%
sqr-neg77.4%
sqr-neg77.4%
associate-*l*77.4%
Simplified77.4%
Taylor expanded in b around -inf 70.2%
*-commutative70.2%
Simplified70.2%
add-cbrt-cube37.3%
pow337.3%
associate-*l/37.4%
Applied egg-rr37.4%
rem-cbrt-cube70.3%
clear-num70.2%
*-un-lft-identity70.2%
*-commutative70.2%
times-frac70.2%
metadata-eval70.2%
Applied egg-rr70.2%
associate-/r*70.2%
metadata-eval70.2%
Simplified70.2%
if -4.999999999999985e-310 < b Initial program 31.3%
sqr-neg31.3%
sqr-neg31.3%
associate-*l*31.2%
Simplified31.2%
Taylor expanded in b around inf 53.4%
associate-/l*57.1%
Simplified57.1%
*-commutative57.1%
*-commutative57.1%
times-frac57.3%
metadata-eval57.3%
Applied egg-rr57.3%
expm1-log1p-u49.9%
expm1-undefine27.8%
associate-/l*27.1%
Applied egg-rr27.1%
expm1-define53.2%
associate-*r/49.9%
*-commutative49.9%
associate-*r/58.2%
*-inverses58.2%
*-rgt-identity58.2%
Simplified58.2%
Taylor expanded in c around 0 65.6%
associate-*r/65.7%
*-commutative65.7%
associate-/l*65.5%
Simplified65.5%
Final simplification68.0%
(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(c * Float64(-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[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 77.4%
sqr-neg77.4%
sqr-neg77.4%
associate-*l*77.4%
Simplified77.4%
Taylor expanded in b around -inf 70.2%
*-commutative70.2%
associate-*l/70.3%
Simplified70.3%
if -4.999999999999985e-310 < b Initial program 31.3%
sqr-neg31.3%
sqr-neg31.3%
associate-*l*31.2%
Simplified31.2%
Taylor expanded in b around inf 53.4%
associate-/l*57.1%
Simplified57.1%
*-commutative57.1%
*-commutative57.1%
times-frac57.3%
metadata-eval57.3%
Applied egg-rr57.3%
expm1-log1p-u49.9%
expm1-undefine27.8%
associate-/l*27.1%
Applied egg-rr27.1%
expm1-define53.2%
associate-*r/49.9%
*-commutative49.9%
associate-*r/58.2%
*-inverses58.2%
*-rgt-identity58.2%
Simplified58.2%
Taylor expanded in c around 0 65.6%
associate-*r/65.7%
*-commutative65.7%
associate-/l*65.5%
Simplified65.5%
Final simplification68.0%
(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 77.4%
sqr-neg77.4%
sqr-neg77.4%
associate-*l*77.4%
Simplified77.4%
Taylor expanded in b around -inf 70.2%
*-commutative70.2%
associate-*l/70.3%
Simplified70.3%
if -4.999999999999985e-310 < b Initial program 31.3%
sqr-neg31.3%
sqr-neg31.3%
associate-*l*31.2%
Simplified31.2%
Taylor expanded in b around inf 65.6%
*-commutative65.6%
associate-*l/65.7%
Simplified65.7%
Final simplification68.1%
(FPCore (a b c) :precision binary64 (* (/ b a) -0.3333333333333333))
double code(double a, double b, double c) {
return (b / a) * -0.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) * (-0.3333333333333333d0)
end function
public static double code(double a, double b, double c) {
return (b / a) * -0.3333333333333333;
}
def code(a, b, c): return (b / a) * -0.3333333333333333
function code(a, b, c) return Float64(Float64(b / a) * -0.3333333333333333) end
function tmp = code(a, b, c) tmp = (b / a) * -0.3333333333333333; end
code[a_, b_, c_] := N[(N[(b / a), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]
\begin{array}{l}
\\
\frac{b}{a} \cdot -0.3333333333333333
\end{array}
Initial program 55.3%
sqr-neg55.3%
sqr-neg55.3%
associate-*l*55.2%
Simplified55.2%
Applied egg-rr51.9%
associate-/r*51.9%
Simplified51.9%
Taylor expanded in a around inf 14.7%
Final simplification14.7%
(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 55.3%
sqr-neg55.3%
sqr-neg55.3%
associate-*l*55.2%
Simplified55.2%
Applied egg-rr51.9%
associate-/r*51.9%
Simplified51.9%
Taylor expanded in b around -inf 37.8%
associate-*r/37.9%
*-commutative37.9%
associate-/l*37.8%
Simplified37.8%
Final simplification37.8%
herbie shell --seed 2024046
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))