
(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
(let* ((t_0 (* -9.0 (* (pow b 4.0) c)))
(t_1
(fma
(* (* c c) (* b b))
27.0
(* (/ (pow t_0 2.0) (pow b 6.0)) -0.25)))
(t_2 (fma -27.0 (pow c 3.0) (* (* (/ t_1 (pow b 6.0)) t_0) -0.5))))
(/
(fma
a
(fma
a
(fma
-0.16666666666666666
(*
(/
(fma
0.5
(* (/ t_2 (pow b 6.0)) t_0)
(* (/ (pow t_1 2.0) (pow b 6.0)) 0.25))
(pow b 3.0))
a)
(* (/ t_2 (pow b 3.0)) 0.16666666666666666))
(* (/ t_1 (pow b 3.0)) 0.16666666666666666))
(/ (* 0.16666666666666666 t_0) (pow b 3.0)))
(fma
b
(+
(+
(*
(fma
-1.5
(/ a b)
(*
(fma
-1.6875
(/ (* (pow a 3.0) c) (pow b 5.0))
(/ (* (* a a) -1.125) (pow b 3.0)))
c))
c)
b)
b)
(fma (* c -3.0) a (* b b))))))
double code(double a, double b, double c) {
double t_0 = -9.0 * (pow(b, 4.0) * c);
double t_1 = fma(((c * c) * (b * b)), 27.0, ((pow(t_0, 2.0) / pow(b, 6.0)) * -0.25));
double t_2 = fma(-27.0, pow(c, 3.0), (((t_1 / pow(b, 6.0)) * t_0) * -0.5));
return fma(a, fma(a, fma(-0.16666666666666666, ((fma(0.5, ((t_2 / pow(b, 6.0)) * t_0), ((pow(t_1, 2.0) / pow(b, 6.0)) * 0.25)) / pow(b, 3.0)) * a), ((t_2 / pow(b, 3.0)) * 0.16666666666666666)), ((t_1 / pow(b, 3.0)) * 0.16666666666666666)), ((0.16666666666666666 * t_0) / pow(b, 3.0))) / fma(b, (((fma(-1.5, (a / b), (fma(-1.6875, ((pow(a, 3.0) * c) / pow(b, 5.0)), (((a * a) * -1.125) / pow(b, 3.0))) * c)) * c) + b) + b), fma((c * -3.0), a, (b * b)));
}
function code(a, b, c) t_0 = Float64(-9.0 * Float64((b ^ 4.0) * c)) t_1 = fma(Float64(Float64(c * c) * Float64(b * b)), 27.0, Float64(Float64((t_0 ^ 2.0) / (b ^ 6.0)) * -0.25)) t_2 = fma(-27.0, (c ^ 3.0), Float64(Float64(Float64(t_1 / (b ^ 6.0)) * t_0) * -0.5)) return Float64(fma(a, fma(a, fma(-0.16666666666666666, Float64(Float64(fma(0.5, Float64(Float64(t_2 / (b ^ 6.0)) * t_0), Float64(Float64((t_1 ^ 2.0) / (b ^ 6.0)) * 0.25)) / (b ^ 3.0)) * a), Float64(Float64(t_2 / (b ^ 3.0)) * 0.16666666666666666)), Float64(Float64(t_1 / (b ^ 3.0)) * 0.16666666666666666)), Float64(Float64(0.16666666666666666 * t_0) / (b ^ 3.0))) / fma(b, Float64(Float64(Float64(fma(-1.5, Float64(a / b), Float64(fma(-1.6875, Float64(Float64((a ^ 3.0) * c) / (b ^ 5.0)), Float64(Float64(Float64(a * a) * -1.125) / (b ^ 3.0))) * c)) * c) + b) + b), fma(Float64(c * -3.0), a, Float64(b * b)))) end
code[a_, b_, c_] := Block[{t$95$0 = N[(-9.0 * N[(N[Power[b, 4.0], $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(c * c), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision] * 27.0 + N[(N[(N[Power[t$95$0, 2.0], $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-27.0 * N[Power[c, 3.0], $MachinePrecision] + N[(N[(N[(t$95$1 / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, N[(N[(a * N[(a * N[(-0.16666666666666666 * N[(N[(N[(0.5 * N[(N[(t$95$2 / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(N[(N[Power[t$95$1, 2.0], $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision] + N[(N[(t$95$2 / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + N[(N[(0.16666666666666666 * t$95$0), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b * N[(N[(N[(N[(-1.5 * N[(a / b), $MachinePrecision] + N[(N[(-1.6875 * N[(N[(N[Power[a, 3.0], $MachinePrecision] * c), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(a * a), $MachinePrecision] * -1.125), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] + b), $MachinePrecision] + b), $MachinePrecision] + N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -9 \cdot \left({b}^{4} \cdot c\right)\\
t_1 := \mathsf{fma}\left(\left(c \cdot c\right) \cdot \left(b \cdot b\right), 27, \frac{{t\_0}^{2}}{{b}^{6}} \cdot -0.25\right)\\
t_2 := \mathsf{fma}\left(-27, {c}^{3}, \left(\frac{t\_1}{{b}^{6}} \cdot t\_0\right) \cdot -0.5\right)\\
\frac{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(-0.16666666666666666, \frac{\mathsf{fma}\left(0.5, \frac{t\_2}{{b}^{6}} \cdot t\_0, \frac{{t\_1}^{2}}{{b}^{6}} \cdot 0.25\right)}{{b}^{3}} \cdot a, \frac{t\_2}{{b}^{3}} \cdot 0.16666666666666666\right), \frac{t\_1}{{b}^{3}} \cdot 0.16666666666666666\right), \frac{0.16666666666666666 \cdot t\_0}{{b}^{3}}\right)}{\mathsf{fma}\left(b, \left(\mathsf{fma}\left(-1.5, \frac{a}{b}, \mathsf{fma}\left(-1.6875, \frac{{a}^{3} \cdot c}{{b}^{5}}, \frac{\left(a \cdot a\right) \cdot -1.125}{{b}^{3}}\right) \cdot c\right) \cdot c + b\right) + b, \mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)\right)}
\end{array}
\end{array}
Initial program 56.0%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6456.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.0
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6456.0
Applied rewrites56.0%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lift--.f64N/A
flip3--N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites56.9%
Taylor expanded in a around 0
Applied rewrites92.0%
Taylor expanded in c around 0
lower-+.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites92.1%
Final simplification92.1%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* 6.75 (* c c)))
(t_1 (* -9.0 (* (pow b 4.0) c)))
(t_2
(fma
(* (* c c) (* b b))
27.0
(* (/ (pow t_1 2.0) (pow b 6.0)) -0.25)))
(t_3 (fma (* c -3.0) a (* b b))))
(/
(fma
a
(fma
a
(fma
-0.16666666666666666
(*
(/
(/
(fma
-4.5
(* (fma -27.0 (pow c 3.0) (* (* t_0 c) 4.5)) c)
(* (pow t_0 2.0) 0.25))
(* b b))
(pow b 3.0))
a)
(*
(/
(fma -27.0 (pow c 3.0) (* (* (/ t_2 (pow b 6.0)) t_1) -0.5))
(pow b 3.0))
0.16666666666666666))
(* (/ t_2 (pow b 3.0)) 0.16666666666666666))
(/ (* 0.16666666666666666 t_1) (pow b 3.0)))
(fma b (+ (sqrt t_3) b) t_3))))
double code(double a, double b, double c) {
double t_0 = 6.75 * (c * c);
double t_1 = -9.0 * (pow(b, 4.0) * c);
double t_2 = fma(((c * c) * (b * b)), 27.0, ((pow(t_1, 2.0) / pow(b, 6.0)) * -0.25));
double t_3 = fma((c * -3.0), a, (b * b));
return fma(a, fma(a, fma(-0.16666666666666666, (((fma(-4.5, (fma(-27.0, pow(c, 3.0), ((t_0 * c) * 4.5)) * c), (pow(t_0, 2.0) * 0.25)) / (b * b)) / pow(b, 3.0)) * a), ((fma(-27.0, pow(c, 3.0), (((t_2 / pow(b, 6.0)) * t_1) * -0.5)) / pow(b, 3.0)) * 0.16666666666666666)), ((t_2 / pow(b, 3.0)) * 0.16666666666666666)), ((0.16666666666666666 * t_1) / pow(b, 3.0))) / fma(b, (sqrt(t_3) + b), t_3);
}
function code(a, b, c) t_0 = Float64(6.75 * Float64(c * c)) t_1 = Float64(-9.0 * Float64((b ^ 4.0) * c)) t_2 = fma(Float64(Float64(c * c) * Float64(b * b)), 27.0, Float64(Float64((t_1 ^ 2.0) / (b ^ 6.0)) * -0.25)) t_3 = fma(Float64(c * -3.0), a, Float64(b * b)) return Float64(fma(a, fma(a, fma(-0.16666666666666666, Float64(Float64(Float64(fma(-4.5, Float64(fma(-27.0, (c ^ 3.0), Float64(Float64(t_0 * c) * 4.5)) * c), Float64((t_0 ^ 2.0) * 0.25)) / Float64(b * b)) / (b ^ 3.0)) * a), Float64(Float64(fma(-27.0, (c ^ 3.0), Float64(Float64(Float64(t_2 / (b ^ 6.0)) * t_1) * -0.5)) / (b ^ 3.0)) * 0.16666666666666666)), Float64(Float64(t_2 / (b ^ 3.0)) * 0.16666666666666666)), Float64(Float64(0.16666666666666666 * t_1) / (b ^ 3.0))) / fma(b, Float64(sqrt(t_3) + b), t_3)) end
code[a_, b_, c_] := Block[{t$95$0 = N[(6.75 * N[(c * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-9.0 * N[(N[Power[b, 4.0], $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(c * c), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision] * 27.0 + N[(N[(N[Power[t$95$1, 2.0], $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, N[(N[(a * N[(a * N[(-0.16666666666666666 * N[(N[(N[(N[(-4.5 * N[(N[(-27.0 * N[Power[c, 3.0], $MachinePrecision] + N[(N[(t$95$0 * c), $MachinePrecision] * 4.5), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] + N[(N[Power[t$95$0, 2.0], $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / N[(b * b), $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision] + N[(N[(N[(-27.0 * N[Power[c, 3.0], $MachinePrecision] + N[(N[(N[(t$95$2 / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + N[(N[(0.16666666666666666 * t$95$1), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b * N[(N[Sqrt[t$95$3], $MachinePrecision] + b), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6.75 \cdot \left(c \cdot c\right)\\
t_1 := -9 \cdot \left({b}^{4} \cdot c\right)\\
t_2 := \mathsf{fma}\left(\left(c \cdot c\right) \cdot \left(b \cdot b\right), 27, \frac{{t\_1}^{2}}{{b}^{6}} \cdot -0.25\right)\\
t_3 := \mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)\\
\frac{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(-0.16666666666666666, \frac{\frac{\mathsf{fma}\left(-4.5, \mathsf{fma}\left(-27, {c}^{3}, \left(t\_0 \cdot c\right) \cdot 4.5\right) \cdot c, {t\_0}^{2} \cdot 0.25\right)}{b \cdot b}}{{b}^{3}} \cdot a, \frac{\mathsf{fma}\left(-27, {c}^{3}, \left(\frac{t\_2}{{b}^{6}} \cdot t\_1\right) \cdot -0.5\right)}{{b}^{3}} \cdot 0.16666666666666666\right), \frac{t\_2}{{b}^{3}} \cdot 0.16666666666666666\right), \frac{0.16666666666666666 \cdot t\_1}{{b}^{3}}\right)}{\mathsf{fma}\left(b, \sqrt{t\_3} + b, t\_3\right)}
\end{array}
\end{array}
Initial program 56.0%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6456.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.0
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6456.0
Applied rewrites56.0%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lift--.f64N/A
flip3--N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites56.9%
Taylor expanded in a around 0
Applied rewrites92.0%
Taylor expanded in b around 0
Applied rewrites92.0%
Final simplification92.0%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (* (* c a) -9.0))
(t_1 (fma (* (* a a) (* c c)) 27.0 (* (pow t_0 2.0) -0.25)))
(t_2 (fma (* (pow a 3.0) -27.0) (pow c 3.0) (* (* t_1 t_0) -0.5)))
(t_3 (fma (* c -3.0) a (* b b))))
(/
(*
(fma
-0.16666666666666666
(/ (fma (* t_0 0.5) t_2 (* (pow t_1 2.0) 0.25)) (* (pow b 6.0) a))
(fma
0.16666666666666666
(+ (/ t_1 (* (* b b) a)) (/ t_2 (* (pow b 4.0) a)))
(* (/ t_0 a) 0.16666666666666666)))
b)
(fma b (+ (sqrt t_3) b) t_3))))
double code(double a, double b, double c) {
double t_0 = (c * a) * -9.0;
double t_1 = fma(((a * a) * (c * c)), 27.0, (pow(t_0, 2.0) * -0.25));
double t_2 = fma((pow(a, 3.0) * -27.0), pow(c, 3.0), ((t_1 * t_0) * -0.5));
double t_3 = fma((c * -3.0), a, (b * b));
return (fma(-0.16666666666666666, (fma((t_0 * 0.5), t_2, (pow(t_1, 2.0) * 0.25)) / (pow(b, 6.0) * a)), fma(0.16666666666666666, ((t_1 / ((b * b) * a)) + (t_2 / (pow(b, 4.0) * a))), ((t_0 / a) * 0.16666666666666666))) * b) / fma(b, (sqrt(t_3) + b), t_3);
}
function code(a, b, c) t_0 = Float64(Float64(c * a) * -9.0) t_1 = fma(Float64(Float64(a * a) * Float64(c * c)), 27.0, Float64((t_0 ^ 2.0) * -0.25)) t_2 = fma(Float64((a ^ 3.0) * -27.0), (c ^ 3.0), Float64(Float64(t_1 * t_0) * -0.5)) t_3 = fma(Float64(c * -3.0), a, Float64(b * b)) return Float64(Float64(fma(-0.16666666666666666, Float64(fma(Float64(t_0 * 0.5), t_2, Float64((t_1 ^ 2.0) * 0.25)) / Float64((b ^ 6.0) * a)), fma(0.16666666666666666, Float64(Float64(t_1 / Float64(Float64(b * b) * a)) + Float64(t_2 / Float64((b ^ 4.0) * a))), Float64(Float64(t_0 / a) * 0.16666666666666666))) * b) / fma(b, Float64(sqrt(t_3) + b), t_3)) end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c * a), $MachinePrecision] * -9.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(a * a), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision] * 27.0 + N[(N[Power[t$95$0, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[a, 3.0], $MachinePrecision] * -27.0), $MachinePrecision] * N[Power[c, 3.0], $MachinePrecision] + N[(N[(t$95$1 * t$95$0), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(-0.16666666666666666 * N[(N[(N[(t$95$0 * 0.5), $MachinePrecision] * t$95$2 + N[(N[Power[t$95$1, 2.0], $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / N[(N[Power[b, 6.0], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(N[(t$95$1 / N[(N[(b * b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 / N[(N[Power[b, 4.0], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$0 / a), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] / N[(b * N[(N[Sqrt[t$95$3], $MachinePrecision] + b), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(c \cdot a\right) \cdot -9\\
t_1 := \mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right), 27, {t\_0}^{2} \cdot -0.25\right)\\
t_2 := \mathsf{fma}\left({a}^{3} \cdot -27, {c}^{3}, \left(t\_1 \cdot t\_0\right) \cdot -0.5\right)\\
t_3 := \mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)\\
\frac{\mathsf{fma}\left(-0.16666666666666666, \frac{\mathsf{fma}\left(t\_0 \cdot 0.5, t\_2, {t\_1}^{2} \cdot 0.25\right)}{{b}^{6} \cdot a}, \mathsf{fma}\left(0.16666666666666666, \frac{t\_1}{\left(b \cdot b\right) \cdot a} + \frac{t\_2}{{b}^{4} \cdot a}, \frac{t\_0}{a} \cdot 0.16666666666666666\right)\right) \cdot b}{\mathsf{fma}\left(b, \sqrt{t\_3} + b, t\_3\right)}
\end{array}
\end{array}
Initial program 56.0%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6456.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.0
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6456.0
Applied rewrites56.0%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lift--.f64N/A
flip3--N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites56.9%
Taylor expanded in b around inf
Applied rewrites91.9%
Final simplification91.9%
(FPCore (a b c)
:precision binary64
(/
1.0
(fma
(fma
(*
(fma (/ (* -0.5625 (* c c)) (pow b 5.0)) a (* (/ c (pow b 3.0)) -0.375))
-3.0)
a
(/ 1.5 b))
a
(* -2.0 (/ b c)))))
double code(double a, double b, double c) {
return 1.0 / fma(fma((fma(((-0.5625 * (c * c)) / pow(b, 5.0)), a, ((c / pow(b, 3.0)) * -0.375)) * -3.0), a, (1.5 / b)), a, (-2.0 * (b / c)));
}
function code(a, b, c) return Float64(1.0 / fma(fma(Float64(fma(Float64(Float64(-0.5625 * Float64(c * c)) / (b ^ 5.0)), a, Float64(Float64(c / (b ^ 3.0)) * -0.375)) * -3.0), a, Float64(1.5 / b)), a, Float64(-2.0 * Float64(b / c)))) end
code[a_, b_, c_] := N[(1.0 / N[(N[(N[(N[(N[(N[(-0.5625 * N[(c * c), $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] * a + N[(N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * -0.375), $MachinePrecision]), $MachinePrecision] * -3.0), $MachinePrecision] * a + N[(1.5 / b), $MachinePrecision]), $MachinePrecision] * a + N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-0.5625 \cdot \left(c \cdot c\right)}{{b}^{5}}, a, \frac{c}{{b}^{3}} \cdot -0.375\right) \cdot -3, a, \frac{1.5}{b}\right), a, -2 \cdot \frac{b}{c}\right)}
\end{array}
Initial program 56.0%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6456.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.0
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6456.0
Applied rewrites56.0%
Taylor expanded in a around 0
Applied rewrites91.9%
Taylor expanded in c around 0
Applied rewrites91.9%
Final simplification91.9%
(FPCore (a b c) :precision binary64 (/ 1.0 (fma (fma (* (* (/ c (pow b 3.0)) -0.375) a) -3.0 (/ 1.5 b)) a (* -2.0 (/ b c)))))
double code(double a, double b, double c) {
return 1.0 / fma(fma((((c / pow(b, 3.0)) * -0.375) * a), -3.0, (1.5 / b)), a, (-2.0 * (b / c)));
}
function code(a, b, c) return Float64(1.0 / fma(fma(Float64(Float64(Float64(c / (b ^ 3.0)) * -0.375) * a), -3.0, Float64(1.5 / b)), a, Float64(-2.0 * Float64(b / c)))) end
code[a_, b_, c_] := 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[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\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, -2 \cdot \frac{b}{c}\right)}
\end{array}
Initial program 56.0%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6456.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.0
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6456.0
Applied rewrites56.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites88.5%
Final simplification88.5%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma (* c -3.0) a (* b b))))
(if (<= b 33.5)
(/ (* (- t_0 (* b b)) (/ 0.3333333333333333 a)) (+ (sqrt t_0) b))
(/ 1.0 (fma (/ a b) 1.5 (* -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 <= 33.5) {
tmp = ((t_0 - (b * b)) * (0.3333333333333333 / a)) / (sqrt(t_0) + b);
} else {
tmp = 1.0 / fma((a / b), 1.5, (-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 <= 33.5) tmp = Float64(Float64(Float64(t_0 - Float64(b * b)) * Float64(0.3333333333333333 / a)) / Float64(sqrt(t_0) + b)); else tmp = Float64(1.0 / fma(Float64(a / b), 1.5, Float64(-2.0 * Float64(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, 33.5], N[(N[(N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[t$95$0], $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] * 1.5 + N[(-2.0 * N[(b / c), $MachinePrecision]), $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 33.5:\\
\;\;\;\;\frac{\left(t\_0 - b \cdot b\right) \cdot \frac{0.3333333333333333}{a}}{\sqrt{t\_0} + b}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{a}{b}, 1.5, -2 \cdot \frac{b}{c}\right)}\\
\end{array}
\end{array}
if b < 33.5Initial program 79.2%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6479.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.2
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6479.2
Applied rewrites79.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lift--.f64N/A
flip--N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites81.1%
if 33.5 < b Initial program 47.2%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6447.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.2
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6447.2
Applied rewrites47.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6489.1
Applied rewrites89.1%
Final simplification86.8%
(FPCore (a b c)
:precision binary64
(let* ((t_0 (fma (* c -3.0) a (* b b))))
(if (<= b 33.5)
(/ (- t_0 (* b b)) (* (* 3.0 a) (+ (sqrt t_0) b)))
(/ 1.0 (fma (/ a b) 1.5 (* -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 <= 33.5) {
tmp = (t_0 - (b * b)) / ((3.0 * a) * (sqrt(t_0) + b));
} else {
tmp = 1.0 / fma((a / b), 1.5, (-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 <= 33.5) 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(-2.0 * Float64(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, 33.5], 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[(-2.0 * N[(b / c), $MachinePrecision]), $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 33.5:\\
\;\;\;\;\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, -2 \cdot \frac{b}{c}\right)}\\
\end{array}
\end{array}
if b < 33.5Initial program 79.2%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6479.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.2
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6479.2
Applied rewrites79.2%
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 rewrites81.0%
if 33.5 < b Initial program 47.2%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6447.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.2
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6447.2
Applied rewrites47.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6489.1
Applied rewrites89.1%
Final simplification86.8%
(FPCore (a b c) :precision binary64 (if (<= b 33.5) (/ (- (sqrt (fma b b (* (* -3.0 a) c))) b) (* 3.0 a)) (/ 1.0 (fma (/ a b) 1.5 (* -2.0 (/ b c))))))
double code(double a, double b, double c) {
double tmp;
if (b <= 33.5) {
tmp = (sqrt(fma(b, b, ((-3.0 * a) * c))) - b) / (3.0 * a);
} else {
tmp = 1.0 / fma((a / b), 1.5, (-2.0 * (b / c)));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 33.5) 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(-2.0 * Float64(b / c)))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 33.5], 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[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 33.5:\\
\;\;\;\;\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, -2 \cdot \frac{b}{c}\right)}\\
\end{array}
\end{array}
if b < 33.5Initial program 79.2%
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-eval79.5
Applied rewrites79.5%
if 33.5 < b Initial program 47.2%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6447.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.2
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6447.2
Applied rewrites47.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6489.1
Applied rewrites89.1%
Final simplification86.4%
(FPCore (a b c) :precision binary64 (if (<= b 33.5) (/ (* (- (sqrt (fma (* c -3.0) a (* b b))) b) 0.3333333333333333) a) (/ 1.0 (fma (/ a b) 1.5 (* -2.0 (/ b c))))))
double code(double a, double b, double c) {
double tmp;
if (b <= 33.5) {
tmp = ((sqrt(fma((c * -3.0), a, (b * b))) - b) * 0.3333333333333333) / a;
} else {
tmp = 1.0 / fma((a / b), 1.5, (-2.0 * (b / c)));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 33.5) tmp = Float64(Float64(Float64(sqrt(fma(Float64(c * -3.0), a, Float64(b * b))) - b) * 0.3333333333333333) / a); else tmp = Float64(1.0 / fma(Float64(a / b), 1.5, Float64(-2.0 * Float64(b / c)))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 33.5], N[(N[(N[(N[Sqrt[N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] / a), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] * 1.5 + N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 33.5:\\
\;\;\;\;\frac{\left(\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} - b\right) \cdot 0.3333333333333333}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{a}{b}, 1.5, -2 \cdot \frac{b}{c}\right)}\\
\end{array}
\end{array}
if b < 33.5Initial program 79.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites79.2%
if 33.5 < b Initial program 47.2%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6447.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.2
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6447.2
Applied rewrites47.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6489.1
Applied rewrites89.1%
Final simplification86.3%
(FPCore (a b c) :precision binary64 (if (<= b 33.5) (* (/ (- (sqrt (fma (* c -3.0) a (* b b))) b) a) 0.3333333333333333) (/ 1.0 (fma (/ a b) 1.5 (* -2.0 (/ b c))))))
double code(double a, double b, double c) {
double tmp;
if (b <= 33.5) {
tmp = ((sqrt(fma((c * -3.0), a, (b * b))) - b) / a) * 0.3333333333333333;
} else {
tmp = 1.0 / fma((a / b), 1.5, (-2.0 * (b / c)));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 33.5) tmp = Float64(Float64(Float64(sqrt(fma(Float64(c * -3.0), a, Float64(b * b))) - b) / a) * 0.3333333333333333); else tmp = Float64(1.0 / fma(Float64(a / b), 1.5, Float64(-2.0 * Float64(b / c)))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 33.5], N[(N[(N[(N[Sqrt[N[(N[(c * -3.0), $MachinePrecision] * a + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] * 1.5 + N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 33.5:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} - b}{a} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{a}{b}, 1.5, -2 \cdot \frac{b}{c}\right)}\\
\end{array}
\end{array}
if b < 33.5Initial program 79.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
div-invN/A
lower-*.f64N/A
Applied rewrites79.2%
if 33.5 < b Initial program 47.2%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6447.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.2
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6447.2
Applied rewrites47.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6489.1
Applied rewrites89.1%
Final simplification86.3%
(FPCore (a b c) :precision binary64 (if (<= b 33.5) (* (- (sqrt (fma (* c -3.0) a (* b b))) b) (/ 0.3333333333333333 a)) (/ 1.0 (fma (/ a b) 1.5 (* -2.0 (/ b c))))))
double code(double a, double b, double c) {
double tmp;
if (b <= 33.5) {
tmp = (sqrt(fma((c * -3.0), a, (b * b))) - b) * (0.3333333333333333 / a);
} else {
tmp = 1.0 / fma((a / b), 1.5, (-2.0 * (b / c)));
}
return tmp;
}
function code(a, b, c) tmp = 0.0 if (b <= 33.5) 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(-2.0 * Float64(b / c)))); end return tmp end
code[a_, b_, c_] := If[LessEqual[b, 33.5], 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[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 33.5:\\
\;\;\;\;\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, -2 \cdot \frac{b}{c}\right)}\\
\end{array}
\end{array}
if b < 33.5Initial program 79.2%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval79.2
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6479.2
Applied rewrites79.2%
if 33.5 < b Initial program 47.2%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6447.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6447.2
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6447.2
Applied rewrites47.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6489.1
Applied rewrites89.1%
Final simplification86.3%
(FPCore (a b c) :precision binary64 (/ 1.0 (fma (/ a b) 1.5 (* -2.0 (/ b c)))))
double code(double a, double b, double c) {
return 1.0 / fma((a / b), 1.5, (-2.0 * (b / c)));
}
function code(a, b, c) return Float64(1.0 / fma(Float64(a / b), 1.5, Float64(-2.0 * Float64(b / c)))) end
code[a_, b_, c_] := N[(1.0 / N[(N[(a / b), $MachinePrecision] * 1.5 + N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\mathsf{fma}\left(\frac{a}{b}, 1.5, -2 \cdot \frac{b}{c}\right)}
\end{array}
Initial program 56.0%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6456.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.0
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6456.0
Applied rewrites56.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.3
Applied rewrites82.3%
Final simplification82.3%
(FPCore (a b c) :precision binary64 (* (/ c b) -0.5))
double code(double a, double b, double c) {
return (c / b) * -0.5;
}
real(8) function code(a, b, c)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (c / b) * (-0.5d0)
end function
public static double code(double a, double b, double c) {
return (c / b) * -0.5;
}
def code(a, b, c): return (c / b) * -0.5
function code(a, b, c) return Float64(Float64(c / b) * -0.5) end
function tmp = code(a, b, c) tmp = (c / b) * -0.5; end
code[a_, b_, c_] := N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{c}{b} \cdot -0.5
\end{array}
Initial program 56.0%
Taylor expanded in c around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.3
Applied rewrites64.3%
(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 56.0%
Taylor expanded in c around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.3
Applied rewrites64.3%
Applied rewrites64.2%
Final simplification64.2%
herbie shell --seed 2024241
(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)))