
(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 -4.5e+94)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 8e-149)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(if (<= b 105000.0)
(*
(/ (* a (* c -3.0)) (+ b (sqrt (fma a (* c -3.0) (pow b 2.0)))))
(/ 0.3333333333333333 a))
(/ 1.0 (+ (* -2.0 (/ b c)) (* 1.5 (/ a b))))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.5e+94) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 8e-149) {
tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else if (b <= 105000.0) {
tmp = ((a * (c * -3.0)) / (b + sqrt(fma(a, (c * -3.0), pow(b, 2.0))))) * (0.3333333333333333 / a);
} else {
tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b)));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -4.5e+94) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 8e-149) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)); elseif (b <= 105000.0) tmp = Float64(Float64(Float64(a * Float64(c * -3.0)) / Float64(b + sqrt(fma(a, Float64(c * -3.0), (b ^ 2.0))))) * Float64(0.3333333333333333 / a)); else tmp = Float64(1.0 / Float64(Float64(-2.0 * Float64(b / c)) + Float64(1.5 * Float64(a / b)))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -4.5e+94], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8e-149], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 105000.0], N[(N[(N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(1.5 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.5 \cdot 10^{+94}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 8 \cdot 10^{-149}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 105000:\\
\;\;\;\;\frac{a \cdot \left(c \cdot -3\right)}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, {b}^{2}\right)}} \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}\\
\end{array}
\end{array}
if b < -4.49999999999999972e94Initial program 59.3%
Taylor expanded in b around -inf 91.5%
if -4.49999999999999972e94 < b < 7.99999999999999983e-149Initial program 91.3%
if 7.99999999999999983e-149 < b < 105000Initial program 57.1%
Applied egg-rr57.1%
sub-neg57.1%
distribute-rgt-out--57.1%
Simplified57.1%
*-commutative57.1%
flip--56.8%
frac-times46.4%
add-sqr-sqrt46.3%
unpow246.3%
+-commutative46.3%
Applied egg-rr46.3%
times-frac56.7%
unpow256.7%
sqr-neg56.7%
cancel-sign-sub56.7%
fma-udef56.7%
associate-+l+75.6%
unpow275.6%
distribute-lft-in75.6%
neg-mul-175.6%
*-commutative75.6%
distribute-rgt1-in75.6%
metadata-eval75.6%
mul0-lft75.6%
mul0-lft75.6%
Simplified75.6%
if 105000 < b Initial program 13.8%
add-sqr-sqrt10.2%
pow210.2%
pow1/210.2%
sqrt-pow110.3%
sub-neg10.3%
+-commutative10.3%
distribute-lft-neg-in10.3%
*-commutative10.3%
distribute-rgt-neg-in10.3%
metadata-eval10.3%
associate-*r*10.3%
*-commutative10.3%
fma-udef10.3%
pow210.3%
metadata-eval10.3%
Applied egg-rr10.3%
clear-num10.3%
inv-pow10.3%
*-commutative10.3%
neg-mul-110.3%
pow-pow13.8%
metadata-eval13.8%
pow1/213.8%
fma-def13.8%
Applied egg-rr13.8%
unpow-113.8%
Simplified13.8%
Taylor expanded in b around inf 93.5%
Final simplification90.2%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))))
(if (<= b -4.5e-14)
(/ (+ (* 1.5 (* c (/ a b))) (* b -2.0)) (* a 3.0))
(if (<= b -8e-64)
t_0
(if (<= b -4.5e-133)
(* b (/ -0.6666666666666666 a))
(if (<= b 3e-12)
t_0
(/ 1.0 (+ (* -2.0 (/ b c)) (* 1.5 (/ a b))))))))))
double code(double a, double b, double c) {
double t_0 = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
double tmp;
if (b <= -4.5e-14) {
tmp = ((1.5 * (c * (a / b))) + (b * -2.0)) / (a * 3.0);
} else if (b <= -8e-64) {
tmp = t_0;
} else if (b <= -4.5e-133) {
tmp = b * (-0.6666666666666666 / a);
} else if (b <= 3e-12) {
tmp = t_0;
} else {
tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / 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) :: t_0
real(8) :: tmp
t_0 = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
if (b <= (-4.5d-14)) then
tmp = ((1.5d0 * (c * (a / b))) + (b * (-2.0d0))) / (a * 3.0d0)
else if (b <= (-8d-64)) then
tmp = t_0
else if (b <= (-4.5d-133)) then
tmp = b * ((-0.6666666666666666d0) / a)
else if (b <= 3d-12) then
tmp = t_0
else
tmp = 1.0d0 / (((-2.0d0) * (b / c)) + (1.5d0 * (a / b)))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
double tmp;
if (b <= -4.5e-14) {
tmp = ((1.5 * (c * (a / b))) + (b * -2.0)) / (a * 3.0);
} else if (b <= -8e-64) {
tmp = t_0;
} else if (b <= -4.5e-133) {
tmp = b * (-0.6666666666666666 / a);
} else if (b <= 3e-12) {
tmp = t_0;
} else {
tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b)));
}
return tmp;
}
def code(a, b, c): t_0 = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) tmp = 0 if b <= -4.5e-14: tmp = ((1.5 * (c * (a / b))) + (b * -2.0)) / (a * 3.0) elif b <= -8e-64: tmp = t_0 elif b <= -4.5e-133: tmp = b * (-0.6666666666666666 / a) elif b <= 3e-12: tmp = t_0 else: tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b))) return tmp
function code(a, b, c) t_0 = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)) tmp = 0.0 if (b <= -4.5e-14) tmp = Float64(Float64(Float64(1.5 * Float64(c * Float64(a / b))) + Float64(b * -2.0)) / Float64(a * 3.0)); elseif (b <= -8e-64) tmp = t_0; elseif (b <= -4.5e-133) tmp = Float64(b * Float64(-0.6666666666666666 / a)); elseif (b <= 3e-12) tmp = t_0; else tmp = Float64(1.0 / Float64(Float64(-2.0 * Float64(b / c)) + Float64(1.5 * Float64(a / b)))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); tmp = 0.0; if (b <= -4.5e-14) tmp = ((1.5 * (c * (a / b))) + (b * -2.0)) / (a * 3.0); elseif (b <= -8e-64) tmp = t_0; elseif (b <= -4.5e-133) tmp = b * (-0.6666666666666666 / a); elseif (b <= 3e-12) tmp = t_0; else tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b))); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -4.5e-14], N[(N[(N[(1.5 * N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * -2.0), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -8e-64], t$95$0, If[LessEqual[b, -4.5e-133], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3e-12], t$95$0, N[(1.0 / N[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(1.5 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{if}\;b \leq -4.5 \cdot 10^{-14}:\\
\;\;\;\;\frac{1.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -2}{a \cdot 3}\\
\mathbf{elif}\;b \leq -8 \cdot 10^{-64}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;b \leq -4.5 \cdot 10^{-133}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 3 \cdot 10^{-12}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}\\
\end{array}
\end{array}
if b < -4.4999999999999998e-14Initial program 72.3%
add-sqr-sqrt72.1%
pow272.1%
pow1/272.1%
sqrt-pow172.1%
sub-neg72.1%
+-commutative72.1%
distribute-lft-neg-in72.1%
*-commutative72.1%
distribute-rgt-neg-in72.1%
metadata-eval72.1%
associate-*r*72.1%
*-commutative72.1%
fma-udef72.2%
pow272.2%
metadata-eval72.2%
Applied egg-rr72.2%
Taylor expanded in b around -inf 82.5%
+-commutative82.5%
associate-/l*86.1%
associate-/r/86.1%
associate-*r*86.1%
metadata-eval86.1%
*-commutative86.1%
Simplified86.1%
if -4.4999999999999998e-14 < b < -7.99999999999999972e-64 or -4.50000000000000009e-133 < b < 3.0000000000000001e-12Initial program 81.7%
prod-diff81.4%
*-commutative81.4%
fma-def81.4%
associate-+l+81.4%
pow281.4%
*-commutative81.4%
distribute-rgt-neg-in81.4%
*-commutative81.4%
distribute-rgt-neg-in81.4%
metadata-eval81.4%
*-commutative81.4%
fma-udef81.4%
distribute-lft-neg-in81.4%
distribute-rgt-neg-in81.4%
*-commutative81.4%
distribute-rgt-neg-in81.4%
metadata-eval81.4%
associate-*l*81.4%
Applied egg-rr81.4%
Taylor expanded in b around 0 78.6%
neg-mul-178.6%
unsub-neg78.6%
distribute-rgt-out78.9%
metadata-eval78.9%
*-commutative78.9%
associate-*r*79.0%
Simplified79.0%
if -7.99999999999999972e-64 < b < -4.50000000000000009e-133Initial program 89.8%
Applied egg-rr89.6%
sub-neg89.6%
distribute-rgt-out--89.6%
Simplified89.6%
associate-*l/89.3%
*-commutative89.3%
sub-neg89.3%
+-commutative89.3%
neg-mul-189.3%
fma-udef89.3%
metadata-eval89.3%
div-inv89.5%
associate-/r*89.8%
*-commutative89.8%
associate-/r*89.5%
fma-udef89.5%
neg-mul-189.5%
+-commutative89.5%
sub-neg89.5%
Applied egg-rr89.5%
Taylor expanded in b around -inf 71.7%
*-commutative71.7%
associate-*l/71.8%
associate-*r/72.1%
Simplified72.1%
if 3.0000000000000001e-12 < b Initial program 14.6%
add-sqr-sqrt11.2%
pow211.2%
pow1/211.2%
sqrt-pow111.2%
sub-neg11.2%
+-commutative11.2%
distribute-lft-neg-in11.2%
*-commutative11.2%
distribute-rgt-neg-in11.2%
metadata-eval11.2%
associate-*r*11.2%
*-commutative11.2%
fma-udef11.3%
pow211.3%
metadata-eval11.3%
Applied egg-rr11.3%
clear-num11.2%
inv-pow11.2%
*-commutative11.2%
neg-mul-111.2%
pow-pow14.7%
metadata-eval14.7%
pow1/214.7%
fma-def14.7%
Applied egg-rr14.7%
unpow-114.7%
Simplified14.7%
Taylor expanded in b around inf 91.0%
Final simplification84.6%
(FPCore (a b c)
:precision binary64
(if (<= b -1.3e+97)
(+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
(if (<= b 3.2e-12)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(/ 1.0 (+ (* -2.0 (/ b c)) (* 1.5 (/ a b)))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.3e+97) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 3.2e-12) {
tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else {
tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / 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.3d+97)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else if (b <= 3.2d-12) then
tmp = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
else
tmp = 1.0d0 / (((-2.0d0) * (b / c)) + (1.5d0 * (a / b)))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.3e+97) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else if (b <= 3.2e-12) {
tmp = (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
} else {
tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b)));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.3e+97: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) elif b <= 3.2e-12: tmp = (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0) else: tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b))) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.3e+97) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); elseif (b <= 3.2e-12) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)); else tmp = Float64(1.0 / Float64(Float64(-2.0 * Float64(b / c)) + Float64(1.5 * Float64(a / b)))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.3e+97) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); elseif (b <= 3.2e-12) tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0); else tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.3e+97], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.2e-12], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(1.5 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.3 \cdot 10^{+97}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \leq 3.2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}\\
\end{array}
\end{array}
if b < -1.3e97Initial program 59.3%
Taylor expanded in b around -inf 91.5%
if -1.3e97 < b < 3.2000000000000001e-12Initial program 86.0%
if 3.2000000000000001e-12 < b Initial program 14.6%
add-sqr-sqrt11.2%
pow211.2%
pow1/211.2%
sqrt-pow111.2%
sub-neg11.2%
+-commutative11.2%
distribute-lft-neg-in11.2%
*-commutative11.2%
distribute-rgt-neg-in11.2%
metadata-eval11.2%
associate-*r*11.2%
*-commutative11.2%
fma-udef11.3%
pow211.3%
metadata-eval11.3%
Applied egg-rr11.3%
clear-num11.2%
inv-pow11.2%
*-commutative11.2%
neg-mul-111.2%
pow-pow14.7%
metadata-eval14.7%
pow1/214.7%
fma-def14.7%
Applied egg-rr14.7%
unpow-114.7%
Simplified14.7%
Taylor expanded in b around inf 91.0%
Final simplification88.7%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* 0.3333333333333333 (/ (sqrt (* c (* a -3.0))) a))))
(if (<= b -1.4e-17)
(/ (+ (* 1.5 (* c (/ a b))) (* b -2.0)) (* a 3.0))
(if (<= b -5.5e-63)
t_0
(if (<= b -4.5e-133)
(* b (/ -0.6666666666666666 a))
(if (<= b 3e-12)
t_0
(/ 1.0 (+ (* -2.0 (/ b c)) (* 1.5 (/ a b))))))))))
double code(double a, double b, double c) {
double t_0 = 0.3333333333333333 * (sqrt((c * (a * -3.0))) / a);
double tmp;
if (b <= -1.4e-17) {
tmp = ((1.5 * (c * (a / b))) + (b * -2.0)) / (a * 3.0);
} else if (b <= -5.5e-63) {
tmp = t_0;
} else if (b <= -4.5e-133) {
tmp = b * (-0.6666666666666666 / a);
} else if (b <= 3e-12) {
tmp = t_0;
} else {
tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / 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) :: t_0
real(8) :: tmp
t_0 = 0.3333333333333333d0 * (sqrt((c * (a * (-3.0d0)))) / a)
if (b <= (-1.4d-17)) then
tmp = ((1.5d0 * (c * (a / b))) + (b * (-2.0d0))) / (a * 3.0d0)
else if (b <= (-5.5d-63)) then
tmp = t_0
else if (b <= (-4.5d-133)) then
tmp = b * ((-0.6666666666666666d0) / a)
else if (b <= 3d-12) then
tmp = t_0
else
tmp = 1.0d0 / (((-2.0d0) * (b / c)) + (1.5d0 * (a / b)))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = 0.3333333333333333 * (Math.sqrt((c * (a * -3.0))) / a);
double tmp;
if (b <= -1.4e-17) {
tmp = ((1.5 * (c * (a / b))) + (b * -2.0)) / (a * 3.0);
} else if (b <= -5.5e-63) {
tmp = t_0;
} else if (b <= -4.5e-133) {
tmp = b * (-0.6666666666666666 / a);
} else if (b <= 3e-12) {
tmp = t_0;
} else {
tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b)));
}
return tmp;
}
def code(a, b, c): t_0 = 0.3333333333333333 * (math.sqrt((c * (a * -3.0))) / a) tmp = 0 if b <= -1.4e-17: tmp = ((1.5 * (c * (a / b))) + (b * -2.0)) / (a * 3.0) elif b <= -5.5e-63: tmp = t_0 elif b <= -4.5e-133: tmp = b * (-0.6666666666666666 / a) elif b <= 3e-12: tmp = t_0 else: tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b))) return tmp
function code(a, b, c) t_0 = Float64(0.3333333333333333 * Float64(sqrt(Float64(c * Float64(a * -3.0))) / a)) tmp = 0.0 if (b <= -1.4e-17) tmp = Float64(Float64(Float64(1.5 * Float64(c * Float64(a / b))) + Float64(b * -2.0)) / Float64(a * 3.0)); elseif (b <= -5.5e-63) tmp = t_0; elseif (b <= -4.5e-133) tmp = Float64(b * Float64(-0.6666666666666666 / a)); elseif (b <= 3e-12) tmp = t_0; else tmp = Float64(1.0 / Float64(Float64(-2.0 * Float64(b / c)) + Float64(1.5 * Float64(a / b)))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = 0.3333333333333333 * (sqrt((c * (a * -3.0))) / a); tmp = 0.0; if (b <= -1.4e-17) tmp = ((1.5 * (c * (a / b))) + (b * -2.0)) / (a * 3.0); elseif (b <= -5.5e-63) tmp = t_0; elseif (b <= -4.5e-133) tmp = b * (-0.6666666666666666 / a); elseif (b <= 3e-12) tmp = t_0; else tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b))); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[(0.3333333333333333 * N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.4e-17], N[(N[(N[(1.5 * N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * -2.0), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -5.5e-63], t$95$0, If[LessEqual[b, -4.5e-133], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3e-12], t$95$0, N[(1.0 / N[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(1.5 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.3333333333333333 \cdot \frac{\sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\
\mathbf{if}\;b \leq -1.4 \cdot 10^{-17}:\\
\;\;\;\;\frac{1.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -2}{a \cdot 3}\\
\mathbf{elif}\;b \leq -5.5 \cdot 10^{-63}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;b \leq -4.5 \cdot 10^{-133}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 3 \cdot 10^{-12}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}\\
\end{array}
\end{array}
if b < -1.3999999999999999e-17Initial program 72.3%
add-sqr-sqrt72.1%
pow272.1%
pow1/272.1%
sqrt-pow172.1%
sub-neg72.1%
+-commutative72.1%
distribute-lft-neg-in72.1%
*-commutative72.1%
distribute-rgt-neg-in72.1%
metadata-eval72.1%
associate-*r*72.1%
*-commutative72.1%
fma-udef72.2%
pow272.2%
metadata-eval72.2%
Applied egg-rr72.2%
Taylor expanded in b around -inf 82.5%
+-commutative82.5%
associate-/l*86.1%
associate-/r/86.1%
associate-*r*86.1%
metadata-eval86.1%
*-commutative86.1%
Simplified86.1%
if -1.3999999999999999e-17 < b < -5.50000000000000043e-63 or -4.50000000000000009e-133 < b < 3.0000000000000001e-12Initial program 81.7%
prod-diff81.4%
*-commutative81.4%
fma-def81.4%
associate-+l+81.4%
pow281.4%
*-commutative81.4%
distribute-rgt-neg-in81.4%
*-commutative81.4%
distribute-rgt-neg-in81.4%
metadata-eval81.4%
*-commutative81.4%
fma-udef81.4%
distribute-lft-neg-in81.4%
distribute-rgt-neg-in81.4%
*-commutative81.4%
distribute-rgt-neg-in81.4%
metadata-eval81.4%
associate-*l*81.4%
Applied egg-rr81.4%
Taylor expanded in b around 0 77.6%
associate-*l/77.8%
*-lft-identity77.8%
distribute-rgt-out78.0%
metadata-eval78.0%
*-commutative78.0%
associate-*r*78.0%
Simplified78.0%
if -5.50000000000000043e-63 < b < -4.50000000000000009e-133Initial program 89.8%
Applied egg-rr89.6%
sub-neg89.6%
distribute-rgt-out--89.6%
Simplified89.6%
associate-*l/89.3%
*-commutative89.3%
sub-neg89.3%
+-commutative89.3%
neg-mul-189.3%
fma-udef89.3%
metadata-eval89.3%
div-inv89.5%
associate-/r*89.8%
*-commutative89.8%
associate-/r*89.5%
fma-udef89.5%
neg-mul-189.5%
+-commutative89.5%
sub-neg89.5%
Applied egg-rr89.5%
Taylor expanded in b around -inf 71.7%
*-commutative71.7%
associate-*l/71.8%
associate-*r/72.1%
Simplified72.1%
if 3.0000000000000001e-12 < b Initial program 14.6%
add-sqr-sqrt11.2%
pow211.2%
pow1/211.2%
sqrt-pow111.2%
sub-neg11.2%
+-commutative11.2%
distribute-lft-neg-in11.2%
*-commutative11.2%
distribute-rgt-neg-in11.2%
metadata-eval11.2%
associate-*r*11.2%
*-commutative11.2%
fma-udef11.3%
pow211.3%
metadata-eval11.3%
Applied egg-rr11.3%
clear-num11.2%
inv-pow11.2%
*-commutative11.2%
neg-mul-111.2%
pow-pow14.7%
metadata-eval14.7%
pow1/214.7%
fma-def14.7%
Applied egg-rr14.7%
unpow-114.7%
Simplified14.7%
Taylor expanded in b around inf 91.0%
Final simplification84.3%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (* c (* a -3.0)))))
(if (<= b -1.9e-17)
(/ (+ (* 1.5 (* c (/ a b))) (* b -2.0)) (* a 3.0))
(if (<= b -7.8e-64)
(* t_0 (* 0.3333333333333333 (/ 1.0 a)))
(if (<= b -4.5e-133)
(* b (/ -0.6666666666666666 a))
(if (<= b 5.5e-11)
(* 0.3333333333333333 (/ t_0 a))
(/ 1.0 (+ (* -2.0 (/ b c)) (* 1.5 (/ a b))))))))))
double code(double a, double b, double c) {
double t_0 = sqrt((c * (a * -3.0)));
double tmp;
if (b <= -1.9e-17) {
tmp = ((1.5 * (c * (a / b))) + (b * -2.0)) / (a * 3.0);
} else if (b <= -7.8e-64) {
tmp = t_0 * (0.3333333333333333 * (1.0 / a));
} else if (b <= -4.5e-133) {
tmp = b * (-0.6666666666666666 / a);
} else if (b <= 5.5e-11) {
tmp = 0.3333333333333333 * (t_0 / a);
} else {
tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / 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) :: t_0
real(8) :: tmp
t_0 = sqrt((c * (a * (-3.0d0))))
if (b <= (-1.9d-17)) then
tmp = ((1.5d0 * (c * (a / b))) + (b * (-2.0d0))) / (a * 3.0d0)
else if (b <= (-7.8d-64)) then
tmp = t_0 * (0.3333333333333333d0 * (1.0d0 / a))
else if (b <= (-4.5d-133)) then
tmp = b * ((-0.6666666666666666d0) / a)
else if (b <= 5.5d-11) then
tmp = 0.3333333333333333d0 * (t_0 / a)
else
tmp = 1.0d0 / (((-2.0d0) * (b / c)) + (1.5d0 * (a / b)))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double t_0 = Math.sqrt((c * (a * -3.0)));
double tmp;
if (b <= -1.9e-17) {
tmp = ((1.5 * (c * (a / b))) + (b * -2.0)) / (a * 3.0);
} else if (b <= -7.8e-64) {
tmp = t_0 * (0.3333333333333333 * (1.0 / a));
} else if (b <= -4.5e-133) {
tmp = b * (-0.6666666666666666 / a);
} else if (b <= 5.5e-11) {
tmp = 0.3333333333333333 * (t_0 / a);
} else {
tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b)));
}
return tmp;
}
def code(a, b, c): t_0 = math.sqrt((c * (a * -3.0))) tmp = 0 if b <= -1.9e-17: tmp = ((1.5 * (c * (a / b))) + (b * -2.0)) / (a * 3.0) elif b <= -7.8e-64: tmp = t_0 * (0.3333333333333333 * (1.0 / a)) elif b <= -4.5e-133: tmp = b * (-0.6666666666666666 / a) elif b <= 5.5e-11: tmp = 0.3333333333333333 * (t_0 / a) else: tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b))) return tmp
function code(a, b, c) t_0 = sqrt(Float64(c * Float64(a * -3.0))) tmp = 0.0 if (b <= -1.9e-17) tmp = Float64(Float64(Float64(1.5 * Float64(c * Float64(a / b))) + Float64(b * -2.0)) / Float64(a * 3.0)); elseif (b <= -7.8e-64) tmp = Float64(t_0 * Float64(0.3333333333333333 * Float64(1.0 / a))); elseif (b <= -4.5e-133) tmp = Float64(b * Float64(-0.6666666666666666 / a)); elseif (b <= 5.5e-11) tmp = Float64(0.3333333333333333 * Float64(t_0 / a)); else tmp = Float64(1.0 / Float64(Float64(-2.0 * Float64(b / c)) + Float64(1.5 * Float64(a / b)))); end return tmp end
function tmp_2 = code(a, b, c) t_0 = sqrt((c * (a * -3.0))); tmp = 0.0; if (b <= -1.9e-17) tmp = ((1.5 * (c * (a / b))) + (b * -2.0)) / (a * 3.0); elseif (b <= -7.8e-64) tmp = t_0 * (0.3333333333333333 * (1.0 / a)); elseif (b <= -4.5e-133) tmp = b * (-0.6666666666666666 / a); elseif (b <= 5.5e-11) tmp = 0.3333333333333333 * (t_0 / a); else tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b))); end tmp_2 = tmp; end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -1.9e-17], N[(N[(N[(1.5 * N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * -2.0), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -7.8e-64], N[(t$95$0 * N[(0.3333333333333333 * N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -4.5e-133], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.5e-11], N[(0.3333333333333333 * N[(t$95$0 / a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(1.5 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{c \cdot \left(a \cdot -3\right)}\\
\mathbf{if}\;b \leq -1.9 \cdot 10^{-17}:\\
\;\;\;\;\frac{1.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -2}{a \cdot 3}\\
\mathbf{elif}\;b \leq -7.8 \cdot 10^{-64}:\\
\;\;\;\;t_0 \cdot \left(0.3333333333333333 \cdot \frac{1}{a}\right)\\
\mathbf{elif}\;b \leq -4.5 \cdot 10^{-133}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{elif}\;b \leq 5.5 \cdot 10^{-11}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{t_0}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}\\
\end{array}
\end{array}
if b < -1.9000000000000001e-17Initial program 72.3%
add-sqr-sqrt72.1%
pow272.1%
pow1/272.1%
sqrt-pow172.1%
sub-neg72.1%
+-commutative72.1%
distribute-lft-neg-in72.1%
*-commutative72.1%
distribute-rgt-neg-in72.1%
metadata-eval72.1%
associate-*r*72.1%
*-commutative72.1%
fma-udef72.2%
pow272.2%
metadata-eval72.2%
Applied egg-rr72.2%
Taylor expanded in b around -inf 82.5%
+-commutative82.5%
associate-/l*86.1%
associate-/r/86.1%
associate-*r*86.1%
metadata-eval86.1%
*-commutative86.1%
Simplified86.1%
if -1.9000000000000001e-17 < b < -7.7999999999999994e-64Initial program 99.4%
prod-diff99.4%
*-commutative99.4%
fma-def99.4%
associate-+l+99.4%
pow299.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
metadata-eval99.4%
*-commutative99.4%
fma-udef99.4%
distribute-lft-neg-in99.4%
distribute-rgt-neg-in99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
metadata-eval99.4%
associate-*l*99.4%
Applied egg-rr99.4%
Taylor expanded in b around 0 98.8%
associate-*r*99.4%
distribute-rgt-out99.4%
metadata-eval99.4%
*-commutative99.4%
associate-*r*99.1%
Simplified99.1%
if -7.7999999999999994e-64 < b < -4.50000000000000009e-133Initial program 89.8%
Applied egg-rr89.6%
sub-neg89.6%
distribute-rgt-out--89.6%
Simplified89.6%
associate-*l/89.3%
*-commutative89.3%
sub-neg89.3%
+-commutative89.3%
neg-mul-189.3%
fma-udef89.3%
metadata-eval89.3%
div-inv89.5%
associate-/r*89.8%
*-commutative89.8%
associate-/r*89.5%
fma-udef89.5%
neg-mul-189.5%
+-commutative89.5%
sub-neg89.5%
Applied egg-rr89.5%
Taylor expanded in b around -inf 71.7%
*-commutative71.7%
associate-*l/71.8%
associate-*r/72.1%
Simplified72.1%
if -4.50000000000000009e-133 < b < 5.49999999999999975e-11Initial program 80.5%
prod-diff80.2%
*-commutative80.2%
fma-def80.2%
associate-+l+80.2%
pow280.2%
*-commutative80.2%
distribute-rgt-neg-in80.2%
*-commutative80.2%
distribute-rgt-neg-in80.2%
metadata-eval80.2%
*-commutative80.2%
fma-udef80.2%
distribute-lft-neg-in80.2%
distribute-rgt-neg-in80.2%
*-commutative80.2%
distribute-rgt-neg-in80.2%
metadata-eval80.2%
associate-*l*80.2%
Applied egg-rr80.2%
Taylor expanded in b around 0 76.2%
associate-*l/76.3%
*-lft-identity76.3%
distribute-rgt-out76.6%
metadata-eval76.6%
*-commutative76.6%
associate-*r*76.6%
Simplified76.6%
if 5.49999999999999975e-11 < b Initial program 14.6%
add-sqr-sqrt11.2%
pow211.2%
pow1/211.2%
sqrt-pow111.2%
sub-neg11.2%
+-commutative11.2%
distribute-lft-neg-in11.2%
*-commutative11.2%
distribute-rgt-neg-in11.2%
metadata-eval11.2%
associate-*r*11.2%
*-commutative11.2%
fma-udef11.3%
pow211.3%
metadata-eval11.3%
Applied egg-rr11.3%
clear-num11.2%
inv-pow11.2%
*-commutative11.2%
neg-mul-111.2%
pow-pow14.7%
metadata-eval14.7%
pow1/214.7%
fma-def14.7%
Applied egg-rr14.7%
unpow-114.7%
Simplified14.7%
Taylor expanded in b around inf 91.0%
Final simplification84.3%
(FPCore (a b c) :precision binary64 (if (<= b -2.05e-268) (+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b))) (/ 1.0 (+ (* -2.0 (/ b c)) (* 1.5 (/ a b))))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.05e-268) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else {
tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / 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.05d-268)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
else
tmp = 1.0d0 / (((-2.0d0) * (b / c)) + (1.5d0 * (a / b)))
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -2.05e-268) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else {
tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b)));
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2.05e-268: tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)) else: tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b))) return tmp
function code(a, b, c) tmp = 0.0 if (b <= -2.05e-268) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); else tmp = Float64(1.0 / Float64(Float64(-2.0 * Float64(b / c)) + Float64(1.5 * Float64(a / b)))); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2.05e-268) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); else tmp = 1.0 / ((-2.0 * (b / c)) + (1.5 * (a / b))); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2.05e-268], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(1.5 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.05 \cdot 10^{-268}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}\\
\end{array}
\end{array}
if b < -2.0499999999999999e-268Initial program 77.1%
Taylor expanded in b around -inf 70.0%
if -2.0499999999999999e-268 < b Initial program 42.3%
add-sqr-sqrt40.2%
pow240.2%
pow1/240.2%
sqrt-pow140.3%
sub-neg40.3%
+-commutative40.3%
distribute-lft-neg-in40.3%
*-commutative40.3%
distribute-rgt-neg-in40.3%
metadata-eval40.3%
associate-*r*40.3%
*-commutative40.3%
fma-udef40.3%
pow240.3%
metadata-eval40.3%
Applied egg-rr40.3%
clear-num40.3%
inv-pow40.3%
*-commutative40.3%
neg-mul-140.3%
pow-pow42.2%
metadata-eval42.2%
pow1/242.2%
fma-def42.2%
Applied egg-rr42.2%
unpow-142.2%
Simplified42.2%
Taylor expanded in b around inf 58.6%
Final simplification64.8%
(FPCore (a b c) :precision binary64 (if (<= b -1.4e-291) (* (/ b a) -0.3333333333333333) (/ 0.0 a)))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.4e-291) {
tmp = (b / a) * -0.3333333333333333;
} else {
tmp = 0.0 / a;
}
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-291)) then
tmp = (b / a) * (-0.3333333333333333d0)
else
tmp = 0.0d0 / a
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -1.4e-291) {
tmp = (b / a) * -0.3333333333333333;
} else {
tmp = 0.0 / a;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.4e-291: tmp = (b / a) * -0.3333333333333333 else: tmp = 0.0 / a return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.4e-291) tmp = Float64(Float64(b / a) * -0.3333333333333333); else tmp = Float64(0.0 / a); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -1.4e-291) tmp = (b / a) * -0.3333333333333333; else tmp = 0.0 / a; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.4e-291], N[(N[(b / a), $MachinePrecision] * -0.3333333333333333), $MachinePrecision], N[(0.0 / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.4 \cdot 10^{-291}:\\
\;\;\;\;\frac{b}{a} \cdot -0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{a}\\
\end{array}
\end{array}
if b < -1.4e-291Initial program 77.6%
add-sqr-sqrt77.3%
pow277.3%
pow1/277.3%
sqrt-pow177.3%
sub-neg77.3%
+-commutative77.3%
distribute-lft-neg-in77.3%
*-commutative77.3%
distribute-rgt-neg-in77.3%
metadata-eval77.3%
associate-*r*77.3%
*-commutative77.3%
fma-udef77.4%
pow277.4%
metadata-eval77.4%
Applied egg-rr77.4%
Taylor expanded in b around inf 30.7%
if -1.4e-291 < b Initial program 40.8%
add-sqr-sqrt38.7%
pow238.7%
pow1/238.7%
sqrt-pow138.8%
sub-neg38.8%
+-commutative38.8%
distribute-lft-neg-in38.8%
*-commutative38.8%
distribute-rgt-neg-in38.8%
metadata-eval38.8%
associate-*r*38.7%
*-commutative38.7%
fma-udef38.8%
pow238.8%
metadata-eval38.8%
Applied egg-rr38.8%
clear-num38.7%
inv-pow38.7%
*-commutative38.7%
neg-mul-138.7%
pow-pow40.7%
metadata-eval40.7%
pow1/240.7%
fma-def40.7%
Applied egg-rr40.7%
unpow-140.7%
Simplified40.7%
Taylor expanded in a around 0 16.9%
associate-*r/16.9%
distribute-rgt1-in16.9%
metadata-eval16.9%
mul0-lft16.9%
metadata-eval16.9%
Simplified16.9%
Final simplification24.5%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (* b (/ -0.6666666666666666 a)) (/ 0.0 a)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = 0.0 / a;
}
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 = 0.0d0 / a
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 = 0.0 / a;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = b * (-0.6666666666666666 / a) else: tmp = 0.0 / a return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(0.0 / a); 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 = 0.0 / a; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(0.0 / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{a}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 77.7%
Applied egg-rr77.6%
sub-neg77.6%
distribute-rgt-out--77.6%
Simplified77.6%
associate-*l/77.6%
*-commutative77.6%
sub-neg77.6%
+-commutative77.6%
neg-mul-177.6%
fma-udef77.6%
metadata-eval77.6%
div-inv77.7%
associate-/r*77.8%
*-commutative77.8%
associate-/r*77.7%
fma-udef77.7%
neg-mul-177.7%
+-commutative77.7%
sub-neg77.7%
Applied egg-rr77.7%
Taylor expanded in b around -inf 68.1%
*-commutative68.1%
associate-*l/68.0%
associate-*r/68.1%
Simplified68.1%
if -4.999999999999985e-310 < b Initial program 40.3%
add-sqr-sqrt38.2%
pow238.2%
pow1/238.2%
sqrt-pow138.3%
sub-neg38.3%
+-commutative38.3%
distribute-lft-neg-in38.3%
*-commutative38.3%
distribute-rgt-neg-in38.3%
metadata-eval38.3%
associate-*r*38.2%
*-commutative38.2%
fma-udef38.2%
pow238.2%
metadata-eval38.2%
Applied egg-rr38.2%
clear-num38.2%
inv-pow38.2%
*-commutative38.2%
neg-mul-138.2%
pow-pow40.2%
metadata-eval40.2%
pow1/240.2%
fma-def40.2%
Applied egg-rr40.2%
unpow-140.2%
Simplified40.2%
Taylor expanded in a around 0 17.0%
associate-*r/17.0%
distribute-rgt1-in17.0%
metadata-eval17.0%
mul0-lft17.0%
metadata-eval17.0%
Simplified17.0%
Final simplification45.4%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (/ b (* a -1.5)) (/ 0.0 a)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = b / (a * -1.5);
} else {
tmp = 0.0 / a;
}
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.0d0 / a
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.0 / a;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = b / (a * -1.5) else: tmp = 0.0 / a 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.0 / a); 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.0 / a; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], N[(0.0 / a), $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}{a}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 77.7%
frac-2neg77.7%
div-inv77.6%
Applied egg-rr77.7%
Taylor expanded in b around -inf 68.1%
*-commutative68.1%
Simplified68.1%
un-div-inv68.2%
times-frac68.1%
metadata-eval68.1%
associate-/r/68.1%
div-inv68.2%
metadata-eval68.2%
Applied egg-rr68.2%
if -4.999999999999985e-310 < b Initial program 40.3%
add-sqr-sqrt38.2%
pow238.2%
pow1/238.2%
sqrt-pow138.3%
sub-neg38.3%
+-commutative38.3%
distribute-lft-neg-in38.3%
*-commutative38.3%
distribute-rgt-neg-in38.3%
metadata-eval38.3%
associate-*r*38.2%
*-commutative38.2%
fma-udef38.2%
pow238.2%
metadata-eval38.2%
Applied egg-rr38.2%
clear-num38.2%
inv-pow38.2%
*-commutative38.2%
neg-mul-138.2%
pow-pow40.2%
metadata-eval40.2%
pow1/240.2%
fma-def40.2%
Applied egg-rr40.2%
unpow-140.2%
Simplified40.2%
Taylor expanded in a around 0 17.0%
associate-*r/17.0%
distribute-rgt1-in17.0%
metadata-eval17.0%
mul0-lft17.0%
metadata-eval17.0%
Simplified17.0%
Final simplification45.4%
(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 77.7%
frac-2neg77.7%
div-inv77.6%
Applied egg-rr77.7%
Taylor expanded in b around -inf 68.1%
*-commutative68.1%
Simplified68.1%
un-div-inv68.2%
times-frac68.1%
metadata-eval68.1%
associate-/r/68.1%
div-inv68.2%
metadata-eval68.2%
Applied egg-rr68.2%
if -4.999999999999985e-310 < b Initial program 40.3%
Taylor expanded in b around inf 60.4%
*-commutative60.4%
associate-*l/60.4%
Simplified60.4%
Final simplification64.7%
(FPCore (a b c) :precision binary64 (/ 0.0 a))
double code(double a, double b, double c) {
return 0.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 = 0.0d0 / a
end function
public static double code(double a, double b, double c) {
return 0.0 / a;
}
def code(a, b, c): return 0.0 / a
function code(a, b, c) return Float64(0.0 / a) end
function tmp = code(a, b, c) tmp = 0.0 / a; end
code[a_, b_, c_] := N[(0.0 / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{0}{a}
\end{array}
Initial program 61.0%
add-sqr-sqrt60.0%
pow260.0%
pow1/260.0%
sqrt-pow160.0%
sub-neg60.0%
+-commutative60.0%
distribute-lft-neg-in60.0%
*-commutative60.0%
distribute-rgt-neg-in60.0%
metadata-eval60.0%
associate-*r*60.0%
*-commutative60.0%
fma-udef60.0%
pow260.0%
metadata-eval60.0%
Applied egg-rr60.0%
clear-num60.0%
inv-pow60.0%
*-commutative60.0%
neg-mul-160.0%
pow-pow61.0%
metadata-eval61.0%
pow1/261.0%
fma-def61.0%
Applied egg-rr61.0%
unpow-161.0%
Simplified61.0%
Taylor expanded in a around 0 9.1%
associate-*r/9.1%
distribute-rgt1-in9.1%
metadata-eval9.1%
mul0-lft9.1%
metadata-eval9.1%
Simplified9.1%
Final simplification9.1%
herbie shell --seed 2023305
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))