Average Error: 58.0 → 0.6
Time: 3.3s
Precision: binary64
\[\frac{e^{x} - e^{-x}}{2}\]
\[\frac{x + \left(x + \left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right)\right)}{2}\]
\frac{e^{x} - e^{-x}}{2}
\frac{x + \left(x + \left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right)\right)}{2}
double code(double x) {
	return (((double) (((double) exp(x)) - ((double) exp(((double) -(x)))))) / 2.0);
}
double code(double x) {
	return (((double) (x + ((double) (x + ((double) (((double) (0.3333333333333333 * ((double) pow(x, 3.0)))) + ((double) (0.016666666666666666 * ((double) pow(x, 5.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 Error: 58.0 bits

    \[\frac{e^{x} - e^{-x}}{2}\]
  2. Taylor expanded around 0 Error: 0.6 bits

    \[\leadsto \frac{\color{blue}{0.3333333333333333 \cdot {x}^{3} + \left(0.016666666666666666 \cdot {x}^{5} + 2 \cdot x\right)}}{2}\]
  3. SimplifiedError: 0.6 bits

    \[\leadsto \frac{\color{blue}{x + \left(x + \left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right)\right)}}{2}\]
  4. Final simplificationError: 0.6 bits

    \[\leadsto \frac{x + \left(x + \left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right)\right)}{2}\]

Reproduce

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