Average Error: 0.1 → 0.1
Time: 3.9s
Precision: 64
\[\frac{1 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}\]
\[\frac{1 + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}\right)\right)}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}\]
\frac{1 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}
\frac{1 + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}\right)\right)}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}
double f(double t) {
        double r71893 = 1.0;
        double r71894 = 2.0;
        double r71895 = t;
        double r71896 = r71894 * r71895;
        double r71897 = r71893 + r71895;
        double r71898 = r71896 / r71897;
        double r71899 = r71898 * r71898;
        double r71900 = r71893 + r71899;
        double r71901 = r71894 + r71899;
        double r71902 = r71900 / r71901;
        return r71902;
}

double f(double t) {
        double r71903 = 1.0;
        double r71904 = 2.0;
        double r71905 = t;
        double r71906 = r71904 * r71905;
        double r71907 = r71903 + r71905;
        double r71908 = r71906 / r71907;
        double r71909 = r71908 * r71908;
        double r71910 = log1p(r71909);
        double r71911 = expm1(r71910);
        double r71912 = r71903 + r71911;
        double r71913 = r71904 + r71909;
        double r71914 = r71912 / r71913;
        return r71914;
}

Error

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[\frac{1 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}\]
  2. Using strategy rm
  3. Applied expm1-log1p-u0.1

    \[\leadsto \frac{1 + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}\right)\right)}}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}\]
  4. Final simplification0.1

    \[\leadsto \frac{1 + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}\right)\right)}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}\]

Reproduce

herbie shell --seed 2020001 +o rules:numerics
(FPCore (t)
  :name "Kahan p13 Example 1"
  :precision binary64
  (/ (+ 1 (* (/ (* 2 t) (+ 1 t)) (/ (* 2 t) (+ 1 t)))) (+ 2 (* (/ (* 2 t) (+ 1 t)) (/ (* 2 t) (+ 1 t))))))