Average Error: 0.0 → 0.1
Time: 3.9s
Precision: 64
\[\frac{2}{e^{x} + e^{-x}}\]
\[\mathsf{log1p}\left(\sqrt[3]{{\left(\mathsf{expm1}\left(\frac{2}{e^{x} + e^{-x}}\right)\right)}^{3}}\right)\]
\frac{2}{e^{x} + e^{-x}}
\mathsf{log1p}\left(\sqrt[3]{{\left(\mathsf{expm1}\left(\frac{2}{e^{x} + e^{-x}}\right)\right)}^{3}}\right)
double f(double x) {
        double r77390 = 2.0;
        double r77391 = x;
        double r77392 = exp(r77391);
        double r77393 = -r77391;
        double r77394 = exp(r77393);
        double r77395 = r77392 + r77394;
        double r77396 = r77390 / r77395;
        return r77396;
}

double f(double x) {
        double r77397 = 2.0;
        double r77398 = x;
        double r77399 = exp(r77398);
        double r77400 = -r77398;
        double r77401 = exp(r77400);
        double r77402 = r77399 + r77401;
        double r77403 = r77397 / r77402;
        double r77404 = expm1(r77403);
        double r77405 = 3.0;
        double r77406 = pow(r77404, r77405);
        double r77407 = cbrt(r77406);
        double r77408 = log1p(r77407);
        return r77408;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[\frac{2}{e^{x} + e^{-x}}\]
  2. Using strategy rm
  3. Applied log1p-expm1-u0.0

    \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{2}{e^{x} + e^{-x}}\right)\right)}\]
  4. Using strategy rm
  5. Applied add-cbrt-cube0.1

    \[\leadsto \mathsf{log1p}\left(\color{blue}{\sqrt[3]{\left(\mathsf{expm1}\left(\frac{2}{e^{x} + e^{-x}}\right) \cdot \mathsf{expm1}\left(\frac{2}{e^{x} + e^{-x}}\right)\right) \cdot \mathsf{expm1}\left(\frac{2}{e^{x} + e^{-x}}\right)}}\right)\]
  6. Simplified0.1

    \[\leadsto \mathsf{log1p}\left(\sqrt[3]{\color{blue}{{\left(\mathsf{expm1}\left(\frac{2}{e^{x} + e^{-x}}\right)\right)}^{3}}}\right)\]
  7. Final simplification0.1

    \[\leadsto \mathsf{log1p}\left(\sqrt[3]{{\left(\mathsf{expm1}\left(\frac{2}{e^{x} + e^{-x}}\right)\right)}^{3}}\right)\]

Reproduce

herbie shell --seed 2020057 +o rules:numerics
(FPCore (x)
  :name "Hyperbolic secant"
  :precision binary64
  (/ 2 (+ (exp x) (exp (- x)))))