?

Average Error: 9.3% → 99.2%
Time: 14.2s
Precision: binary64
Cost: 33408.00

?

\[\frac{e^{x} - e^{-x}}{2} \]
\[\frac{\left(\left(0.016666666666666666 \cdot {x}^{5} + 0.3333333333333333 \cdot {x}^{3}\right) + x \cdot 2\right) + \left(e^{\mathsf{log1p}\left(0.0003968253968253968 \cdot {x}^{7}\right)} + -1\right)}{2} \]
(FPCore (x) :precision binary64 (/ (- (exp x) (exp (- x))) 2.0))
(FPCore (x)
 :precision binary64
 (/
  (+
   (+
    (+ (* 0.016666666666666666 (pow x 5.0)) (* 0.3333333333333333 (pow x 3.0)))
    (* x 2.0))
   (+ (exp (log1p (* 0.0003968253968253968 (pow x 7.0)))) -1.0))
  2.0))
double code(double x) {
	return (exp(x) - exp(-x)) / 2.0;
}
double code(double x) {
	return ((((0.016666666666666666 * pow(x, 5.0)) + (0.3333333333333333 * pow(x, 3.0))) + (x * 2.0)) + (exp(log1p((0.0003968253968253968 * pow(x, 7.0)))) + -1.0)) / 2.0;
}
public static double code(double x) {
	return (Math.exp(x) - Math.exp(-x)) / 2.0;
}
public static double code(double x) {
	return ((((0.016666666666666666 * Math.pow(x, 5.0)) + (0.3333333333333333 * Math.pow(x, 3.0))) + (x * 2.0)) + (Math.exp(Math.log1p((0.0003968253968253968 * Math.pow(x, 7.0)))) + -1.0)) / 2.0;
}
def code(x):
	return (math.exp(x) - math.exp(-x)) / 2.0
def code(x):
	return ((((0.016666666666666666 * math.pow(x, 5.0)) + (0.3333333333333333 * math.pow(x, 3.0))) + (x * 2.0)) + (math.exp(math.log1p((0.0003968253968253968 * math.pow(x, 7.0)))) + -1.0)) / 2.0
function code(x)
	return Float64(Float64(exp(x) - exp(Float64(-x))) / 2.0)
end
function code(x)
	return Float64(Float64(Float64(Float64(Float64(0.016666666666666666 * (x ^ 5.0)) + Float64(0.3333333333333333 * (x ^ 3.0))) + Float64(x * 2.0)) + Float64(exp(log1p(Float64(0.0003968253968253968 * (x ^ 7.0)))) + -1.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[(N[(N[(0.016666666666666666 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[Log[1 + N[(0.0003968253968253968 * N[Power[x, 7.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\frac{e^{x} - e^{-x}}{2}
\frac{\left(\left(0.016666666666666666 \cdot {x}^{5} + 0.3333333333333333 \cdot {x}^{3}\right) + x \cdot 2\right) + \left(e^{\mathsf{log1p}\left(0.0003968253968253968 \cdot {x}^{7}\right)} + -1\right)}{2}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 9.3

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

    \[\leadsto \frac{\color{blue}{2 \cdot x + \left(0.3333333333333333 \cdot {x}^{3} + \left(0.0003968253968253968 \cdot {x}^{7} + 0.016666666666666666 \cdot {x}^{5}\right)\right)}}{2} \]
  3. Simplified99.3

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(0.3333333333333333, {x}^{3}, \mathsf{fma}\left(0.016666666666666666, {x}^{5}, \mathsf{fma}\left(0.0003968253968253968, {x}^{7}, 2 \cdot x\right)\right)\right)}}{2} \]
    Proof

    [Start]99.3

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

    associate-+r+ [=>]99.3

    \[ \frac{\color{blue}{\left(2 \cdot x + 0.3333333333333333 \cdot {x}^{3}\right) + \left(0.0003968253968253968 \cdot {x}^{7} + 0.016666666666666666 \cdot {x}^{5}\right)}}{2} \]

    +-commutative [=>]99.3

    \[ \frac{\color{blue}{\left(0.3333333333333333 \cdot {x}^{3} + 2 \cdot x\right)} + \left(0.0003968253968253968 \cdot {x}^{7} + 0.016666666666666666 \cdot {x}^{5}\right)}{2} \]

    associate-+l+ [=>]99.3

    \[ \frac{\color{blue}{0.3333333333333333 \cdot {x}^{3} + \left(2 \cdot x + \left(0.0003968253968253968 \cdot {x}^{7} + 0.016666666666666666 \cdot {x}^{5}\right)\right)}}{2} \]

    fma-def [=>]99.3

    \[ \frac{\color{blue}{\mathsf{fma}\left(0.3333333333333333, {x}^{3}, 2 \cdot x + \left(0.0003968253968253968 \cdot {x}^{7} + 0.016666666666666666 \cdot {x}^{5}\right)\right)}}{2} \]

    associate-+r+ [=>]99.3

    \[ \frac{\mathsf{fma}\left(0.3333333333333333, {x}^{3}, \color{blue}{\left(2 \cdot x + 0.0003968253968253968 \cdot {x}^{7}\right) + 0.016666666666666666 \cdot {x}^{5}}\right)}{2} \]

    +-commutative [<=]99.3

    \[ \frac{\mathsf{fma}\left(0.3333333333333333, {x}^{3}, \color{blue}{0.016666666666666666 \cdot {x}^{5} + \left(2 \cdot x + 0.0003968253968253968 \cdot {x}^{7}\right)}\right)}{2} \]

    fma-def [=>]99.3

    \[ \frac{\mathsf{fma}\left(0.3333333333333333, {x}^{3}, \color{blue}{\mathsf{fma}\left(0.016666666666666666, {x}^{5}, 2 \cdot x + 0.0003968253968253968 \cdot {x}^{7}\right)}\right)}{2} \]

    +-commutative [=>]99.3

    \[ \frac{\mathsf{fma}\left(0.3333333333333333, {x}^{3}, \mathsf{fma}\left(0.016666666666666666, {x}^{5}, \color{blue}{0.0003968253968253968 \cdot {x}^{7} + 2 \cdot x}\right)\right)}{2} \]

    fma-def [=>]99.3

    \[ \frac{\mathsf{fma}\left(0.3333333333333333, {x}^{3}, \mathsf{fma}\left(0.016666666666666666, {x}^{5}, \color{blue}{\mathsf{fma}\left(0.0003968253968253968, {x}^{7}, 2 \cdot x\right)}\right)\right)}{2} \]
  4. Applied egg-rr99.3

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

    [Start]99.3

    \[ \frac{\mathsf{fma}\left(0.3333333333333333, {x}^{3}, \mathsf{fma}\left(0.016666666666666666, {x}^{5}, \mathsf{fma}\left(0.0003968253968253968, {x}^{7}, 2 \cdot x\right)\right)\right)}{2} \]

    fma-udef [=>]99.3

    \[ \frac{\color{blue}{0.3333333333333333 \cdot {x}^{3} + \mathsf{fma}\left(0.016666666666666666, {x}^{5}, \mathsf{fma}\left(0.0003968253968253968, {x}^{7}, 2 \cdot x\right)\right)}}{2} \]

    fma-udef [=>]99.3

    \[ \frac{0.3333333333333333 \cdot {x}^{3} + \color{blue}{\left(0.016666666666666666 \cdot {x}^{5} + \mathsf{fma}\left(0.0003968253968253968, {x}^{7}, 2 \cdot x\right)\right)}}{2} \]

    associate-+r+ [=>]99.3

    \[ \frac{\color{blue}{\left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right) + \mathsf{fma}\left(0.0003968253968253968, {x}^{7}, 2 \cdot x\right)}}{2} \]

    fma-udef [=>]99.3

    \[ \frac{\left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right) + \color{blue}{\left(0.0003968253968253968 \cdot {x}^{7} + 2 \cdot x\right)}}{2} \]

    +-commutative [=>]99.3

    \[ \frac{\left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right) + \color{blue}{\left(2 \cdot x + 0.0003968253968253968 \cdot {x}^{7}\right)}}{2} \]

    associate-+r+ [=>]99.3

    \[ \frac{\color{blue}{\left(\left(0.3333333333333333 \cdot {x}^{3} + 0.016666666666666666 \cdot {x}^{5}\right) + 2 \cdot x\right) + 0.0003968253968253968 \cdot {x}^{7}}}{2} \]

    +-commutative [=>]99.3

    \[ \frac{\left(\color{blue}{\left(0.016666666666666666 \cdot {x}^{5} + 0.3333333333333333 \cdot {x}^{3}\right)} + 2 \cdot x\right) + 0.0003968253968253968 \cdot {x}^{7}}{2} \]

    *-commutative [=>]99.3

    \[ \frac{\left(\left(0.016666666666666666 \cdot {x}^{5} + 0.3333333333333333 \cdot {x}^{3}\right) + \color{blue}{x \cdot 2}\right) + 0.0003968253968253968 \cdot {x}^{7}}{2} \]
  5. Applied egg-rr99.2

    \[\leadsto \frac{\left(\left(0.016666666666666666 \cdot {x}^{5} + 0.3333333333333333 \cdot {x}^{3}\right) + x \cdot 2\right) + \color{blue}{\left(e^{\mathsf{log1p}\left(0.0003968253968253968 \cdot {x}^{7}\right)} - 1\right)}}{2} \]
    Proof

    [Start]99.3

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

    expm1-log1p-u [=>]99.2

    \[ \frac{\left(\left(0.016666666666666666 \cdot {x}^{5} + 0.3333333333333333 \cdot {x}^{3}\right) + x \cdot 2\right) + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(0.0003968253968253968 \cdot {x}^{7}\right)\right)}}{2} \]

    expm1-udef [=>]99.2

    \[ \frac{\left(\left(0.016666666666666666 \cdot {x}^{5} + 0.3333333333333333 \cdot {x}^{3}\right) + x \cdot 2\right) + \color{blue}{\left(e^{\mathsf{log1p}\left(0.0003968253968253968 \cdot {x}^{7}\right)} - 1\right)}}{2} \]
  6. Final simplification99.2

    \[\leadsto \frac{\left(\left(0.016666666666666666 \cdot {x}^{5} + 0.3333333333333333 \cdot {x}^{3}\right) + x \cdot 2\right) + \left(e^{\mathsf{log1p}\left(0.0003968253968253968 \cdot {x}^{7}\right)} + -1\right)}{2} \]

Alternatives

Alternative 1
Error99.3%
Cost20736.00
\[\frac{\left(\left(0.016666666666666666 \cdot {x}^{5} + 0.3333333333333333 \cdot {x}^{3}\right) + x \cdot 2\right) + \left(\left(2 + 0.0003968253968253968 \cdot {x}^{7}\right) + -2\right)}{2} \]
Alternative 2
Error99.3%
Cost20480.00
\[\frac{x \cdot 2 + \left(0.3333333333333333 \cdot {x}^{3} + \left(0.016666666666666666 \cdot {x}^{5} + 0.0003968253968253968 \cdot {x}^{7}\right)\right)}{2} \]
Alternative 3
Error99.3%
Cost20480.00
\[\frac{\left(\left(0.016666666666666666 \cdot {x}^{5} + 0.3333333333333333 \cdot {x}^{3}\right) + x \cdot 2\right) + 0.0003968253968253968 \cdot {x}^{7}}{2} \]
Alternative 4
Error99.0%
Cost7040.00
\[\frac{0.3333333333333333 \cdot {x}^{3} + x \cdot 2}{2} \]
Alternative 5
Error99.0%
Cost704.00
\[\frac{x \cdot \left(2 + 0.3333333333333333 \cdot \left(x \cdot x\right)\right)}{2} \]
Alternative 6
Error98.4%
Cost320.00
\[\frac{x \cdot 2}{2} \]
Alternative 7
Error3.8%
Cost64.00
\[-1 \]
Alternative 8
Error5.4%
Cost64.00
\[0 \]

Error

Reproduce?

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