
(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 12 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 -2.95e+156)
(/ b (* a -1.5))
(if (<= b 2.4e-103)
(/ (- (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 <= -2.95e+156) {
tmp = b / (a * -1.5);
} else if (b <= 2.4e-103) {
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 <= (-2.95d+156)) then
tmp = b / (a * (-1.5d0))
else if (b <= 2.4d-103) 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 <= -2.95e+156) {
tmp = b / (a * -1.5);
} else if (b <= 2.4e-103) {
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 <= -2.95e+156: tmp = b / (a * -1.5) elif b <= 2.4e-103: 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 <= -2.95e+156) tmp = Float64(b / Float64(a * -1.5)); elseif (b <= 2.4e-103) 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 <= -2.95e+156) tmp = b / (a * -1.5); elseif (b <= 2.4e-103) 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, -2.95e+156], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.4e-103], 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 -2.95 \cdot 10^{+156}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{elif}\;b \leq 2.4 \cdot 10^{-103}:\\
\;\;\;\;\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 < -2.9499999999999998e156Initial program 35.8%
add-sqr-sqrt35.8%
pow235.8%
pow1/235.8%
sqrt-pow135.8%
sub-neg35.8%
+-commutative35.8%
*-commutative35.8%
distribute-rgt-neg-in35.8%
fma-def36.0%
*-commutative36.0%
distribute-rgt-neg-in36.0%
metadata-eval36.0%
pow236.0%
metadata-eval36.0%
Applied egg-rr36.0%
Taylor expanded in b around -inf 99.7%
associate-*r*99.7%
metadata-eval99.7%
*-commutative99.7%
associate-*l/99.5%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in a around 0 99.9%
*-commutative99.9%
Simplified99.9%
if -2.9499999999999998e156 < b < 2.4000000000000002e-103Initial program 84.3%
if 2.4000000000000002e-103 < b Initial program 15.5%
Taylor expanded in b around inf 89.7%
*-commutative89.7%
associate-*l/89.7%
Simplified89.7%
Final simplification89.1%
(FPCore (a b c)
:precision binary64
(if (<= b -4.6e-15)
(/ (- (- (* 1.5 (* c (/ a b))) b) b) (* a 3.0))
(if (<= b 5.8e-103)
(* (/ (- (sqrt (* a (* c -3.0))) b) a) 0.3333333333333333)
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.6e-15) {
tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0);
} else if (b <= 5.8e-103) {
tmp = ((sqrt((a * (c * -3.0))) - b) / a) * 0.3333333333333333;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4.6d-15)) then
tmp = (((1.5d0 * (c * (a / b))) - b) - b) / (a * 3.0d0)
else if (b <= 5.8d-103) then
tmp = ((sqrt((a * (c * (-3.0d0)))) - b) / a) * 0.3333333333333333d0
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4.6e-15) {
tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0);
} else if (b <= 5.8e-103) {
tmp = ((Math.sqrt((a * (c * -3.0))) - b) / a) * 0.3333333333333333;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.6e-15: tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0) elif b <= 5.8e-103: tmp = ((math.sqrt((a * (c * -3.0))) - b) / a) * 0.3333333333333333 else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.6e-15) tmp = Float64(Float64(Float64(Float64(1.5 * Float64(c * Float64(a / b))) - b) - b) / Float64(a * 3.0)); elseif (b <= 5.8e-103) tmp = Float64(Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / a) * 0.3333333333333333); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.6e-15) tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0); elseif (b <= 5.8e-103) tmp = ((sqrt((a * (c * -3.0))) - b) / a) * 0.3333333333333333; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.6e-15], N[(N[(N[(N[(1.5 * N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.8e-103], N[(N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.6 \cdot 10^{-15}:\\
\;\;\;\;\frac{\left(1.5 \cdot \left(c \cdot \frac{a}{b}\right) - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 5.8 \cdot 10^{-103}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.59999999999999981e-15Initial program 64.0%
add-sqr-sqrt63.9%
pow263.9%
pow1/263.9%
sqrt-pow163.9%
sub-neg63.9%
+-commutative63.9%
*-commutative63.9%
distribute-rgt-neg-in63.9%
fma-def64.0%
*-commutative64.0%
distribute-rgt-neg-in64.0%
metadata-eval64.0%
pow264.0%
metadata-eval64.0%
Applied egg-rr64.0%
Taylor expanded in b around -inf 92.7%
mul-1-neg92.7%
+-commutative92.7%
unsub-neg92.7%
associate-/l*95.1%
associate-/r/95.1%
*-commutative95.1%
Simplified95.1%
if -4.59999999999999981e-15 < b < 5.7999999999999997e-103Initial program 79.0%
add-sqr-sqrt78.7%
pow278.7%
pow1/278.7%
sqrt-pow178.7%
sub-neg78.7%
+-commutative78.7%
*-commutative78.7%
distribute-rgt-neg-in78.7%
fma-def78.7%
*-commutative78.7%
distribute-rgt-neg-in78.7%
metadata-eval78.7%
pow278.7%
metadata-eval78.7%
Applied egg-rr78.7%
Taylor expanded in c around inf 35.1%
Simplified69.4%
if 5.7999999999999997e-103 < b Initial program 15.5%
Taylor expanded in b around inf 89.7%
*-commutative89.7%
associate-*l/89.7%
Simplified89.7%
Final simplification86.1%
(FPCore (a b c)
:precision binary64
(if (<= b -4.6e-15)
(/ (- (- (* 1.5 (* c (/ a b))) b) b) (* a 3.0))
(if (<= b 3.1e-103)
(/ (- (sqrt (* -3.0 (* a c))) b) (* a 3.0))
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -4.6e-15) {
tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0);
} else if (b <= 3.1e-103) {
tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4.6d-15)) then
tmp = (((1.5d0 * (c * (a / b))) - b) - b) / (a * 3.0d0)
else if (b <= 3.1d-103) then
tmp = (sqrt(((-3.0d0) * (a * c))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4.6e-15) {
tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0);
} else if (b <= 3.1e-103) {
tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.6e-15: tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0) elif b <= 3.1e-103: tmp = (math.sqrt((-3.0 * (a * c))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.6e-15) tmp = Float64(Float64(Float64(Float64(1.5 * Float64(c * Float64(a / b))) - b) - b) / Float64(a * 3.0)); elseif (b <= 3.1e-103) tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.6e-15) tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0); elseif (b <= 3.1e-103) tmp = (sqrt((-3.0 * (a * c))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.6e-15], N[(N[(N[(N[(1.5 * N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.1e-103], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.6 \cdot 10^{-15}:\\
\;\;\;\;\frac{\left(1.5 \cdot \left(c \cdot \frac{a}{b}\right) - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 3.1 \cdot 10^{-103}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.59999999999999981e-15Initial program 64.0%
add-sqr-sqrt63.9%
pow263.9%
pow1/263.9%
sqrt-pow163.9%
sub-neg63.9%
+-commutative63.9%
*-commutative63.9%
distribute-rgt-neg-in63.9%
fma-def64.0%
*-commutative64.0%
distribute-rgt-neg-in64.0%
metadata-eval64.0%
pow264.0%
metadata-eval64.0%
Applied egg-rr64.0%
Taylor expanded in b around -inf 92.7%
mul-1-neg92.7%
+-commutative92.7%
unsub-neg92.7%
associate-/l*95.1%
associate-/r/95.1%
*-commutative95.1%
Simplified95.1%
if -4.59999999999999981e-15 < b < 3.1000000000000001e-103Initial program 79.0%
add-sqr-sqrt78.7%
pow278.7%
pow1/278.7%
sqrt-pow178.7%
sub-neg78.7%
+-commutative78.7%
*-commutative78.7%
distribute-rgt-neg-in78.7%
fma-def78.7%
*-commutative78.7%
distribute-rgt-neg-in78.7%
metadata-eval78.7%
pow278.7%
metadata-eval78.7%
Applied egg-rr78.7%
Taylor expanded in c around inf 35.1%
Simplified69.5%
Taylor expanded in a around 0 69.5%
if 3.1000000000000001e-103 < b Initial program 15.5%
Taylor expanded in b around inf 89.7%
*-commutative89.7%
associate-*l/89.7%
Simplified89.7%
Final simplification86.1%
(FPCore (a b c)
:precision binary64
(if (<= b -4.6e-15)
(/ (- (- (* 1.5 (* c (/ a b))) b) b) (* a 3.0))
(if (<= b 5.2e-103)
(/ (- (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 <= -4.6e-15) {
tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0);
} else if (b <= 5.2e-103) {
tmp = (sqrt((a * (c * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4.6d-15)) then
tmp = (((1.5d0 * (c * (a / b))) - b) - b) / (a * 3.0d0)
else if (b <= 5.2d-103) then
tmp = (sqrt((a * (c * (-3.0d0)))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4.6e-15) {
tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0);
} else if (b <= 5.2e-103) {
tmp = (Math.sqrt((a * (c * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.6e-15: tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0) elif b <= 5.2e-103: tmp = (math.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 <= -4.6e-15) tmp = Float64(Float64(Float64(Float64(1.5 * Float64(c * Float64(a / b))) - b) - b) / Float64(a * 3.0)); elseif (b <= 5.2e-103) 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
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.6e-15) tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0); elseif (b <= 5.2e-103) tmp = (sqrt((a * (c * -3.0))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.6e-15], N[(N[(N[(N[(1.5 * N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.2e-103], 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 -4.6 \cdot 10^{-15}:\\
\;\;\;\;\frac{\left(1.5 \cdot \left(c \cdot \frac{a}{b}\right) - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 5.2 \cdot 10^{-103}:\\
\;\;\;\;\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 < -4.59999999999999981e-15Initial program 64.0%
add-sqr-sqrt63.9%
pow263.9%
pow1/263.9%
sqrt-pow163.9%
sub-neg63.9%
+-commutative63.9%
*-commutative63.9%
distribute-rgt-neg-in63.9%
fma-def64.0%
*-commutative64.0%
distribute-rgt-neg-in64.0%
metadata-eval64.0%
pow264.0%
metadata-eval64.0%
Applied egg-rr64.0%
Taylor expanded in b around -inf 92.7%
mul-1-neg92.7%
+-commutative92.7%
unsub-neg92.7%
associate-/l*95.1%
associate-/r/95.1%
*-commutative95.1%
Simplified95.1%
if -4.59999999999999981e-15 < b < 5.19999999999999993e-103Initial program 79.0%
add-sqr-sqrt78.7%
pow278.7%
pow1/278.7%
sqrt-pow178.7%
sub-neg78.7%
+-commutative78.7%
*-commutative78.7%
distribute-rgt-neg-in78.7%
fma-def78.7%
*-commutative78.7%
distribute-rgt-neg-in78.7%
metadata-eval78.7%
pow278.7%
metadata-eval78.7%
Applied egg-rr78.7%
Taylor expanded in c around inf 35.1%
Simplified69.5%
if 5.19999999999999993e-103 < b Initial program 15.5%
Taylor expanded in b around inf 89.7%
*-commutative89.7%
associate-*l/89.7%
Simplified89.7%
Final simplification86.1%
(FPCore (a b c)
:precision binary64
(if (<= b -4.6e-15)
(/ (- (- (* 1.5 (* c (/ a b))) b) b) (* a 3.0))
(if (<= b 6.5e-103)
(/ (/ (- (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 <= -4.6e-15) {
tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0);
} else if (b <= 6.5e-103) {
tmp = ((sqrt((a * (c * -3.0))) - b) / a) / 3.0;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4.6d-15)) then
tmp = (((1.5d0 * (c * (a / b))) - b) - b) / (a * 3.0d0)
else if (b <= 6.5d-103) then
tmp = ((sqrt((a * (c * (-3.0d0)))) - b) / a) / 3.0d0
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4.6e-15) {
tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0);
} else if (b <= 6.5e-103) {
tmp = ((Math.sqrt((a * (c * -3.0))) - b) / a) / 3.0;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.6e-15: tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0) elif b <= 6.5e-103: tmp = ((math.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 <= -4.6e-15) tmp = Float64(Float64(Float64(Float64(1.5 * Float64(c * Float64(a / b))) - b) - b) / Float64(a * 3.0)); elseif (b <= 6.5e-103) tmp = Float64(Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / a) / 3.0); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.6e-15) tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0); elseif (b <= 6.5e-103) tmp = ((sqrt((a * (c * -3.0))) - b) / a) / 3.0; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.6e-15], N[(N[(N[(N[(1.5 * N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.5e-103], N[(N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.6 \cdot 10^{-15}:\\
\;\;\;\;\frac{\left(1.5 \cdot \left(c \cdot \frac{a}{b}\right) - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 6.5 \cdot 10^{-103}:\\
\;\;\;\;\frac{\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}}{3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.59999999999999981e-15Initial program 64.0%
add-sqr-sqrt63.9%
pow263.9%
pow1/263.9%
sqrt-pow163.9%
sub-neg63.9%
+-commutative63.9%
*-commutative63.9%
distribute-rgt-neg-in63.9%
fma-def64.0%
*-commutative64.0%
distribute-rgt-neg-in64.0%
metadata-eval64.0%
pow264.0%
metadata-eval64.0%
Applied egg-rr64.0%
Taylor expanded in b around -inf 92.7%
mul-1-neg92.7%
+-commutative92.7%
unsub-neg92.7%
associate-/l*95.1%
associate-/r/95.1%
*-commutative95.1%
Simplified95.1%
if -4.59999999999999981e-15 < b < 6.49999999999999966e-103Initial program 79.0%
add-sqr-sqrt78.7%
pow278.7%
pow1/278.7%
sqrt-pow178.7%
sub-neg78.7%
+-commutative78.7%
*-commutative78.7%
distribute-rgt-neg-in78.7%
fma-def78.7%
*-commutative78.7%
distribute-rgt-neg-in78.7%
metadata-eval78.7%
pow278.7%
metadata-eval78.7%
Applied egg-rr78.7%
Taylor expanded in c around inf 35.1%
Simplified69.5%
add-cube-cbrt68.8%
*-commutative68.8%
times-frac68.7%
pow268.7%
*-commutative68.7%
associate-*r*68.7%
*-commutative68.7%
Applied egg-rr68.7%
associate-*l/68.7%
associate-*r/68.7%
unpow268.7%
rem-3cbrt-lft69.6%
rem-square-sqrt69.2%
associate-*r/69.3%
associate-*l/69.2%
*-commutative69.2%
associate-*l/69.3%
Simplified69.6%
if 6.49999999999999966e-103 < b Initial program 15.5%
Taylor expanded in b around inf 89.7%
*-commutative89.7%
associate-*l/89.7%
Simplified89.7%
Final simplification86.1%
(FPCore (a b c)
:precision binary64
(if (<= b -1.12e-13)
(/ (- (- (* 1.5 (* c (/ a b))) b) b) (* a 3.0))
(if (<= b 6e-103)
(/ (/ (- (sqrt (* -3.0 (* a c))) b) 3.0) a)
(/ (* c -0.5) b))))
double code(double a, double b, double c) {
double tmp;
if (b <= -1.12e-13) {
tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0);
} else if (b <= 6e-103) {
tmp = ((sqrt((-3.0 * (a * c))) - b) / 3.0) / 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.12d-13)) then
tmp = (((1.5d0 * (c * (a / b))) - b) - b) / (a * 3.0d0)
else if (b <= 6d-103) then
tmp = ((sqrt(((-3.0d0) * (a * c))) - b) / 3.0d0) / 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.12e-13) {
tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0);
} else if (b <= 6e-103) {
tmp = ((Math.sqrt((-3.0 * (a * c))) - b) / 3.0) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -1.12e-13: tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0) elif b <= 6e-103: tmp = ((math.sqrt((-3.0 * (a * c))) - b) / 3.0) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -1.12e-13) tmp = Float64(Float64(Float64(Float64(1.5 * Float64(c * Float64(a / b))) - b) - b) / Float64(a * 3.0)); elseif (b <= 6e-103) tmp = Float64(Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / 3.0) / 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 <= -1.12e-13) tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0); elseif (b <= 6e-103) tmp = ((sqrt((-3.0 * (a * c))) - b) / 3.0) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -1.12e-13], N[(N[(N[(N[(1.5 * N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6e-103], N[(N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / 3.0), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.12 \cdot 10^{-13}:\\
\;\;\;\;\frac{\left(1.5 \cdot \left(c \cdot \frac{a}{b}\right) - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 6 \cdot 10^{-103}:\\
\;\;\;\;\frac{\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.12e-13Initial program 64.0%
add-sqr-sqrt63.9%
pow263.9%
pow1/263.9%
sqrt-pow163.9%
sub-neg63.9%
+-commutative63.9%
*-commutative63.9%
distribute-rgt-neg-in63.9%
fma-def64.0%
*-commutative64.0%
distribute-rgt-neg-in64.0%
metadata-eval64.0%
pow264.0%
metadata-eval64.0%
Applied egg-rr64.0%
Taylor expanded in b around -inf 92.7%
mul-1-neg92.7%
+-commutative92.7%
unsub-neg92.7%
associate-/l*95.1%
associate-/r/95.1%
*-commutative95.1%
Simplified95.1%
if -1.12e-13 < b < 6e-103Initial program 79.0%
add-sqr-sqrt78.7%
pow278.7%
pow1/278.7%
sqrt-pow178.7%
sub-neg78.7%
+-commutative78.7%
*-commutative78.7%
distribute-rgt-neg-in78.7%
fma-def78.7%
*-commutative78.7%
distribute-rgt-neg-in78.7%
metadata-eval78.7%
pow278.7%
metadata-eval78.7%
Applied egg-rr78.7%
Taylor expanded in c around inf 35.1%
Simplified69.5%
Taylor expanded in a around 0 69.5%
add-cube-cbrt68.6%
*-commutative68.6%
times-frac68.6%
pow268.6%
associate-*r*68.8%
*-commutative68.8%
*-commutative68.8%
Applied egg-rr68.7%
associate-*l/68.7%
associate-*r/68.7%
unpow268.7%
rem-3cbrt-lft69.6%
associate-*r*69.6%
Simplified69.6%
if 6e-103 < b Initial program 15.5%
Taylor expanded in b around inf 89.7%
*-commutative89.7%
associate-*l/89.7%
Simplified89.7%
Final simplification86.1%
(FPCore (a b c)
:precision binary64
(if (<= b -4.6e-15)
(/ (- (- (* 1.5 (* c (/ a b))) b) b) (* a 3.0))
(if (<= b 7e-103)
(/ (- (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 <= -4.6e-15) {
tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0);
} else if (b <= 7e-103) {
tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= (-4.6d-15)) then
tmp = (((1.5d0 * (c * (a / b))) - b) - b) / (a * 3.0d0)
else if (b <= 7d-103) then
tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
else
tmp = (c * (-0.5d0)) / b
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= -4.6e-15) {
tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0);
} else if (b <= 7e-103) {
tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -4.6e-15: tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0) elif b <= 7e-103: tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -4.6e-15) tmp = Float64(Float64(Float64(Float64(1.5 * Float64(c * Float64(a / b))) - b) - b) / Float64(a * 3.0)); elseif (b <= 7e-103) tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -4.6e-15) tmp = (((1.5 * (c * (a / b))) - b) - b) / (a * 3.0); elseif (b <= 7e-103) tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -4.6e-15], N[(N[(N[(N[(1.5 * N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-103], 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 -4.6 \cdot 10^{-15}:\\
\;\;\;\;\frac{\left(1.5 \cdot \left(c \cdot \frac{a}{b}\right) - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 7 \cdot 10^{-103}:\\
\;\;\;\;\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 < -4.59999999999999981e-15Initial program 64.0%
add-sqr-sqrt63.9%
pow263.9%
pow1/263.9%
sqrt-pow163.9%
sub-neg63.9%
+-commutative63.9%
*-commutative63.9%
distribute-rgt-neg-in63.9%
fma-def64.0%
*-commutative64.0%
distribute-rgt-neg-in64.0%
metadata-eval64.0%
pow264.0%
metadata-eval64.0%
Applied egg-rr64.0%
Taylor expanded in b around -inf 92.7%
mul-1-neg92.7%
+-commutative92.7%
unsub-neg92.7%
associate-/l*95.1%
associate-/r/95.1%
*-commutative95.1%
Simplified95.1%
if -4.59999999999999981e-15 < b < 7.00000000000000032e-103Initial program 79.0%
Taylor expanded in b around 0 69.5%
associate-*r*69.7%
*-commutative69.7%
*-commutative69.7%
Simplified69.7%
if 7.00000000000000032e-103 < b Initial program 15.5%
Taylor expanded in b around inf 89.7%
*-commutative89.7%
associate-*l/89.7%
Simplified89.7%
Final simplification86.1%
(FPCore (a b c) :precision binary64 (if (<= b -2e-310) (+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b))) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -2e-310) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / 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 <= (-2d-310)) then
tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / 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 <= -2e-310) {
tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -2e-310: tmp = (-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 <= -2e-310) tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b))); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= -2e-310) tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b)); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(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 -2 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.999999999999994e-310Initial program 70.0%
Taylor expanded in b around -inf 73.0%
if -1.999999999999994e-310 < b Initial program 27.6%
Taylor expanded in b around inf 73.4%
*-commutative73.4%
associate-*l/73.4%
Simplified73.4%
Final simplification73.2%
(FPCore (a b c) :precision binary64 (if (<= b 1.9e-279) (/ b (* a -1.5)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.9e-279) {
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 <= 1.9d-279) 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 <= 1.9e-279) {
tmp = b / (a * -1.5);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.9e-279: tmp = b / (a * -1.5) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.9e-279) 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 <= 1.9e-279) tmp = b / (a * -1.5); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.9e-279], 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 1.9 \cdot 10^{-279}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.90000000000000016e-279Initial program 69.9%
add-sqr-sqrt69.8%
pow269.8%
pow1/269.8%
sqrt-pow169.8%
sub-neg69.8%
+-commutative69.8%
*-commutative69.8%
distribute-rgt-neg-in69.8%
fma-def69.8%
*-commutative69.8%
distribute-rgt-neg-in69.8%
metadata-eval69.8%
pow269.8%
metadata-eval69.8%
Applied egg-rr69.8%
Taylor expanded in b around -inf 71.1%
associate-*r*71.1%
metadata-eval71.1%
*-commutative71.1%
associate-*l/71.0%
associate-/l*71.0%
Simplified71.0%
Taylor expanded in a around 0 71.1%
*-commutative71.1%
Simplified71.1%
if 1.90000000000000016e-279 < b Initial program 26.7%
Taylor expanded in b around inf 75.1%
*-commutative75.1%
associate-*l/75.1%
Simplified75.1%
Final simplification73.1%
(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 48.5%
frac-2neg48.5%
div-inv48.4%
Applied egg-rr43.9%
associate-/r*43.9%
Simplified43.9%
associate-*r/43.9%
clear-num43.8%
un-div-inv43.9%
Applied egg-rr43.9%
Taylor expanded in b around -inf 37.1%
*-commutative37.1%
associate-*l/37.0%
associate-*r/37.1%
Simplified37.1%
Final simplification37.1%
(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 48.5%
Taylor expanded in b around -inf 37.1%
*-commutative37.1%
Simplified37.1%
Final simplification37.1%
(FPCore (a b c) :precision binary64 (/ b (* a -1.5)))
double code(double a, double b, double c) {
return b / (a * -1.5);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = b / (a * (-1.5d0))
end function
public static double code(double a, double b, double c) {
return b / (a * -1.5);
}
def code(a, b, c): return b / (a * -1.5)
function code(a, b, c) return Float64(b / Float64(a * -1.5)) end
function tmp = code(a, b, c) tmp = b / (a * -1.5); end
code[a_, b_, c_] := N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{b}{a \cdot -1.5}
\end{array}
Initial program 48.5%
add-sqr-sqrt46.7%
pow246.7%
pow1/246.7%
sqrt-pow146.7%
sub-neg46.7%
+-commutative46.7%
*-commutative46.7%
distribute-rgt-neg-in46.7%
fma-def46.8%
*-commutative46.8%
distribute-rgt-neg-in46.8%
metadata-eval46.8%
pow246.8%
metadata-eval46.8%
Applied egg-rr46.8%
Taylor expanded in b around -inf 37.1%
associate-*r*37.1%
metadata-eval37.1%
*-commutative37.1%
associate-*l/37.0%
associate-/l*37.1%
Simplified37.1%
Taylor expanded in a around 0 37.1%
*-commutative37.1%
Simplified37.1%
Final simplification37.1%
herbie shell --seed 2023339
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))