Average Error: 58.1 → 0.8
Time: 3.1s
Precision: binary64
\[\frac{e^{x} - e^{-x}}{2} \]
\[\frac{0.3333333333333333 \cdot {x}^{3} + x \cdot 2}{2} \]
\frac{e^{x} - e^{-x}}{2}
\frac{0.3333333333333333 \cdot {x}^{3} + x \cdot 2}{2}
(FPCore (x) :precision binary64 (/ (- (exp x) (exp (- x))) 2.0))
(FPCore (x)
 :precision binary64
 (/ (+ (* 0.3333333333333333 (pow x 3.0)) (* x 2.0)) 2.0))
double code(double x) {
	return (exp(x) - exp(-x)) / 2.0;
}
double code(double x) {
	return ((0.3333333333333333 * pow(x, 3.0)) + (x * 2.0)) / 2.0;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.1

    \[\frac{e^{x} - e^{-x}}{2} \]
  2. Taylor expanded in x around 0 0.8

    \[\leadsto \frac{\color{blue}{0.3333333333333333 \cdot {x}^{3} + 2 \cdot x}}{2} \]
  3. Final simplification0.8

    \[\leadsto \frac{0.3333333333333333 \cdot {x}^{3} + x \cdot 2}{2} \]

Reproduce

herbie shell --seed 2022130 
(FPCore (x)
  :name "Hyperbolic sine"
  :precision binary64
  (/ (- (exp x) (exp (- x))) 2.0))