
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (-b + sqrt(((b * b) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c): return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c) return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a)) end
function tmp = code(a, b, c) tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a); end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\end{array}
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma (* c -3.0) a (* b b))))
(if (<= b 1.9)
(/ 1.0 (/ (* 3.0 a) (/ 1.0 (/ (+ (sqrt t_0) b) (- t_0 (* b b))))))
(/
1.0
(/
(fma
(fma
(*
(fma
(/ (* (pow a 3.0) -0.5625) (pow b 5.0))
c
(* (/ (* a a) (pow b 3.0)) -0.375))
-3.0)
c
(* 1.5 (/ a b)))
c
(* -2.0 b))
c)))))
double code(double a, double b, double c) {
double t_0 = fma((c * -3.0), a, (b * b));
double tmp;
if (b <= 1.9) {
tmp = 1.0 / ((3.0 * a) / (1.0 / ((sqrt(t_0) + b) / (t_0 - (b * b)))));
} else {
tmp = 1.0 / (fma(fma((fma(((pow(a, 3.0) * -0.5625) / pow(b, 5.0)), c, (((a * a) / pow(b, 3.0)) * -0.375)) * -3.0), c, (1.5 * (a / b))), c, (-2.0 * b)) / c);
}
return tmp;
}
function code(a, b, c) t_0 = fma(Float64(c * -3.0), a, Float64(b * b)) tmp = 0.0 if (b <= 1.9) tmp = Float64(1.0 / Float64(Float64(3.0 * a) / Float64(1.0 / Float64(Float64(sqrt(t_0) + b) / Float64(t_0 - Float64(b * b)))))); else tmp = Float64(1.0 / Float64(fma(fma(Float64(fma(Float64(Float64((a ^ 3.0) * -0.5625) / (b ^ 5.0)), c, Float64(Float64(Float64(a * a) / (b ^ 3.0)) * -0.375)) * -3.0), c, Float64(1.5 * Float64(a / b))), c, Float64(-2.0 * b)) / c)); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.9], N[(1.0 / N[(N[(3.0 * a), $MachinePrecision] / N[(1.0 / N[(N[(N[Sqrt[t$95$0], $MachinePrecision] + b), $MachinePrecision] / N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(N[(N[(N[(N[(N[Power[a, 3.0], $MachinePrecision] * -0.5625), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] * c + N[(N[(N[(a * a), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * -0.375), $MachinePrecision]), $MachinePrecision] * -3.0), $MachinePrecision] * c + N[(1.5 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c + N[(-2.0 * b), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)\\
\mathbf{if}\;b \leq 1.9:\\
\;\;\;\;\frac{1}{\frac{3 \cdot a}{\frac{1}{\frac{\sqrt{t\_0} + b}{t\_0 - b \cdot b}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{{a}^{3} \cdot -0.5625}{{b}^{5}}, c, \frac{a \cdot a}{{b}^{3}} \cdot -0.375\right) \cdot -3, c, 1.5 \cdot \frac{a}{b}\right), c, -2 \cdot b\right)}{c}}\\
\end{array}
\end{array}
if b < 1.8999999999999999Initial program 85.1%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6485.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.1
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6485.1
Applied rewrites84.9%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-*.f64N/A
lower--.f6486.3
Applied rewrites86.3%
if 1.8999999999999999 < b Initial program 48.3%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6448.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.3
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6448.3
Applied rewrites48.3%
Taylor expanded in c around 0
Applied rewrites95.2%
Taylor expanded in a around 0
Applied rewrites95.2%
Final simplification94.2%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma (* c -3.0) a (* b b))))
(if (<= b 1.9)
(/ 1.0 (/ (* 3.0 a) (/ 1.0 (/ (+ (sqrt t_0) b) (- t_0 (* b b))))))
(fma
(/
(fma
(* -1.0546875 (* a a))
(pow c 4.0)
(*
(fma (* -0.375 (* b b)) (* c c) (* (* (pow c 3.0) a) -0.5625))
(* b b)))
(pow b 7.0))
a
(* -0.5 (/ c b))))))
double code(double a, double b, double c) {
double t_0 = fma((c * -3.0), a, (b * b));
double tmp;
if (b <= 1.9) {
tmp = 1.0 / ((3.0 * a) / (1.0 / ((sqrt(t_0) + b) / (t_0 - (b * b)))));
} else {
tmp = fma((fma((-1.0546875 * (a * a)), pow(c, 4.0), (fma((-0.375 * (b * b)), (c * c), ((pow(c, 3.0) * a) * -0.5625)) * (b * b))) / pow(b, 7.0)), a, (-0.5 * (c / b)));
}
return tmp;
}
function code(a, b, c) t_0 = fma(Float64(c * -3.0), a, Float64(b * b)) tmp = 0.0 if (b <= 1.9) tmp = Float64(1.0 / Float64(Float64(3.0 * a) / Float64(1.0 / Float64(Float64(sqrt(t_0) + b) / Float64(t_0 - Float64(b * b)))))); else tmp = fma(Float64(fma(Float64(-1.0546875 * Float64(a * a)), (c ^ 4.0), Float64(fma(Float64(-0.375 * Float64(b * b)), Float64(c * c), Float64(Float64((c ^ 3.0) * a) * -0.5625)) * Float64(b * b))) / (b ^ 7.0)), a, Float64(-0.5 * Float64(c / b))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.9], N[(1.0 / N[(N[(3.0 * a), $MachinePrecision] / N[(1.0 / N[(N[(N[Sqrt[t$95$0], $MachinePrecision] + b), $MachinePrecision] / N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(-1.0546875 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[Power[c, 4.0], $MachinePrecision] + N[(N[(N[(-0.375 * N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(c * c), $MachinePrecision] + N[(N[(N[Power[c, 3.0], $MachinePrecision] * a), $MachinePrecision] * -0.5625), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision] * a + N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)\\
\mathbf{if}\;b \leq 1.9:\\
\;\;\;\;\frac{1}{\frac{3 \cdot a}{\frac{1}{\frac{\sqrt{t\_0} + b}{t\_0 - b \cdot b}}}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(-1.0546875 \cdot \left(a \cdot a\right), {c}^{4}, \mathsf{fma}\left(-0.375 \cdot \left(b \cdot b\right), c \cdot c, \left({c}^{3} \cdot a\right) \cdot -0.5625\right) \cdot \left(b \cdot b\right)\right)}{{b}^{7}}, a, -0.5 \cdot \frac{c}{b}\right)\\
\end{array}
\end{array}
if b < 1.8999999999999999Initial program 85.1%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6485.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.1
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6485.1
Applied rewrites84.9%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-*.f64N/A
lower--.f6486.3
Applied rewrites86.3%
if 1.8999999999999999 < b Initial program 48.3%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites95.1%
Taylor expanded in b around 0
Applied rewrites95.1%
Final simplification94.2%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma (* c -3.0) a (* b b))))
(if (<= b 2.7)
(/ 1.0 (/ (* 3.0 a) (/ 1.0 (/ (+ (sqrt t_0) b) (- t_0 (* b b))))))
(/
1.0
(/
(fma
(fma (* c -3.0) (* (/ (* a a) (pow b 3.0)) -0.375) (* 1.5 (/ a b)))
c
(* -2.0 b))
c)))))
double code(double a, double b, double c) {
double t_0 = fma((c * -3.0), a, (b * b));
double tmp;
if (b <= 2.7) {
tmp = 1.0 / ((3.0 * a) / (1.0 / ((sqrt(t_0) + b) / (t_0 - (b * b)))));
} else {
tmp = 1.0 / (fma(fma((c * -3.0), (((a * a) / pow(b, 3.0)) * -0.375), (1.5 * (a / b))), c, (-2.0 * b)) / c);
}
return tmp;
}
function code(a, b, c) t_0 = fma(Float64(c * -3.0), a, Float64(b * b)) tmp = 0.0 if (b <= 2.7) tmp = Float64(1.0 / Float64(Float64(3.0 * a) / Float64(1.0 / Float64(Float64(sqrt(t_0) + b) / Float64(t_0 - Float64(b * b)))))); else tmp = Float64(1.0 / Float64(fma(fma(Float64(c * -3.0), Float64(Float64(Float64(a * a) / (b ^ 3.0)) * -0.375), Float64(1.5 * Float64(a / b))), c, Float64(-2.0 * b)) / c)); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 2.7], N[(1.0 / N[(N[(3.0 * a), $MachinePrecision] / N[(1.0 / N[(N[(N[Sqrt[t$95$0], $MachinePrecision] + b), $MachinePrecision] / N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(N[(c * -3.0), $MachinePrecision] * N[(N[(N[(a * a), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * -0.375), $MachinePrecision] + N[(1.5 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c + N[(-2.0 * b), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)\\
\mathbf{if}\;b \leq 2.7:\\
\;\;\;\;\frac{1}{\frac{3 \cdot a}{\frac{1}{\frac{\sqrt{t\_0} + b}{t\_0 - b \cdot b}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(c \cdot -3, \frac{a \cdot a}{{b}^{3}} \cdot -0.375, 1.5 \cdot \frac{a}{b}\right), c, -2 \cdot b\right)}{c}}\\
\end{array}
\end{array}
if b < 2.7000000000000002Initial program 85.1%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6485.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.1
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6485.1
Applied rewrites84.9%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-*.f64N/A
lower--.f6486.3
Applied rewrites86.3%
if 2.7000000000000002 < b Initial program 48.3%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6448.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.3
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6448.3
Applied rewrites48.3%
Taylor expanded in c around 0
lower-/.f64N/A
Applied rewrites93.2%
Final simplification92.4%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma (* c -3.0) a (* b b))))
(if (<= b 2.7)
(/ 1.0 (/ (* 3.0 a) (/ 1.0 (/ (+ (sqrt t_0) b) (- t_0 (* b b))))))
(/
1.0
(fma
(fma (* (* (/ c (pow b 3.0)) -0.375) a) -3.0 (/ 1.5 b))
a
(* (/ b c) -2.0))))))
double code(double a, double b, double c) {
double t_0 = fma((c * -3.0), a, (b * b));
double tmp;
if (b <= 2.7) {
tmp = 1.0 / ((3.0 * a) / (1.0 / ((sqrt(t_0) + b) / (t_0 - (b * b)))));
} else {
tmp = 1.0 / fma(fma((((c / pow(b, 3.0)) * -0.375) * a), -3.0, (1.5 / b)), a, ((b / c) * -2.0));
}
return tmp;
}
function code(a, b, c) t_0 = fma(Float64(c * -3.0), a, Float64(b * b)) tmp = 0.0 if (b <= 2.7) tmp = Float64(1.0 / Float64(Float64(3.0 * a) / Float64(1.0 / Float64(Float64(sqrt(t_0) + b) / Float64(t_0 - Float64(b * b)))))); else tmp = Float64(1.0 / fma(fma(Float64(Float64(Float64(c / (b ^ 3.0)) * -0.375) * a), -3.0, Float64(1.5 / b)), a, Float64(Float64(b / c) * -2.0))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 2.7], N[(1.0 / N[(N[(3.0 * a), $MachinePrecision] / N[(1.0 / N[(N[(N[Sqrt[t$95$0], $MachinePrecision] + b), $MachinePrecision] / N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(N[(N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * -0.375), $MachinePrecision] * a), $MachinePrecision] * -3.0 + N[(1.5 / b), $MachinePrecision]), $MachinePrecision] * a + N[(N[(b / c), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)\\
\mathbf{if}\;b \leq 2.7:\\
\;\;\;\;\frac{1}{\frac{3 \cdot a}{\frac{1}{\frac{\sqrt{t\_0} + b}{t\_0 - b \cdot b}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(\left(\frac{c}{{b}^{3}} \cdot -0.375\right) \cdot a, -3, \frac{1.5}{b}\right), a, \frac{b}{c} \cdot -2\right)}\\
\end{array}
\end{array}
if b < 2.7000000000000002Initial program 85.1%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6485.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.1
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6485.1
Applied rewrites84.9%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-*.f64N/A
lower--.f6486.3
Applied rewrites86.3%
if 2.7000000000000002 < b Initial program 48.3%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6448.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.3
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6448.3
Applied rewrites48.3%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites93.2%
Final simplification92.4%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma (* c -3.0) a (* b b))))
(if (<= b 2.7)
(/ 1.0 (/ (* 3.0 a) (/ 1.0 (/ (+ (sqrt t_0) b) (- t_0 (* b b))))))
(fma
(/ -0.5 b)
c
(*
(*
(* (fma (* (* b b) a) -0.375 (* (* (* a a) c) -0.5625)) (pow b -5.0))
c)
c)))))
double code(double a, double b, double c) {
double t_0 = fma((c * -3.0), a, (b * b));
double tmp;
if (b <= 2.7) {
tmp = 1.0 / ((3.0 * a) / (1.0 / ((sqrt(t_0) + b) / (t_0 - (b * b)))));
} else {
tmp = fma((-0.5 / b), c, (((fma(((b * b) * a), -0.375, (((a * a) * c) * -0.5625)) * pow(b, -5.0)) * c) * c));
}
return tmp;
}
function code(a, b, c) t_0 = fma(Float64(c * -3.0), a, Float64(b * b)) tmp = 0.0 if (b <= 2.7) tmp = Float64(1.0 / Float64(Float64(3.0 * a) / Float64(1.0 / Float64(Float64(sqrt(t_0) + b) / Float64(t_0 - Float64(b * b)))))); else tmp = fma(Float64(-0.5 / b), c, Float64(Float64(Float64(fma(Float64(Float64(b * b) * a), -0.375, Float64(Float64(Float64(a * a) * c) * -0.5625)) * (b ^ -5.0)) * c) * c)); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 2.7], N[(1.0 / N[(N[(3.0 * a), $MachinePrecision] / N[(1.0 / N[(N[(N[Sqrt[t$95$0], $MachinePrecision] + b), $MachinePrecision] / N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 / b), $MachinePrecision] * c + N[(N[(N[(N[(N[(N[(b * b), $MachinePrecision] * a), $MachinePrecision] * -0.375 + N[(N[(N[(a * a), $MachinePrecision] * c), $MachinePrecision] * -0.5625), $MachinePrecision]), $MachinePrecision] * N[Power[b, -5.0], $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)\\
\mathbf{if}\;b \leq 2.7:\\
\;\;\;\;\frac{1}{\frac{3 \cdot a}{\frac{1}{\frac{\sqrt{t\_0} + b}{t\_0 - b \cdot b}}}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-0.5}{b}, c, \left(\left(\mathsf{fma}\left(\left(b \cdot b\right) \cdot a, -0.375, \left(\left(a \cdot a\right) \cdot c\right) \cdot -0.5625\right) \cdot {b}^{-5}\right) \cdot c\right) \cdot c\right)\\
\end{array}
\end{array}
if b < 2.7000000000000002Initial program 85.1%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6485.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.1
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6485.1
Applied rewrites84.9%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-*.f64N/A
lower--.f6486.3
Applied rewrites86.3%
if 2.7000000000000002 < b Initial program 48.3%
Taylor expanded in c around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites92.9%
Taylor expanded in b around 0
Applied rewrites92.9%
Applied rewrites93.0%
Final simplification92.2%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma (* c -3.0) a (* b b))))
(if (<= b 2.7)
(/ 1.0 (/ (* 3.0 a) (/ 1.0 (/ (+ (sqrt t_0) b) (- t_0 (* b b))))))
(*
(fma
(* (fma (* (* b b) a) -0.375 (* (* (* a a) c) -0.5625)) (pow b -5.0))
c
(/ -0.5 b))
c))))
double code(double a, double b, double c) {
double t_0 = fma((c * -3.0), a, (b * b));
double tmp;
if (b <= 2.7) {
tmp = 1.0 / ((3.0 * a) / (1.0 / ((sqrt(t_0) + b) / (t_0 - (b * b)))));
} else {
tmp = fma((fma(((b * b) * a), -0.375, (((a * a) * c) * -0.5625)) * pow(b, -5.0)), c, (-0.5 / b)) * c;
}
return tmp;
}
function code(a, b, c) t_0 = fma(Float64(c * -3.0), a, Float64(b * b)) tmp = 0.0 if (b <= 2.7) tmp = Float64(1.0 / Float64(Float64(3.0 * a) / Float64(1.0 / Float64(Float64(sqrt(t_0) + b) / Float64(t_0 - Float64(b * b)))))); else tmp = Float64(fma(Float64(fma(Float64(Float64(b * b) * a), -0.375, Float64(Float64(Float64(a * a) * c) * -0.5625)) * (b ^ -5.0)), c, Float64(-0.5 / b)) * c); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 2.7], N[(1.0 / N[(N[(3.0 * a), $MachinePrecision] / N[(1.0 / N[(N[(N[Sqrt[t$95$0], $MachinePrecision] + b), $MachinePrecision] / N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(b * b), $MachinePrecision] * a), $MachinePrecision] * -0.375 + N[(N[(N[(a * a), $MachinePrecision] * c), $MachinePrecision] * -0.5625), $MachinePrecision]), $MachinePrecision] * N[Power[b, -5.0], $MachinePrecision]), $MachinePrecision] * c + N[(-0.5 / b), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)\\
\mathbf{if}\;b \leq 2.7:\\
\;\;\;\;\frac{1}{\frac{3 \cdot a}{\frac{1}{\frac{\sqrt{t\_0} + b}{t\_0 - b \cdot b}}}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(b \cdot b\right) \cdot a, -0.375, \left(\left(a \cdot a\right) \cdot c\right) \cdot -0.5625\right) \cdot {b}^{-5}, c, \frac{-0.5}{b}\right) \cdot c\\
\end{array}
\end{array}
if b < 2.7000000000000002Initial program 85.1%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6485.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6485.1
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6485.1
Applied rewrites84.9%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-*.f64N/A
lower--.f6486.3
Applied rewrites86.3%
if 2.7000000000000002 < b Initial program 48.3%
Taylor expanded in c around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites92.9%
Taylor expanded in b around 0
Applied rewrites92.9%
Applied rewrites92.9%
Final simplification92.2%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma (* c -3.0) a (* b b))) (t_1 (+ (sqrt t_0) b)))
(if (<= b 3.7)
(/ 1.0 (/ (* 3.0 a) (/ 1.0 (/ t_1 (- t_0 (* b b))))))
(/
(/
(* (* (fma (* 0.5 a) (* 6.75 (* (/ c b) (/ c b))) (* -4.5 c)) a) b)
(* (fma b t_1 t_0) a))
3.0))))
double code(double a, double b, double c) {
double t_0 = fma((c * -3.0), a, (b * b));
double t_1 = sqrt(t_0) + b;
double tmp;
if (b <= 3.7) {
tmp = 1.0 / ((3.0 * a) / (1.0 / (t_1 / (t_0 - (b * b)))));
} else {
tmp = (((fma((0.5 * a), (6.75 * ((c / b) * (c / b))), (-4.5 * c)) * a) * b) / (fma(b, t_1, t_0) * a)) / 3.0;
}
return tmp;
}
function code(a, b, c) t_0 = fma(Float64(c * -3.0), a, Float64(b * b)) t_1 = Float64(sqrt(t_0) + b) tmp = 0.0 if (b <= 3.7) tmp = Float64(1.0 / Float64(Float64(3.0 * a) / Float64(1.0 / Float64(t_1 / Float64(t_0 - Float64(b * b)))))); else tmp = Float64(Float64(Float64(Float64(fma(Float64(0.5 * a), Float64(6.75 * Float64(Float64(c / b) * Float64(c / b))), Float64(-4.5 * c)) * a) * b) / Float64(fma(b, t_1, t_0) * a)) / 3.0); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[t$95$0], $MachinePrecision] + b), $MachinePrecision]}, If[LessEqual[b, 3.7], N[(1.0 / N[(N[(3.0 * a), $MachinePrecision] / N[(1.0 / N[(t$95$1 / N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(0.5 * a), $MachinePrecision] * N[(6.75 * N[(N[(c / b), $MachinePrecision] * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-4.5 * c), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision] * b), $MachinePrecision] / N[(N[(b * t$95$1 + t$95$0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] / 3.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)\\
t_1 := \sqrt{t\_0} + b\\
\mathbf{if}\;b \leq 3.7:\\
\;\;\;\;\frac{1}{\frac{3 \cdot a}{\frac{1}{\frac{t\_1}{t\_0 - b \cdot b}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(\mathsf{fma}\left(0.5 \cdot a, 6.75 \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right), -4.5 \cdot c\right) \cdot a\right) \cdot b}{\mathsf{fma}\left(b, t\_1, t\_0\right) \cdot a}}{3}\\
\end{array}
\end{array}
if b < 3.7000000000000002Initial program 84.1%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6484.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.1
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6484.1
Applied rewrites84.0%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-*.f64N/A
lower--.f6485.4
Applied rewrites85.4%
if 3.7000000000000002 < b Initial program 48.0%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
associate-/l/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites48.0%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
flip3--N/A
lift-pow.f64N/A
unpow-1N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites48.7%
Taylor expanded in b around inf
Applied rewrites95.2%
Taylor expanded in a around 0
Applied rewrites88.2%
Final simplification87.9%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma (* c -3.0) a (* b b))))
(if (<= b 3.7)
(/ 1.0 (/ (* 3.0 a) (/ 1.0 (/ (+ (sqrt t_0) b) (- t_0 (* b b))))))
(/ 1.0 (fma (/ a b) 1.5 (* (/ b c) -2.0))))))
double code(double a, double b, double c) {
double t_0 = fma((c * -3.0), a, (b * b));
double tmp;
if (b <= 3.7) {
tmp = 1.0 / ((3.0 * a) / (1.0 / ((sqrt(t_0) + b) / (t_0 - (b * b)))));
} else {
tmp = 1.0 / fma((a / b), 1.5, ((b / c) * -2.0));
}
return tmp;
}
function code(a, b, c) t_0 = fma(Float64(c * -3.0), a, Float64(b * b)) tmp = 0.0 if (b <= 3.7) tmp = Float64(1.0 / Float64(Float64(3.0 * a) / Float64(1.0 / Float64(Float64(sqrt(t_0) + b) / Float64(t_0 - Float64(b * b)))))); else tmp = Float64(1.0 / fma(Float64(a / b), 1.5, Float64(Float64(b / c) * -2.0))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 3.7], N[(1.0 / N[(N[(3.0 * a), $MachinePrecision] / N[(1.0 / N[(N[(N[Sqrt[t$95$0], $MachinePrecision] + b), $MachinePrecision] / N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] * 1.5 + N[(N[(b / c), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)\\
\mathbf{if}\;b \leq 3.7:\\
\;\;\;\;\frac{1}{\frac{3 \cdot a}{\frac{1}{\frac{\sqrt{t\_0} + b}{t\_0 - b \cdot b}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{a}{b}, 1.5, \frac{b}{c} \cdot -2\right)}\\
\end{array}
\end{array}
if b < 3.7000000000000002Initial program 84.1%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6484.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.1
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6484.1
Applied rewrites84.0%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-*.f64N/A
lower--.f6485.4
Applied rewrites85.4%
if 3.7000000000000002 < b Initial program 48.0%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6448.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.0
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6448.0
Applied rewrites48.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6488.1
Applied rewrites88.1%
Final simplification87.8%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma (* c -3.0) a (* b b))))
(if (<= b 3.7)
(/ (* (/ 0.3333333333333333 a) (- t_0 (* b b))) (+ (sqrt t_0) b))
(/ 1.0 (fma (/ a b) 1.5 (* (/ b c) -2.0))))))
double code(double a, double b, double c) {
double t_0 = fma((c * -3.0), a, (b * b));
double tmp;
if (b <= 3.7) {
tmp = ((0.3333333333333333 / a) * (t_0 - (b * b))) / (sqrt(t_0) + b);
} else {
tmp = 1.0 / fma((a / b), 1.5, ((b / c) * -2.0));
}
return tmp;
}
function code(a, b, c) t_0 = fma(Float64(c * -3.0), a, Float64(b * b)) tmp = 0.0 if (b <= 3.7) tmp = Float64(Float64(Float64(0.3333333333333333 / a) * Float64(t_0 - Float64(b * b))) / Float64(sqrt(t_0) + b)); else tmp = Float64(1.0 / fma(Float64(a / b), 1.5, Float64(Float64(b / c) * -2.0))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 3.7], N[(N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[t$95$0], $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] * 1.5 + N[(N[(b / c), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)\\
\mathbf{if}\;b \leq 3.7:\\
\;\;\;\;\frac{\frac{0.3333333333333333}{a} \cdot \left(t\_0 - b \cdot b\right)}{\sqrt{t\_0} + b}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{a}{b}, 1.5, \frac{b}{c} \cdot -2\right)}\\
\end{array}
\end{array}
if b < 3.7000000000000002Initial program 84.1%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6484.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.1
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6484.1
Applied rewrites84.0%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lift--.f64N/A
flip--N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites85.3%
if 3.7000000000000002 < b Initial program 48.0%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6448.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.0
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6448.0
Applied rewrites48.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6488.1
Applied rewrites88.1%
Final simplification87.8%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma (* c -3.0) a (* b b))))
(if (<= b 3.7)
(/ (- t_0 (* b b)) (* (* 3.0 a) (+ (sqrt t_0) b)))
(/ 1.0 (fma (/ a b) 1.5 (* (/ b c) -2.0))))))
double code(double a, double b, double c) {
double t_0 = fma((c * -3.0), a, (b * b));
double tmp;
if (b <= 3.7) {
tmp = (t_0 - (b * b)) / ((3.0 * a) * (sqrt(t_0) + b));
} else {
tmp = 1.0 / fma((a / b), 1.5, ((b / c) * -2.0));
}
return tmp;
}
function code(a, b, c) t_0 = fma(Float64(c * -3.0), a, Float64(b * b)) tmp = 0.0 if (b <= 3.7) tmp = Float64(Float64(t_0 - Float64(b * b)) / Float64(Float64(3.0 * a) * Float64(sqrt(t_0) + b))); else tmp = Float64(1.0 / fma(Float64(a / b), 1.5, Float64(Float64(b / c) * -2.0))); end return tmp end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 3.7], N[(N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision] / N[(N[(3.0 * a), $MachinePrecision] * N[(N[Sqrt[t$95$0], $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] * 1.5 + N[(N[(b / c), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)\\
\mathbf{if}\;b \leq 3.7:\\
\;\;\;\;\frac{t\_0 - b \cdot b}{\left(3 \cdot a\right) \cdot \left(\sqrt{t\_0} + b\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{a}{b}, 1.5, \frac{b}{c} \cdot -2\right)}\\
\end{array}
\end{array}
if b < 3.7000000000000002Initial program 84.1%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6484.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.1
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6484.1
Applied rewrites84.0%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
lift--.f64N/A
flip--N/A
associate-/l/N/A
lower-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-*.f64N/A
lower--.f64N/A
Applied rewrites85.3%
if 3.7000000000000002 < b Initial program 48.0%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6448.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.0
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6448.0
Applied rewrites48.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6488.1
Applied rewrites88.1%
Final simplification87.8%
(FPCore (a b c) :precision binary64 (if (<= b 3.7) (/ (- (sqrt (fma b b (* (* -3.0 a) c))) b) (* 3.0 a)) (/ 1.0 (fma (/ a b) 1.5 (* (/ b c) -2.0)))))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.7) {
tmp = (sqrt(fma(b, b, ((-3.0 * a) * c))) - b) / (3.0 * a);
} else {
tmp = 1.0 / fma((a / b), 1.5, ((b / c) * -2.0));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 3.7) tmp = Float64(Float64(sqrt(fma(b, b, Float64(Float64(-3.0 * a) * c))) - b) / Float64(3.0 * a)); else tmp = Float64(1.0 / fma(Float64(a / b), 1.5, Float64(Float64(b / c) * -2.0))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 3.7], N[(N[(N[Sqrt[N[(b * b + N[(N[(-3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] * 1.5 + N[(N[(b / c), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.7:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, \left(-3 \cdot a\right) \cdot c\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{a}{b}, 1.5, \frac{b}{c} \cdot -2\right)}\\
\end{array}
\end{array}
if b < 3.7000000000000002Initial program 84.1%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval84.1
Applied rewrites84.1%
if 3.7000000000000002 < b Initial program 48.0%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6448.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.0
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6448.0
Applied rewrites48.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6488.1
Applied rewrites88.1%
Final simplification87.6%
(FPCore (a b c) :precision binary64 (if (<= b 3.7) (/ (- (sqrt (fma (* c -3.0) a (* b b))) b) (* 3.0 a)) (/ 1.0 (fma (/ a b) 1.5 (* (/ b c) -2.0)))))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.7) {
tmp = (sqrt(fma((c * -3.0), a, (b * b))) - b) / (3.0 * a);
} else {
tmp = 1.0 / fma((a / b), 1.5, ((b / c) * -2.0));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 3.7) tmp = Float64(Float64(sqrt(fma(Float64(c * -3.0), a, Float64(b * b))) - b) / Float64(3.0 * a)); else tmp = Float64(1.0 / fma(Float64(a / b), 1.5, Float64(Float64(b / c) * -2.0))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 3.7], N[(N[(N[Sqrt[N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] * 1.5 + N[(N[(b / c), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.7:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{a}{b}, 1.5, \frac{b}{c} \cdot -2\right)}\\
\end{array}
\end{array}
if b < 3.7000000000000002Initial program 84.1%
Applied rewrites84.0%
if 3.7000000000000002 < b Initial program 48.0%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6448.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.0
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6448.0
Applied rewrites48.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6488.1
Applied rewrites88.1%
Final simplification87.6%
(FPCore (a b c) :precision binary64 (if (<= b 3.7) (* (- (sqrt (fma (* c -3.0) a (* b b))) b) (/ 0.3333333333333333 a)) (/ 1.0 (fma (/ a b) 1.5 (* (/ b c) -2.0)))))
double code(double a, double b, double c) {
double tmp;
if (b <= 3.7) {
tmp = (sqrt(fma((c * -3.0), a, (b * b))) - b) * (0.3333333333333333 / a);
} else {
tmp = 1.0 / fma((a / b), 1.5, ((b / c) * -2.0));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 3.7) tmp = Float64(Float64(sqrt(fma(Float64(c * -3.0), a, Float64(b * b))) - b) * Float64(0.3333333333333333 / a)); else tmp = Float64(1.0 / fma(Float64(a / b), 1.5, Float64(Float64(b / c) * -2.0))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 3.7], N[(N[(N[Sqrt[N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] * 1.5 + N[(N[(b / c), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.7:\\
\;\;\;\;\left(\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{a}{b}, 1.5, \frac{b}{c} \cdot -2\right)}\\
\end{array}
\end{array}
if b < 3.7000000000000002Initial program 84.1%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval84.0
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6484.0
Applied rewrites83.9%
if 3.7000000000000002 < b Initial program 48.0%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6448.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.0
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6448.0
Applied rewrites48.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6488.1
Applied rewrites88.1%
Final simplification87.6%
(FPCore (a b c) :precision binary64 (/ 1.0 (fma (/ a b) 1.5 (* (/ b c) -2.0))))
double code(double a, double b, double c) {
return 1.0 / fma((a / b), 1.5, ((b / c) * -2.0));
}
function code(a, b, c) return Float64(1.0 / fma(Float64(a / b), 1.5, Float64(Float64(b / c) * -2.0))) end
code[a_, b_, c_] := N[(1.0 / N[(N[(a / b), $MachinePrecision] * 1.5 + N[(N[(b / c), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\mathsf{fma}\left(\frac{a}{b}, 1.5, \frac{b}{c} \cdot -2\right)}
\end{array}
Initial program 52.4%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6452.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6452.4
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6452.4
Applied rewrites52.3%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6484.1
Applied rewrites84.1%
(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 52.4%
Taylor expanded in c around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6467.2
Applied rewrites67.2%
Final simplification67.2%
(FPCore (a b c) :precision binary64 (* (/ -0.5 b) c))
double code(double a, double b, double c) {
return (-0.5 / b) * c;
}
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) / b) * c
end function
public static double code(double a, double b, double c) {
return (-0.5 / b) * c;
}
def code(a, b, c): return (-0.5 / b) * c
function code(a, b, c) return Float64(Float64(-0.5 / b) * c) end
function tmp = code(a, b, c) tmp = (-0.5 / b) * c; end
code[a_, b_, c_] := N[(N[(-0.5 / b), $MachinePrecision] * c), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.5}{b} \cdot c
\end{array}
Initial program 52.4%
Taylor expanded in c around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites89.3%
Taylor expanded in c around 0
Applied rewrites67.1%
herbie shell --seed 2024267
(FPCore (a b c)
:name "Cubic critical, narrow range"
:precision binary64
:pre (and (and (and (< 1.0536712127723509e-8 a) (< a 94906265.62425156)) (and (< 1.0536712127723509e-8 b) (< b 94906265.62425156))) (and (< 1.0536712127723509e-8 c) (< c 94906265.62425156)))
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))