?

Average Accuracy: 9.2% → 99.1%
Time: 5.2s
Precision: binary64
Cost: 13760

?

\[\frac{e^{x} - e^{-x}}{2} \]
\[\frac{2 \cdot x + \left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right)}{2} \]
(FPCore (x) :precision binary64 (/ (- (exp x) (exp (- x))) 2.0))
(FPCore (x)
 :precision binary64
 (/
  (+
   (* 2.0 x)
   (+ (* 0.3333333333333333 (pow x 3.0)) (* 0.016666666666666666 (pow x 5.0))))
  2.0))
double code(double x) {
	return (exp(x) - exp(-x)) / 2.0;
}
double code(double x) {
	return ((2.0 * x) + ((0.3333333333333333 * pow(x, 3.0)) + (0.016666666666666666 * pow(x, 5.0)))) / 2.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (exp(x) - exp(-x)) / 2.0d0
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((2.0d0 * x) + ((0.3333333333333333d0 * (x ** 3.0d0)) + (0.016666666666666666d0 * (x ** 5.0d0)))) / 2.0d0
end function
public static double code(double x) {
	return (Math.exp(x) - Math.exp(-x)) / 2.0;
}
public static double code(double x) {
	return ((2.0 * x) + ((0.3333333333333333 * Math.pow(x, 3.0)) + (0.016666666666666666 * Math.pow(x, 5.0)))) / 2.0;
}
def code(x):
	return (math.exp(x) - math.exp(-x)) / 2.0
def code(x):
	return ((2.0 * x) + ((0.3333333333333333 * math.pow(x, 3.0)) + (0.016666666666666666 * math.pow(x, 5.0)))) / 2.0
function code(x)
	return Float64(Float64(exp(x) - exp(Float64(-x))) / 2.0)
end
function code(x)
	return Float64(Float64(Float64(2.0 * x) + Float64(Float64(0.3333333333333333 * (x ^ 3.0)) + Float64(0.016666666666666666 * (x ^ 5.0)))) / 2.0)
end
function tmp = code(x)
	tmp = (exp(x) - exp(-x)) / 2.0;
end
function tmp = code(x)
	tmp = ((2.0 * x) + ((0.3333333333333333 * (x ^ 3.0)) + (0.016666666666666666 * (x ^ 5.0)))) / 2.0;
end
code[x_] := N[(N[(N[Exp[x], $MachinePrecision] - N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
code[x_] := N[(N[(N[(2.0 * x), $MachinePrecision] + N[(N[(0.3333333333333333 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(0.016666666666666666 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\frac{e^{x} - e^{-x}}{2}
\frac{2 \cdot x + \left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right)}{2}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 9.2%

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

    \[\leadsto \frac{\color{blue}{2 \cdot x + \left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right)}}{2} \]
  3. Final simplification99.1%

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

Alternatives

Alternative 1
Accuracy99.0%
Cost832
\[\frac{2 \cdot x + x \cdot \left(x \cdot \left(x \cdot 0.3333333333333333\right)\right)}{2} \]
Alternative 2
Accuracy98.4%
Cost320
\[\frac{2 \cdot x}{2} \]
Alternative 3
Accuracy3.8%
Cost64
\[-1 \]
Alternative 4
Accuracy5.4%
Cost64
\[0 \]

Error

Reproduce?

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