Average Error: 0.0 → 0.0
Time: 5.4s
Precision: binary64
\[\frac{2}{e^{x} + e^{-x}}\]
\[e^{\log 2 - \log \left(e^{x} + e^{-x}\right)}\]
\frac{2}{e^{x} + e^{-x}}
e^{\log 2 - \log \left(e^{x} + e^{-x}\right)}
(FPCore (x) :precision binary64 (/ 2.0 (+ (exp x) (exp (- x)))))
(FPCore (x)
 :precision binary64
 (exp (- (log 2.0) (log (+ (exp x) (exp (- x)))))))
double code(double x) {
	return 2.0 / (exp(x) + exp(-x));
}
double code(double x) {
	return exp(log(2.0) - log(exp(x) + exp(-x)));
}

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 add-exp-log_binary64_11390.0

    \[\leadsto \frac{2}{\color{blue}{e^{\log \left(e^{x} + e^{-x}\right)}}}\]
  4. Applied add-exp-log_binary64_11390.0

    \[\leadsto \frac{\color{blue}{e^{\log 2}}}{e^{\log \left(e^{x} + e^{-x}\right)}}\]
  5. Applied div-exp_binary64_11520.0

    \[\leadsto \color{blue}{e^{\log 2 - \log \left(e^{x} + e^{-x}\right)}}\]
  6. Final simplification0.0

    \[\leadsto e^{\log 2 - \log \left(e^{x} + e^{-x}\right)}\]

Reproduce

herbie shell --seed 2021019 
(FPCore (x)
  :name "Hyperbolic secant"
  :precision binary64
  (/ 2.0 (+ (exp x) (exp (- x)))))