
(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 14 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.8e+139)
(/ (/ b -1.5) a)
(if (<= b 1.1e-50)
(/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
(*
(pow (fma -0.5 (/ a b) (* 0.6666666666666666 (/ b c))) -1.0)
-0.3333333333333333))))
double code(double a, double b, double c) {
double tmp;
if (b <= -2.8e+139) {
tmp = (b / -1.5) / a;
} else if (b <= 1.1e-50) {
tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
} else {
tmp = pow(fma(-0.5, (a / b), (0.6666666666666666 * (b / c))), -1.0) * -0.3333333333333333;
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= -2.8e+139) tmp = Float64(Float64(b / -1.5) / a); elseif (b <= 1.1e-50) tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0)); else tmp = Float64((fma(-0.5, Float64(a / b), Float64(0.6666666666666666 * Float64(b / c))) ^ -1.0) * -0.3333333333333333); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, -2.8e+139], N[(N[(b / -1.5), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 1.1e-50], 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[Power[N[(-0.5 * N[(a / b), $MachinePrecision] + N[(0.6666666666666666 * N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * -0.3333333333333333), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.8 \cdot 10^{+139}:\\
\;\;\;\;\frac{\frac{b}{-1.5}}{a}\\
\mathbf{elif}\;b \leq 1.1 \cdot 10^{-50}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{fma}\left(-0.5, \frac{a}{b}, 0.6666666666666666 \cdot \frac{b}{c}\right)\right)}^{-1} \cdot -0.3333333333333333\\
\end{array}
\end{array}
if b < -2.7999999999999998e139Initial program 41.9%
Taylor expanded in b around -inf 94.5%
*-commutative94.5%
Simplified94.5%
add-cbrt-cube60.9%
pow1/334.3%
pow334.3%
Applied egg-rr34.3%
unpow1/360.9%
rem-cbrt-cube94.5%
metadata-eval94.5%
times-frac94.7%
associate-/l/94.7%
associate-/l*94.7%
metadata-eval94.7%
Applied egg-rr94.7%
if -2.7999999999999998e139 < b < 1.0999999999999999e-50Initial program 80.7%
if 1.0999999999999999e-50 < b Initial program 16.1%
fma-neg16.1%
associate-*l*16.1%
distribute-lft-neg-in16.1%
metadata-eval16.1%
*-commutative16.1%
associate-*r*16.1%
add-cube-cbrt12.4%
pow312.4%
*-commutative12.4%
associate-*r*12.4%
metadata-eval12.4%
distribute-rgt-neg-in12.4%
*-commutative12.4%
*-commutative12.4%
*-commutative12.4%
distribute-rgt-neg-in12.4%
metadata-eval12.4%
Applied egg-rr12.4%
frac-2neg12.4%
div-inv12.4%
Applied egg-rr16.6%
associate-*r/16.6%
times-frac16.6%
associate-*r*16.6%
*-commutative16.6%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt16.6%
metadata-eval16.6%
Simplified16.6%
clear-num16.6%
inv-pow16.6%
Applied egg-rr16.6%
Taylor expanded in b around inf 0.0%
+-commutative0.0%
fma-def0.0%
associate-*r/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt82.7%
times-frac82.8%
metadata-eval82.8%
Simplified82.8%
Final simplification83.5%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* 0.3333333333333333 (/ (- (sqrt (* a (* c -3.0))) b) a))))
(if (<= b -1.18e+80)
(/ (- (- (/ (* a 1.5) (/ b c)) b) b) (* a 3.0))
(if (<= b -7.2e+14)
t_0
(if (<= b -1.6e-8)
(fma b (/ -0.6666666666666666 a) (/ 0.5 (/ b c)))
(if (<= b 1.8e-52) t_0 (/ (* c -0.5) b)))))))
double code(double a, double b, double c) {
double t_0 = 0.3333333333333333 * ((sqrt((a * (c * -3.0))) - b) / a);
double tmp;
if (b <= -1.18e+80) {
tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= -7.2e+14) {
tmp = t_0;
} else if (b <= -1.6e-8) {
tmp = fma(b, (-0.6666666666666666 / a), (0.5 / (b / c)));
} else if (b <= 1.8e-52) {
tmp = t_0;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) t_0 = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / a)) tmp = 0.0 if (b <= -1.18e+80) tmp = Float64(Float64(Float64(Float64(Float64(a * 1.5) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); elseif (b <= -7.2e+14) tmp = t_0; elseif (b <= -1.6e-8) tmp = fma(b, Float64(-0.6666666666666666 / a), Float64(0.5 / Float64(b / c))); elseif (b <= 1.8e-52) tmp = t_0; else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.18e+80], N[(N[(N[(N[(N[(a * 1.5), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -7.2e+14], t$95$0, If[LessEqual[b, -1.6e-8], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision] + N[(0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.8e-52], t$95$0, N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}\\
\mathbf{if}\;b \leq -1.18 \cdot 10^{+80}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq -7.2 \cdot 10^{+14}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;b \leq -1.6 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, \frac{0.5}{\frac{b}{c}}\right)\\
\mathbf{elif}\;b \leq 1.8 \cdot 10^{-52}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.18e80Initial program 58.1%
Taylor expanded in b around -inf 91.8%
+-commutative91.8%
mul-1-neg91.8%
unsub-neg91.8%
associate-/l*95.9%
associate-*r/95.9%
Simplified95.9%
if -1.18e80 < b < -7.2e14 or -1.6000000000000001e-8 < b < 1.79999999999999994e-52Initial program 78.0%
Taylor expanded in b around 0 69.9%
associate-*r*70.0%
*-commutative70.0%
*-commutative70.0%
Simplified70.0%
+-commutative70.0%
unsub-neg70.0%
Applied egg-rr70.0%
associate-*r*69.9%
*-commutative69.9%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt69.9%
Simplified69.9%
*-un-lft-identity69.9%
metadata-eval69.9%
times-frac70.0%
metadata-eval70.0%
metadata-eval70.0%
Applied egg-rr70.0%
if -7.2e14 < b < -1.6000000000000001e-8Initial program 83.5%
Taylor expanded in b around -inf 83.5%
+-commutative83.5%
mul-1-neg83.5%
unsub-neg83.5%
associate-/l*83.5%
associate-*r/83.5%
Simplified83.5%
Taylor expanded in b around 0 83.5%
associate-*r/83.8%
*-commutative83.8%
associate-*r/83.8%
fma-def83.8%
associate-*r/83.8%
associate-/l*83.8%
Simplified83.8%
if 1.79999999999999994e-52 < b Initial program 16.1%
Taylor expanded in b around inf 82.6%
associate-*r/82.6%
Simplified82.6%
Final simplification80.1%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (- (sqrt (* a (* c -3.0))) b)))
(if (<= b -1.18e+80)
(/ (- (- (/ (* a 1.5) (/ b c)) b) b) (* a 3.0))
(if (<= b -7.2e+14)
(* 0.3333333333333333 (/ t_0 a))
(if (<= b -3.8e-8)
(fma b (/ -0.6666666666666666 a) (/ 0.5 (/ b c)))
(if (<= b 3.6e-52) (/ t_0 (* a 3.0)) (/ (* c -0.5) b)))))))
double code(double a, double b, double c) {
double t_0 = sqrt((a * (c * -3.0))) - b;
double tmp;
if (b <= -1.18e+80) {
tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= -7.2e+14) {
tmp = 0.3333333333333333 * (t_0 / a);
} else if (b <= -3.8e-8) {
tmp = fma(b, (-0.6666666666666666 / a), (0.5 / (b / c)));
} else if (b <= 3.6e-52) {
tmp = t_0 / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
function code(a, b, c) t_0 = Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) tmp = 0.0 if (b <= -1.18e+80) tmp = Float64(Float64(Float64(Float64(Float64(a * 1.5) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); elseif (b <= -7.2e+14) tmp = Float64(0.3333333333333333 * Float64(t_0 / a)); elseif (b <= -3.8e-8) tmp = fma(b, Float64(-0.6666666666666666 / a), Float64(0.5 / Float64(b / c))); elseif (b <= 3.6e-52) tmp = Float64(t_0 / Float64(a * 3.0)); else tmp = Float64(Float64(c * -0.5) / b); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[b, -1.18e+80], N[(N[(N[(N[(N[(a * 1.5), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -7.2e+14], N[(0.3333333333333333 * N[(t$95$0 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -3.8e-8], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision] + N[(0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.6e-52], N[(t$95$0 / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{a \cdot \left(c \cdot -3\right)} - b\\
\mathbf{if}\;b \leq -1.18 \cdot 10^{+80}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq -7.2 \cdot 10^{+14}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{t_0}{a}\\
\mathbf{elif}\;b \leq -3.8 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, \frac{0.5}{\frac{b}{c}}\right)\\
\mathbf{elif}\;b \leq 3.6 \cdot 10^{-52}:\\
\;\;\;\;\frac{t_0}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -1.18e80Initial program 58.1%
Taylor expanded in b around -inf 91.8%
+-commutative91.8%
mul-1-neg91.8%
unsub-neg91.8%
associate-/l*95.9%
associate-*r/95.9%
Simplified95.9%
if -1.18e80 < b < -7.2e14Initial program 99.2%
Taylor expanded in b around 0 80.6%
associate-*r*80.7%
*-commutative80.7%
*-commutative80.7%
Simplified80.7%
+-commutative80.7%
unsub-neg80.7%
Applied egg-rr80.7%
associate-*r*80.6%
*-commutative80.6%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt80.6%
Simplified80.6%
*-un-lft-identity80.6%
metadata-eval80.6%
times-frac80.9%
metadata-eval80.9%
metadata-eval80.9%
Applied egg-rr80.9%
if -7.2e14 < b < -3.80000000000000028e-8Initial program 83.5%
Taylor expanded in b around -inf 83.5%
+-commutative83.5%
mul-1-neg83.5%
unsub-neg83.5%
associate-/l*83.5%
associate-*r/83.5%
Simplified83.5%
Taylor expanded in b around 0 83.5%
associate-*r/83.8%
*-commutative83.8%
associate-*r/83.8%
fma-def83.8%
associate-*r/83.8%
associate-/l*83.8%
Simplified83.8%
if -3.80000000000000028e-8 < b < 3.59999999999999988e-52Initial program 74.7%
Taylor expanded in b around 0 68.3%
associate-*r*68.4%
*-commutative68.4%
*-commutative68.4%
Simplified68.4%
+-commutative68.4%
unsub-neg68.4%
Applied egg-rr68.4%
associate-*r*68.3%
*-commutative68.3%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt68.3%
Simplified68.3%
if 3.59999999999999988e-52 < b Initial program 16.1%
Taylor expanded in b around inf 82.6%
associate-*r/82.6%
Simplified82.6%
Final simplification80.1%
(FPCore (a b c)
:precision binary64
(if (<= b -1.18e+80)
(/ (- (- (/ (* a 1.5) (/ b c)) b) b) (* a 3.0))
(if (<= b -7.2e+14)
(* 0.3333333333333333 (/ (- (sqrt (* a (* c -3.0))) b) a))
(if (<= b -2.6e-8)
(fma b (/ -0.6666666666666666 a) (/ 0.5 (/ b c)))
(if (<= b 1.45e-54)
(/ (- (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 <= -1.18e+80) {
tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
} else if (b <= -7.2e+14) {
tmp = 0.3333333333333333 * ((sqrt((a * (c * -3.0))) - b) / a);
} else if (b <= -2.6e-8) {
tmp = fma(b, (-0.6666666666666666 / a), (0.5 / (b / c)));
} else if (b <= 1.45e-54) {
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 <= -1.18e+80) tmp = Float64(Float64(Float64(Float64(Float64(a * 1.5) / Float64(b / c)) - b) - b) / Float64(a * 3.0)); elseif (b <= -7.2e+14) tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / a)); elseif (b <= -2.6e-8) tmp = fma(b, Float64(-0.6666666666666666 / a), Float64(0.5 / Float64(b / c))); elseif (b <= 1.45e-54) 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, -1.18e+80], N[(N[(N[(N[(N[(a * 1.5), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -7.2e+14], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -2.6e-8], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision] + N[(0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.45e-54], 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 -1.18 \cdot 10^{+80}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq -7.2 \cdot 10^{+14}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}\\
\mathbf{elif}\;b \leq -2.6 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, \frac{0.5}{\frac{b}{c}}\right)\\
\mathbf{elif}\;b \leq 1.45 \cdot 10^{-54}:\\
\;\;\;\;\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 < -1.18e80Initial program 58.1%
Taylor expanded in b around -inf 91.8%
+-commutative91.8%
mul-1-neg91.8%
unsub-neg91.8%
associate-/l*95.9%
associate-*r/95.9%
Simplified95.9%
if -1.18e80 < b < -7.2e14Initial program 99.2%
Taylor expanded in b around 0 80.6%
associate-*r*80.7%
*-commutative80.7%
*-commutative80.7%
Simplified80.7%
+-commutative80.7%
unsub-neg80.7%
Applied egg-rr80.7%
associate-*r*80.6%
*-commutative80.6%
rem-square-sqrt0.0%
unpow20.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt80.6%
Simplified80.6%
*-un-lft-identity80.6%
metadata-eval80.6%
times-frac80.9%
metadata-eval80.9%
metadata-eval80.9%
Applied egg-rr80.9%
if -7.2e14 < b < -2.6000000000000001e-8Initial program 83.5%
Taylor expanded in b around -inf 83.5%
+-commutative83.5%
mul-1-neg83.5%
unsub-neg83.5%
associate-/l*83.5%
associate-*r/83.5%
Simplified83.5%
Taylor expanded in b around 0 83.5%
associate-*r/83.8%
*-commutative83.8%
associate-*r/83.8%
fma-def83.8%
associate-*r/83.8%
associate-/l*83.8%
Simplified83.8%
if -2.6000000000000001e-8 < b < 1.45000000000000007e-54Initial program 74.7%
Taylor expanded in b around 0 68.3%
associate-*r*68.4%
*-commutative68.4%
*-commutative68.4%
Simplified68.4%
+-commutative68.4%
unsub-neg68.4%
Applied egg-rr68.4%
if 1.45000000000000007e-54 < b Initial program 16.1%
Taylor expanded in b around inf 82.6%
associate-*r/82.6%
Simplified82.6%
Final simplification80.1%
(FPCore (a b c)
:precision binary64
(if (<= b -2.1e+140)
(/ (/ b -1.5) a)
(if (<= b 4.2e-49)
(/ (- (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.1e+140) {
tmp = (b / -1.5) / a;
} else if (b <= 4.2e-49) {
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.1d+140)) then
tmp = (b / (-1.5d0)) / a
else if (b <= 4.2d-49) 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.1e+140) {
tmp = (b / -1.5) / a;
} else if (b <= 4.2e-49) {
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.1e+140: tmp = (b / -1.5) / a elif b <= 4.2e-49: 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.1e+140) tmp = Float64(Float64(b / -1.5) / a); elseif (b <= 4.2e-49) 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.1e+140) tmp = (b / -1.5) / a; elseif (b <= 4.2e-49) 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.1e+140], N[(N[(b / -1.5), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 4.2e-49], 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.1 \cdot 10^{+140}:\\
\;\;\;\;\frac{\frac{b}{-1.5}}{a}\\
\mathbf{elif}\;b \leq 4.2 \cdot 10^{-49}:\\
\;\;\;\;\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.1000000000000002e140Initial program 41.9%
Taylor expanded in b around -inf 94.5%
*-commutative94.5%
Simplified94.5%
add-cbrt-cube60.9%
pow1/334.3%
pow334.3%
Applied egg-rr34.3%
unpow1/360.9%
rem-cbrt-cube94.5%
metadata-eval94.5%
times-frac94.7%
associate-/l/94.7%
associate-/l*94.7%
metadata-eval94.7%
Applied egg-rr94.7%
if -2.1000000000000002e140 < b < 4.1999999999999998e-49Initial program 80.7%
if 4.1999999999999998e-49 < b Initial program 16.1%
Taylor expanded in b around inf 82.6%
associate-*r/82.6%
Simplified82.6%
Final simplification83.4%
(FPCore (a b c) :precision binary64 (if (<= b -5e-310) (/ (- (- (/ (* a 1.5) (/ b c)) b) b) (* a 3.0)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= -5e-310) {
tmp = ((((a * 1.5) / (b / c)) - b) - 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 <= (-5d-310)) then
tmp = ((((a * 1.5d0) / (b / c)) - b) - 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 <= -5e-310) {
tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= -5e-310: tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= -5e-310) tmp = Float64(Float64(Float64(Float64(Float64(a * 1.5) / Float64(b / c)) - b) - 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 <= -5e-310) tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(N[(N[(N[(a * 1.5), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $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^{-310}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < -4.999999999999985e-310Initial program 74.3%
Taylor expanded in b around -inf 60.3%
+-commutative60.3%
mul-1-neg60.3%
unsub-neg60.3%
associate-/l*62.1%
associate-*r/62.1%
Simplified62.1%
if -4.999999999999985e-310 < b Initial program 33.5%
Taylor expanded in b around inf 63.2%
associate-*r/63.2%
Simplified63.2%
Final simplification62.7%
(FPCore (a b c) :precision binary64 (if (<= b -5e-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 <= -5e-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 <= (-5d-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 <= -5e-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 <= -5e-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 <= -5e-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 <= -5e-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, -5e-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 -5 \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 < -4.999999999999985e-310Initial program 74.3%
Taylor expanded in b around -inf 62.0%
if -4.999999999999985e-310 < b Initial program 33.5%
Taylor expanded in b around inf 63.2%
associate-*r/63.2%
Simplified63.2%
Final simplification62.7%
(FPCore (a b c) :precision binary64 (if (<= b 3.5e+34) (* b (/ -0.6666666666666666 a)) (* 0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.5e+34) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = 0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 3.5d+34) then
tmp = b * ((-0.6666666666666666d0) / a)
else
tmp = 0.5d0 * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 3.5e+34) {
tmp = b * (-0.6666666666666666 / a);
} else {
tmp = 0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3.5e+34: tmp = b * (-0.6666666666666666 / a) else: tmp = 0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3.5e+34) tmp = Float64(b * Float64(-0.6666666666666666 / a)); else tmp = Float64(0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 3.5e+34) tmp = b * (-0.6666666666666666 / a); else tmp = 0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3.5e+34], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.5 \cdot 10^{+34}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 3.49999999999999998e34Initial program 66.1%
Taylor expanded in b around -inf 38.5%
*-commutative38.5%
Simplified38.5%
*-commutative38.5%
clear-num38.5%
un-div-inv38.6%
Applied egg-rr38.6%
associate-/r/38.5%
Simplified38.5%
if 3.49999999999999998e34 < b Initial program 13.8%
Taylor expanded in b around -inf 2.2%
+-commutative2.2%
mul-1-neg2.2%
unsub-neg2.2%
associate-/l*2.5%
associate-*r/2.5%
Simplified2.5%
Taylor expanded in b around 0 27.1%
Final simplification35.2%
(FPCore (a b c) :precision binary64 (if (<= b 6.8e+35) (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 6.8e+35) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = 0.5 * (c / 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.8d+35) then
tmp = (-0.6666666666666666d0) * (b / a)
else
tmp = 0.5d0 * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 6.8e+35) {
tmp = -0.6666666666666666 * (b / a);
} else {
tmp = 0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 6.8e+35: tmp = -0.6666666666666666 * (b / a) else: tmp = 0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 6.8e+35) tmp = Float64(-0.6666666666666666 * Float64(b / a)); else tmp = Float64(0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 6.8e+35) tmp = -0.6666666666666666 * (b / a); else tmp = 0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 6.8e+35], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 6.8 \cdot 10^{+35}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 6.8000000000000002e35Initial program 66.1%
Taylor expanded in b around -inf 38.5%
*-commutative38.5%
Simplified38.5%
if 6.8000000000000002e35 < b Initial program 13.8%
Taylor expanded in b around -inf 2.2%
+-commutative2.2%
mul-1-neg2.2%
unsub-neg2.2%
associate-/l*2.5%
associate-*r/2.5%
Simplified2.5%
Taylor expanded in b around 0 27.1%
Final simplification35.2%
(FPCore (a b c) :precision binary64 (if (<= b 3.4e+34) (/ -0.6666666666666666 (/ a b)) (* 0.5 (/ c b))))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.4e+34) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = 0.5 * (c / b);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 3.4d+34) then
tmp = (-0.6666666666666666d0) / (a / b)
else
tmp = 0.5d0 * (c / b)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 3.4e+34) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = 0.5 * (c / b);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 3.4e+34: tmp = -0.6666666666666666 / (a / b) else: tmp = 0.5 * (c / b) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 3.4e+34) tmp = Float64(-0.6666666666666666 / Float64(a / b)); else tmp = Float64(0.5 * Float64(c / b)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 3.4e+34) tmp = -0.6666666666666666 / (a / b); else tmp = 0.5 * (c / b); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 3.4e+34], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.4 \cdot 10^{+34}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{c}{b}\\
\end{array}
\end{array}
if b < 3.3999999999999999e34Initial program 66.1%
Taylor expanded in b around -inf 38.5%
*-commutative38.5%
Simplified38.5%
*-commutative38.5%
clear-num38.5%
un-div-inv38.6%
Applied egg-rr38.6%
if 3.3999999999999999e34 < b Initial program 13.8%
Taylor expanded in b around -inf 2.2%
+-commutative2.2%
mul-1-neg2.2%
unsub-neg2.2%
associate-/l*2.5%
associate-*r/2.5%
Simplified2.5%
Taylor expanded in b around 0 27.1%
Final simplification35.3%
(FPCore (a b c) :precision binary64 (if (<= b 1.35e-290) (/ -0.6666666666666666 (/ a b)) (/ -0.5 (/ b c))))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.35e-290) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = -0.5 / (b / c);
}
return tmp;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (b <= 1.35d-290) then
tmp = (-0.6666666666666666d0) / (a / b)
else
tmp = (-0.5d0) / (b / c)
end if
code = tmp
end function
public static double code(double a, double b, double c) {
double tmp;
if (b <= 1.35e-290) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = -0.5 / (b / c);
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.35e-290: tmp = -0.6666666666666666 / (a / b) else: tmp = -0.5 / (b / c) return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.35e-290) tmp = Float64(-0.6666666666666666 / Float64(a / b)); else tmp = Float64(-0.5 / Float64(b / c)); end return tmp end
function tmp_2 = code(a, b, c) tmp = 0.0; if (b <= 1.35e-290) tmp = -0.6666666666666666 / (a / b); else tmp = -0.5 / (b / c); end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.35e-290], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(-0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.35 \cdot 10^{-290}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{\frac{b}{c}}\\
\end{array}
\end{array}
if b < 1.34999999999999999e-290Initial program 74.1%
Taylor expanded in b around -inf 60.2%
*-commutative60.2%
Simplified60.2%
*-commutative60.2%
clear-num60.2%
un-div-inv60.3%
Applied egg-rr60.3%
if 1.34999999999999999e-290 < b Initial program 32.8%
Taylor expanded in b around inf 64.5%
associate-*r/64.5%
associate-/l*64.0%
Simplified64.0%
Final simplification62.3%
(FPCore (a b c) :precision binary64 (if (<= b 1.35e-290) (/ -0.6666666666666666 (/ a b)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.35e-290) {
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 <= 1.35d-290) 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 <= 1.35e-290) {
tmp = -0.6666666666666666 / (a / b);
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.35e-290: tmp = -0.6666666666666666 / (a / b) else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.35e-290) tmp = Float64(-0.6666666666666666 / Float64(a / 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 <= 1.35e-290) tmp = -0.6666666666666666 / (a / b); else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.35e-290], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.35 \cdot 10^{-290}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.34999999999999999e-290Initial program 74.1%
Taylor expanded in b around -inf 60.2%
*-commutative60.2%
Simplified60.2%
*-commutative60.2%
clear-num60.2%
un-div-inv60.3%
Applied egg-rr60.3%
if 1.34999999999999999e-290 < b Initial program 32.8%
Taylor expanded in b around inf 64.5%
associate-*r/64.5%
Simplified64.5%
Final simplification62.6%
(FPCore (a b c) :precision binary64 (if (<= b 1.35e-290) (/ (/ b -1.5) a) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
double tmp;
if (b <= 1.35e-290) {
tmp = (b / -1.5) / 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.35d-290) then
tmp = (b / (-1.5d0)) / 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.35e-290) {
tmp = (b / -1.5) / a;
} else {
tmp = (c * -0.5) / b;
}
return tmp;
}
def code(a, b, c): tmp = 0 if b <= 1.35e-290: tmp = (b / -1.5) / a else: tmp = (c * -0.5) / b return tmp
function code(a, b, c) tmp = 0.0 if (b <= 1.35e-290) tmp = Float64(Float64(b / -1.5) / 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.35e-290) tmp = (b / -1.5) / a; else tmp = (c * -0.5) / b; end tmp_2 = tmp; end
code[a_, b_, c_] := If[LessEqual[b, 1.35e-290], N[(N[(b / -1.5), $MachinePrecision] / a), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.35 \cdot 10^{-290}:\\
\;\;\;\;\frac{\frac{b}{-1.5}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\
\end{array}
\end{array}
if b < 1.34999999999999999e-290Initial program 74.1%
Taylor expanded in b around -inf 60.2%
*-commutative60.2%
Simplified60.2%
add-cbrt-cube33.8%
pow1/317.9%
pow317.9%
Applied egg-rr17.9%
unpow1/333.8%
rem-cbrt-cube60.2%
metadata-eval60.2%
times-frac60.3%
associate-/l/60.3%
associate-/l*60.3%
metadata-eval60.3%
Applied egg-rr60.3%
if 1.34999999999999999e-290 < b Initial program 32.8%
Taylor expanded in b around inf 64.5%
associate-*r/64.5%
Simplified64.5%
Final simplification62.7%
(FPCore (a b c) :precision binary64 (* 0.5 (/ c b)))
double code(double a, double b, double c) {
return 0.5 * (c / b);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = 0.5d0 * (c / b)
end function
public static double code(double a, double b, double c) {
return 0.5 * (c / b);
}
def code(a, b, c): return 0.5 * (c / b)
function code(a, b, c) return Float64(0.5 * Float64(c / b)) end
function tmp = code(a, b, c) tmp = 0.5 * (c / b); end
code[a_, b_, c_] := N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \frac{c}{b}
\end{array}
Initial program 51.0%
Taylor expanded in b around -inf 27.1%
+-commutative27.1%
mul-1-neg27.1%
unsub-neg27.1%
associate-/l*28.0%
associate-*r/28.0%
Simplified28.0%
Taylor expanded in b around 0 10.0%
Final simplification10.0%
herbie shell --seed 2024019
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))