(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
double code(double x) { return cbrt((x + 1.0)) - cbrt(x); }
public static double code(double x) { return Math.cbrt((x + 1.0)) - Math.cbrt(x); }
function code(x) return Float64(cbrt(Float64(x + 1.0)) - cbrt(x)) end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ \sqrt[3]{x + 1} - \sqrt[3]{x} \end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
Alternative | Accuracy | Speedup |
---|
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
double code(double x) { return cbrt((x + 1.0)) - cbrt(x); }
public static double code(double x) { return Math.cbrt((x + 1.0)) - Math.cbrt(x); }
function code(x) return Float64(cbrt(Float64(x + 1.0)) - cbrt(x)) end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ \sqrt[3]{x + 1} - \sqrt[3]{x} \end{array}
(FPCore (x) :precision binary64 (/ (- (+ 1.0 x) x) (fma (cbrt x) (+ (cbrt (+ 1.0 x)) (cbrt x)) (pow (exp 0.6666666666666666) (log1p x)))))
double code(double x) { return ((1.0 + x) - x) / fma(cbrt(x), (cbrt((1.0 + x)) + cbrt(x)), pow(exp(0.6666666666666666), log1p(x))); }
function code(x) return Float64(Float64(Float64(1.0 + x) - x) / fma(cbrt(x), Float64(cbrt(Float64(1.0 + x)) + cbrt(x)), (exp(0.6666666666666666) ^ log1p(x)))) end
code[x_] := N[(N[(N[(1.0 + x), $MachinePrecision] - x), $MachinePrecision] / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[Exp[0.6666666666666666], $MachinePrecision], N[Log[1 + x], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ \frac{\left(1 + x\right) - x}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left(e^{0.6666666666666666}\right)}^{\left(\mathsf{log1p}\left(x\right)\right)}\right)} \end{array}
Initial program 96.0%
lift-cbrt.f64
N/A
pow1/3
N/A
lift-+.f64
N/A
flip3-+
N/A
clear-num
N/A
inv-pow
N/A
metadata-eval
N/A
pow-pow
N/A
lower-pow.f64
N/A
Applied rewrites96.3%
Applied rewrites99.0%
(FPCore (x) :precision binary64 (if (<= (- (cbrt (+ x 1.0)) (cbrt x)) 0.232) (* (cbrt (pow (* x x) -1.0)) 0.3333333333333333) (fma (fma (fma 0.06172839506172839 x -0.1111111111111111) x 0.3333333333333333) x (- 1.0 (cbrt x)))))
double code(double x) { double tmp; if ((cbrt((x + 1.0)) - cbrt(x)) <= 0.232) { tmp = cbrt(pow((x * x), -1.0)) * 0.3333333333333333; } else { tmp = fma(fma(fma(0.06172839506172839, x, -0.1111111111111111), x, 0.3333333333333333), x, (1.0 - cbrt(x))); } return tmp; }
function code(x) tmp = 0.0 if (Float64(cbrt(Float64(x + 1.0)) - cbrt(x)) <= 0.232) tmp = Float64(cbrt((Float64(x * x) ^ -1.0)) * 0.3333333333333333); else tmp = fma(fma(fma(0.06172839506172839, x, -0.1111111111111111), x, 0.3333333333333333), x, Float64(1.0 - cbrt(x))); end return tmp end
code[x_] := If[LessEqual[N[(N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], 0.232], N[(N[Power[N[Power[N[(x * x), $MachinePrecision], -1.0], $MachinePrecision], 1/3], $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(N[(N[(0.06172839506172839 * x + -0.1111111111111111), $MachinePrecision] * x + 0.3333333333333333), $MachinePrecision] * x + N[(1.0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sqrt[3]{x + 1} - \sqrt[3]{x} \leq 0.232:\\ \;\;\;\;\sqrt[3]{{\left(x \cdot x\right)}^{-1}} \cdot 0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.06172839506172839, x, -0.1111111111111111\right), x, 0.3333333333333333\right), x, 1 - \sqrt[3]{x}\right)\\ \end{array} \end{array}
if (-.f64 (cbrt.f64 (+.f64 x #s(literal 1 binary64))) (cbrt.f64 x)) < 0.232000000000000012
Initial program 93.5%
Taylor expanded in x around inf
*-commutative
N/A
lower-*.f64
N/A
metadata-eval
N/A
associate-*r/
N/A
lower-cbrt.f64
N/A
unpow2
N/A
associate-/r*
N/A
associate-*r/
N/A
lower-/.f64
N/A
associate-*r/
N/A
metadata-eval
N/A
lower-/.f64
25.9
Applied rewrites25.9%
Applied rewrites25.9%
if 0.232000000000000012 < (-.f64 (cbrt.f64 (+.f64 x #s(literal 1 binary64))) (cbrt.f64 x))
Initial program 98.2%
Taylor expanded in x around 0
+-commutative
N/A
associate--l+
N/A
*-commutative
N/A
lower-fma.f64
N/A
+-commutative
N/A
*-commutative
N/A
lower-fma.f64
N/A
sub-neg
N/A
metadata-eval
N/A
lower-fma.f64
N/A
lower--.f64
N/A
lower-cbrt.f64
42.4
Applied rewrites42.4%
Final simplification35.0%
(FPCore (x) :precision binary64 (- (pow (exp (- (log1p x))) -0.3333333333333333) (pow x 0.3333333333333333)))
double code(double x) { return pow(exp(-log1p(x)), -0.3333333333333333) - pow(x, 0.3333333333333333); }
public static double code(double x) { return Math.pow(Math.exp(-Math.log1p(x)), -0.3333333333333333) - Math.pow(x, 0.3333333333333333); }
def code(x): return math.pow(math.exp(-math.log1p(x)), -0.3333333333333333) - math.pow(x, 0.3333333333333333)
function code(x) return Float64((exp(Float64(-log1p(x))) ^ -0.3333333333333333) - (x ^ 0.3333333333333333)) end
code[x_] := N[(N[Power[N[Exp[(-N[Log[1 + x], $MachinePrecision])], $MachinePrecision], -0.3333333333333333], $MachinePrecision] - N[Power[x, 0.3333333333333333], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ {\left(e^{-\mathsf{log1p}\left(x\right)}\right)}^{-0.3333333333333333} - {x}^{0.3333333333333333} \end{array}
Initial program 96.0%
lift-cbrt.f64
N/A
pow1/3
N/A
lift-+.f64
N/A
flip3-+
N/A
clear-num
N/A
inv-pow
N/A
metadata-eval
N/A
pow-pow
N/A
lower-pow.f64
N/A
Applied rewrites96.3%
lift-cbrt.f64
N/A
pow1/3
N/A
lower-pow.f64
96.8
Applied rewrites96.8%
(FPCore (x) :precision binary64 (- (pow (pow (+ 1.0 x) -2.0) -0.16666666666666666) (cbrt x)))
double code(double x) { return pow(pow((1.0 + x), -2.0), -0.16666666666666666) - cbrt(x); }
public static double code(double x) { return Math.pow(Math.pow((1.0 + x), -2.0), -0.16666666666666666) - Math.cbrt(x); }
function code(x) return Float64(((Float64(1.0 + x) ^ -2.0) ^ -0.16666666666666666) - cbrt(x)) end
code[x_] := N[(N[Power[N[Power[N[(1.0 + x), $MachinePrecision], -2.0], $MachinePrecision], -0.16666666666666666], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ {\left({\left(1 + x\right)}^{-2}\right)}^{-0.16666666666666666} - \sqrt[3]{x} \end{array}
Initial program 96.0%
lift-cbrt.f64
N/A
pow1/3
N/A
lift-+.f64
N/A
flip3-+
N/A
clear-num
N/A
inv-pow
N/A
metadata-eval
N/A
pow-pow
N/A
lower-pow.f64
N/A
Applied rewrites96.3%
lift-pow.f64
N/A
sqr-pow
N/A
pow-prod-down
N/A
lift-exp.f64
N/A
lift-exp.f64
N/A
lift-neg.f64
N/A
lift-log1p.f64
N/A
neg-log
N/A
rem-exp-log
N/A
+-commutative
N/A
flip-+
N/A
clear-num
N/A
lift-neg.f64
N/A
lift-log1p.f64
N/A
neg-log
N/A
rem-exp-log
N/A
+-commutative
N/A
flip-+
N/A
clear-num
N/A
Applied rewrites96.3%
(FPCore (x) :precision binary64 (+ (pow (/ (- x 1.0) (fma x x -1.0)) -0.3333333333333333) (- (cbrt x))))
double code(double x) { return pow(((x - 1.0) / fma(x, x, -1.0)), -0.3333333333333333) + -cbrt(x); }
function code(x) return Float64((Float64(Float64(x - 1.0) / fma(x, x, -1.0)) ^ -0.3333333333333333) + Float64(-cbrt(x))) end
code[x_] := N[(N[Power[N[(N[(x - 1.0), $MachinePrecision] / N[(x * x + -1.0), $MachinePrecision]), $MachinePrecision], -0.3333333333333333], $MachinePrecision] + (-N[Power[x, 1/3], $MachinePrecision])), $MachinePrecision]
\begin{array}{l} \\ {\left(\frac{x - 1}{\mathsf{fma}\left(x, x, -1\right)}\right)}^{-0.3333333333333333} + \left(-\sqrt[3]{x}\right) \end{array}
Initial program 96.0%
lift-cbrt.f64
N/A
pow1/3
N/A
lift-+.f64
N/A
flip3-+
N/A
clear-num
N/A
inv-pow
N/A
metadata-eval
N/A
pow-pow
N/A
lower-pow.f64
N/A
Applied rewrites96.3%
lift-exp.f64
N/A
lift-neg.f64
N/A
lift-log1p.f64
N/A
neg-log
N/A
rem-exp-log
N/A
+-commutative
N/A
flip-+
N/A
clear-num
N/A
lower-/.f64
N/A
lower--.f64
N/A
metadata-eval
N/A
sub-neg
N/A
metadata-eval
N/A
lower-fma.f64
96.3
Applied rewrites96.3%
Final simplification96.3%
(FPCore (x) :precision binary64 (if (<= x 1.0) (- (fma (fma -0.1111111111111111 x 0.3333333333333333) x 1.0) (cbrt x)) (* (cbrt (pow (* x x) -1.0)) 0.3333333333333333)))
double code(double x) { double tmp; if (x <= 1.0) { tmp = fma(fma(-0.1111111111111111, x, 0.3333333333333333), x, 1.0) - cbrt(x); } else { tmp = cbrt(pow((x * x), -1.0)) * 0.3333333333333333; } return tmp; }
function code(x) tmp = 0.0 if (x <= 1.0) tmp = Float64(fma(fma(-0.1111111111111111, x, 0.3333333333333333), x, 1.0) - cbrt(x)); else tmp = Float64(cbrt((Float64(x * x) ^ -1.0)) * 0.3333333333333333); end return tmp end
code[x_] := If[LessEqual[x, 1.0], N[(N[(N[(-0.1111111111111111 * x + 0.3333333333333333), $MachinePrecision] * x + 1.0), $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Power[N[(x * x), $MachinePrecision], -1.0], $MachinePrecision], 1/3], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.1111111111111111, x, 0.3333333333333333\right), x, 1\right) - \sqrt[3]{x}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{{\left(x \cdot x\right)}^{-1}} \cdot 0.3333333333333333\\ \end{array} \end{array}
if x < 1
Initial program 98.2%
Taylor expanded in x around 0
+-commutative
N/A
*-commutative
N/A
lower-fma.f64
N/A
+-commutative
N/A
lower-fma.f64
37.3
Applied rewrites37.3%
if 1 < x
Initial program 93.6%
Taylor expanded in x around inf
*-commutative
N/A
lower-*.f64
N/A
metadata-eval
N/A
associate-*r/
N/A
lower-cbrt.f64
N/A
unpow2
N/A
associate-/r*
N/A
associate-*r/
N/A
lower-/.f64
N/A
associate-*r/
N/A
metadata-eval
N/A
lower-/.f64
25.8
Applied rewrites25.8%
Applied rewrites25.8%
Final simplification31.9%
(FPCore (x) :precision binary64 (- (pow (+ 1.0 x) 0.3333333333333333) (cbrt x)))
double code(double x) { return pow((1.0 + x), 0.3333333333333333) - cbrt(x); }
public static double code(double x) { return Math.pow((1.0 + x), 0.3333333333333333) - Math.cbrt(x); }
function code(x) return Float64((Float64(1.0 + x) ^ 0.3333333333333333) - cbrt(x)) end
code[x_] := N[(N[Power[N[(1.0 + x), $MachinePrecision], 0.3333333333333333], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ {\left(1 + x\right)}^{0.3333333333333333} - \sqrt[3]{x} \end{array}
Initial program 96.0%
lift-cbrt.f64
N/A
pow1/3
N/A
lift-+.f64
N/A
flip3-+
N/A
clear-num
N/A
inv-pow
N/A
metadata-eval
N/A
pow-pow
N/A
lower-pow.f64
N/A
Applied rewrites96.3%
lift-pow.f64
N/A
lift-exp.f64
N/A
lift-neg.f64
N/A
lift-log1p.f64
N/A
neg-log
N/A
rem-exp-log
N/A
+-commutative
N/A
lift-+.f64
N/A
inv-pow
N/A
pow-pow
N/A
metadata-eval
N/A
lower-pow.f64
96.3
lift-+.f64
N/A
+-commutative
N/A
lower-+.f64
96.3
Applied rewrites96.3%
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (pow x 0.3333333333333333)))
double code(double x) { return cbrt((x + 1.0)) - pow(x, 0.3333333333333333); }
public static double code(double x) { return Math.cbrt((x + 1.0)) - Math.pow(x, 0.3333333333333333); }
function code(x) return Float64(cbrt(Float64(x + 1.0)) - (x ^ 0.3333333333333333)) end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 0.3333333333333333], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ \sqrt[3]{x + 1} - {x}^{0.3333333333333333} \end{array}
Initial program 96.0%
lift-cbrt.f64
N/A
pow1/3
N/A
lower-pow.f64
96.1
Applied rewrites96.1%
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
double code(double x) { return cbrt((x + 1.0)) - cbrt(x); }
public static double code(double x) { return Math.cbrt((x + 1.0)) - Math.cbrt(x); }
function code(x) return Float64(cbrt(Float64(x + 1.0)) - cbrt(x)) end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ \sqrt[3]{x + 1} - \sqrt[3]{x} \end{array}
Initial program 96.0%
(FPCore (x) :precision binary64 (if (<= x 1.0) (- (fma (fma -0.1111111111111111 x 0.3333333333333333) x 1.0) (cbrt x)) (* (pow x -0.6666666666666666) 0.3333333333333333)))
double code(double x) { double tmp; if (x <= 1.0) { tmp = fma(fma(-0.1111111111111111, x, 0.3333333333333333), x, 1.0) - cbrt(x); } else { tmp = pow(x, -0.6666666666666666) * 0.3333333333333333; } return tmp; }
function code(x) tmp = 0.0 if (x <= 1.0) tmp = Float64(fma(fma(-0.1111111111111111, x, 0.3333333333333333), x, 1.0) - cbrt(x)); else tmp = Float64((x ^ -0.6666666666666666) * 0.3333333333333333); end return tmp end
code[x_] := If[LessEqual[x, 1.0], N[(N[(N[(-0.1111111111111111 * x + 0.3333333333333333), $MachinePrecision] * x + 1.0), $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.6666666666666666], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.1111111111111111, x, 0.3333333333333333\right), x, 1\right) - \sqrt[3]{x}\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.6666666666666666} \cdot 0.3333333333333333\\ \end{array} \end{array}
if x < 1
Initial program 98.2%
Taylor expanded in x around 0
+-commutative
N/A
*-commutative
N/A
lower-fma.f64
N/A
+-commutative
N/A
lower-fma.f64
37.3
Applied rewrites37.3%
if 1 < x
Initial program 93.6%
Taylor expanded in x around inf
*-commutative
N/A
lower-*.f64
N/A
metadata-eval
N/A
associate-*r/
N/A
lower-cbrt.f64
N/A
unpow2
N/A
associate-/r*
N/A
associate-*r/
N/A
lower-/.f64
N/A
associate-*r/
N/A
metadata-eval
N/A
lower-/.f64
25.8
Applied rewrites25.8%
Applied rewrites25.8%
(FPCore (x) :precision binary64 (if (<= x 1.0) (fma (fma -0.1111111111111111 x 0.3333333333333333) x (- 1.0 (cbrt x))) (* (pow x -0.6666666666666666) 0.3333333333333333)))
double code(double x) { double tmp; if (x <= 1.0) { tmp = fma(fma(-0.1111111111111111, x, 0.3333333333333333), x, (1.0 - cbrt(x))); } else { tmp = pow(x, -0.6666666666666666) * 0.3333333333333333; } return tmp; }
function code(x) tmp = 0.0 if (x <= 1.0) tmp = fma(fma(-0.1111111111111111, x, 0.3333333333333333), x, Float64(1.0 - cbrt(x))); else tmp = Float64((x ^ -0.6666666666666666) * 0.3333333333333333); end return tmp end
code[x_] := If[LessEqual[x, 1.0], N[(N[(-0.1111111111111111 * x + 0.3333333333333333), $MachinePrecision] * x + N[(1.0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.6666666666666666], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.1111111111111111, x, 0.3333333333333333\right), x, 1 - \sqrt[3]{x}\right)\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.6666666666666666} \cdot 0.3333333333333333\\ \end{array} \end{array}
if x < 1
Initial program 98.2%
Taylor expanded in x around 0
+-commutative
N/A
associate--l+
N/A
*-commutative
N/A
lower-fma.f64
N/A
+-commutative
N/A
lower-fma.f64
N/A
lower--.f64
N/A
lower-cbrt.f64
37.3
Applied rewrites37.3%
if 1 < x
Initial program 93.6%
Taylor expanded in x around inf
*-commutative
N/A
lower-*.f64
N/A
metadata-eval
N/A
associate-*r/
N/A
lower-cbrt.f64
N/A
unpow2
N/A
associate-/r*
N/A
associate-*r/
N/A
lower-/.f64
N/A
associate-*r/
N/A
metadata-eval
N/A
lower-/.f64
25.8
Applied rewrites25.8%
Applied rewrites25.8%
(FPCore (x) :precision binary64 (if (<= x 1.0) (- (fma 0.3333333333333333 x 1.0) (cbrt x)) (* (pow x -0.6666666666666666) 0.3333333333333333)))
double code(double x) { double tmp; if (x <= 1.0) { tmp = fma(0.3333333333333333, x, 1.0) - cbrt(x); } else { tmp = pow(x, -0.6666666666666666) * 0.3333333333333333; } return tmp; }
function code(x) tmp = 0.0 if (x <= 1.0) tmp = Float64(fma(0.3333333333333333, x, 1.0) - cbrt(x)); else tmp = Float64((x ^ -0.6666666666666666) * 0.3333333333333333); end return tmp end
code[x_] := If[LessEqual[x, 1.0], N[(N[(0.3333333333333333 * x + 1.0), $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.6666666666666666], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, x, 1\right) - \sqrt[3]{x}\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.6666666666666666} \cdot 0.3333333333333333\\ \end{array} \end{array}
if x < 1
Initial program 98.2%
Taylor expanded in x around 0
+-commutative
N/A
lower-fma.f64
31.2
Applied rewrites31.2%
if 1 < x
Initial program 93.6%
Taylor expanded in x around inf
*-commutative
N/A
lower-*.f64
N/A
metadata-eval
N/A
associate-*r/
N/A
lower-cbrt.f64
N/A
unpow2
N/A
associate-/r*
N/A
associate-*r/
N/A
lower-/.f64
N/A
associate-*r/
N/A
metadata-eval
N/A
lower-/.f64
25.8
Applied rewrites25.8%
Applied rewrites25.8%
(FPCore (x) :precision binary64 (if (<= x 1.0) (fma 0.3333333333333333 x (- 1.0 (cbrt x))) (* (pow x -0.6666666666666666) 0.3333333333333333)))
double code(double x) { double tmp; if (x <= 1.0) { tmp = fma(0.3333333333333333, x, (1.0 - cbrt(x))); } else { tmp = pow(x, -0.6666666666666666) * 0.3333333333333333; } return tmp; }
function code(x) tmp = 0.0 if (x <= 1.0) tmp = fma(0.3333333333333333, x, Float64(1.0 - cbrt(x))); else tmp = Float64((x ^ -0.6666666666666666) * 0.3333333333333333); end return tmp end
code[x_] := If[LessEqual[x, 1.0], N[(0.3333333333333333 * x + N[(1.0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.6666666666666666], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, x, 1 - \sqrt[3]{x}\right)\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.6666666666666666} \cdot 0.3333333333333333\\ \end{array} \end{array}
if x < 1
Initial program 98.2%
Taylor expanded in x around 0
+-commutative
N/A
associate--l+
N/A
lower-fma.f64
N/A
lower--.f64
N/A
lower-cbrt.f64
31.2
Applied rewrites31.2%
if 1 < x
Initial program 93.6%
Taylor expanded in x around inf
*-commutative
N/A
lower-*.f64
N/A
metadata-eval
N/A
associate-*r/
N/A
lower-cbrt.f64
N/A
unpow2
N/A
associate-/r*
N/A
associate-*r/
N/A
lower-/.f64
N/A
associate-*r/
N/A
metadata-eval
N/A
lower-/.f64
25.8
Applied rewrites25.8%
Applied rewrites25.8%
(FPCore (x) :precision binary64 (if (<= x 0.48) (- 1.0 (cbrt x)) (* (pow x -0.6666666666666666) 0.3333333333333333)))
double code(double x) { double tmp; if (x <= 0.48) { tmp = 1.0 - cbrt(x); } else { tmp = pow(x, -0.6666666666666666) * 0.3333333333333333; } return tmp; }
public static double code(double x) { double tmp; if (x <= 0.48) { tmp = 1.0 - Math.cbrt(x); } else { tmp = Math.pow(x, -0.6666666666666666) * 0.3333333333333333; } return tmp; }
function code(x) tmp = 0.0 if (x <= 0.48) tmp = Float64(1.0 - cbrt(x)); else tmp = Float64((x ^ -0.6666666666666666) * 0.3333333333333333); end return tmp end
code[x_] := If[LessEqual[x, 0.48], N[(1.0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.6666666666666666], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.48:\\ \;\;\;\;1 - \sqrt[3]{x}\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.6666666666666666} \cdot 0.3333333333333333\\ \end{array} \end{array}
if x < 0.47999999999999998
Initial program 98.4%
Taylor expanded in x around 0
Applied rewrites24.7%
if 0.47999999999999998 < x
Initial program 94.2%
Taylor expanded in x around inf
*-commutative
N/A
lower-*.f64
N/A
metadata-eval
N/A
associate-*r/
N/A
lower-cbrt.f64
N/A
unpow2
N/A
associate-/r*
N/A
associate-*r/
N/A
lower-/.f64
N/A
associate-*r/
N/A
metadata-eval
N/A
lower-/.f64
25.0
Applied rewrites25.0%
Applied rewrites25.0%
(FPCore (x) :precision binary64 (- 1.0 (cbrt x)))
double code(double x) { return 1.0 - cbrt(x); }
public static double code(double x) { return 1.0 - Math.cbrt(x); }
function code(x) return Float64(1.0 - cbrt(x)) end
code[x_] := N[(1.0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ 1 - \sqrt[3]{x} \end{array}
Initial program 96.0%
Taylor expanded in x around 0
Applied rewrites13.2%
(FPCore (x) :precision binary64 (- (cbrt x)))
double code(double x) { return -cbrt(x); }
public static double code(double x) { return -Math.cbrt(x); }
function code(x) return Float64(-cbrt(x)) end
code[x_] := (-N[Power[x, 1/3], $MachinePrecision])
\begin{array}{l} \\ -\sqrt[3]{x} \end{array}
Initial program 96.0%
lift-cbrt.f64
N/A
pow1/3
N/A
lift-+.f64
N/A
flip3-+
N/A
clear-num
N/A
inv-pow
N/A
metadata-eval
N/A
pow-pow
N/A
lower-pow.f64
N/A
Applied rewrites96.3%
Taylor expanded in x around inf
mul-1-neg
N/A
lower-neg.f64
N/A
lower-cbrt.f64
1.6
Applied rewrites1.6%
herbie shell --seed 1
(FPCore (x)
:name "cbrt(x + 1) - cbrt(x)"
:precision binary64
:pre (and (<= 0.01 x) (<= x 100.0))
(- (cbrt (+ x 1.0)) (cbrt x)))