Average Error: 0.1 → 0.1
Time: 3.7s
Precision: 64
\[0.5 \cdot \left(1 + \tanh \left(\frac{x}{2}\right)\right)\]
\[0.5 \cdot \left(1 + \tanh \left(\frac{x}{2}\right)\right)\]
0.5 \cdot \left(1 + \tanh \left(\frac{x}{2}\right)\right)
0.5 \cdot \left(1 + \tanh \left(\frac{x}{2}\right)\right)
double f(double x) {
        double r32259178 = 0.5;
        double r32259179 = 1.0;
        double r32259180 = x;
        double r32259181 = 2.0;
        double r32259182 = r32259180 / r32259181;
        double r32259183 = tanh(r32259182);
        double r32259184 = r32259179 + r32259183;
        double r32259185 = r32259178 * r32259184;
        return r32259185;
}

double f(double x) {
        double r32259186 = 0.5;
        double r32259187 = 1.0;
        double r32259188 = x;
        double r32259189 = 2.0;
        double r32259190 = r32259188 / r32259189;
        double r32259191 = tanh(r32259190);
        double r32259192 = r32259187 + r32259191;
        double r32259193 = r32259186 * r32259192;
        return r32259193;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[0.5 \cdot \left(1 + \tanh \left(\frac{x}{2}\right)\right)\]
  2. Final simplification0.1

    \[\leadsto 0.5 \cdot \left(1 + \tanh \left(\frac{x}{2}\right)\right)\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name ".5 * (1 + tanh(x/2))"
  (* 0.5 (+ 1.0 (tanh (/ x 2.0)))))