Average Error: 1.4 → 1.4
Time: 5.7s
Precision: 64
\[x + y \cdot \frac{z - t}{z - a}\]
\[\mathsf{fma}\left(y, \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{z}{z - a}\right)\right) - \frac{t}{z - a}, x\right)\]
x + y \cdot \frac{z - t}{z - a}
\mathsf{fma}\left(y, \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{z}{z - a}\right)\right) - \frac{t}{z - a}, x\right)
double f(double x, double y, double z, double t, double a) {
        double r595733 = x;
        double r595734 = y;
        double r595735 = z;
        double r595736 = t;
        double r595737 = r595735 - r595736;
        double r595738 = a;
        double r595739 = r595735 - r595738;
        double r595740 = r595737 / r595739;
        double r595741 = r595734 * r595740;
        double r595742 = r595733 + r595741;
        return r595742;
}

double f(double x, double y, double z, double t, double a) {
        double r595743 = y;
        double r595744 = z;
        double r595745 = a;
        double r595746 = r595744 - r595745;
        double r595747 = r595744 / r595746;
        double r595748 = expm1(r595747);
        double r595749 = log1p(r595748);
        double r595750 = t;
        double r595751 = r595750 / r595746;
        double r595752 = r595749 - r595751;
        double r595753 = x;
        double r595754 = fma(r595743, r595752, r595753);
        return r595754;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original1.4
Target1.3
Herbie1.4
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Initial program 1.4

    \[x + y \cdot \frac{z - t}{z - a}\]
  2. Simplified1.4

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{z - t}{z - a}, x\right)}\]
  3. Using strategy rm
  4. Applied div-sub1.4

    \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{z}{z - a} - \frac{t}{z - a}}, x\right)\]
  5. Using strategy rm
  6. Applied log1p-expm1-u1.4

    \[\leadsto \mathsf{fma}\left(y, \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{z}{z - a}\right)\right)} - \frac{t}{z - a}, x\right)\]
  7. Final simplification1.4

    \[\leadsto \mathsf{fma}\left(y, \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{z}{z - a}\right)\right) - \frac{t}{z - a}, x\right)\]

Reproduce

herbie shell --seed 2020035 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
  :precision binary64

  :herbie-target
  (+ x (/ y (/ (- z a) (- z t))))

  (+ x (* y (/ (- z t) (- z a)))))