Average Error: 0.0 → 0.1
Time: 3.7s
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 code(double x) {
	return (2.0 / (exp(x) + exp(-x)));
}
double code(double x) {
	return log1p(cbrt(pow(expm1((2.0 / (exp(x) + exp(-x)))), 3.0)));
}

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)))))