Average Error: 1.8 → 2.3
Time: 59.9s
Precision: 64
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \le -14015800.0828418843448162078857421875:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right) - \frac{x}{\frac{t}{z}}\\ \mathbf{elif}\;x \le 1.709797410018517080639012525016209371533 \cdot 10^{-278}:\\ \;\;\;\;\left(\frac{z}{\frac{t}{y}} - \frac{z \cdot x}{t}\right) + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right) - \frac{x}{\frac{t}{z}}\\ \end{array}\]
x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
\mathbf{if}\;x \le -14015800.0828418843448162078857421875:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right) - \frac{x}{\frac{t}{z}}\\

\mathbf{elif}\;x \le 1.709797410018517080639012525016209371533 \cdot 10^{-278}:\\
\;\;\;\;\left(\frac{z}{\frac{t}{y}} - \frac{z \cdot x}{t}\right) + x\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right) - \frac{x}{\frac{t}{z}}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r24697518 = x;
        double r24697519 = y;
        double r24697520 = r24697519 - r24697518;
        double r24697521 = z;
        double r24697522 = t;
        double r24697523 = r24697521 / r24697522;
        double r24697524 = r24697520 * r24697523;
        double r24697525 = r24697518 + r24697524;
        return r24697525;
}

double f(double x, double y, double z, double t) {
        double r24697526 = x;
        double r24697527 = -14015800.082841884;
        bool r24697528 = r24697526 <= r24697527;
        double r24697529 = z;
        double r24697530 = t;
        double r24697531 = r24697529 / r24697530;
        double r24697532 = y;
        double r24697533 = fma(r24697531, r24697532, r24697526);
        double r24697534 = r24697530 / r24697529;
        double r24697535 = r24697526 / r24697534;
        double r24697536 = r24697533 - r24697535;
        double r24697537 = 1.709797410018517e-278;
        bool r24697538 = r24697526 <= r24697537;
        double r24697539 = r24697530 / r24697532;
        double r24697540 = r24697529 / r24697539;
        double r24697541 = r24697529 * r24697526;
        double r24697542 = r24697541 / r24697530;
        double r24697543 = r24697540 - r24697542;
        double r24697544 = r24697543 + r24697526;
        double r24697545 = r24697538 ? r24697544 : r24697536;
        double r24697546 = r24697528 ? r24697536 : r24697545;
        return r24697546;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original1.8
Target2.1
Herbie2.3
\[\begin{array}{l} \mathbf{if}\;\left(y - x\right) \cdot \frac{z}{t} \lt -1013646692435.88671875:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{elif}\;\left(y - x\right) \cdot \frac{z}{t} \lt -0.0:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -14015800.082841884 or 1.709797410018517e-278 < x

    1. Initial program 1.3

      \[x + \left(y - x\right) \cdot \frac{z}{t}\]
    2. Taylor expanded around 0 7.2

      \[\leadsto \color{blue}{\left(\frac{z \cdot y}{t} + x\right) - \frac{x \cdot z}{t}}\]
    3. Simplified1.3

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z}{t}, y, x\right) - \frac{x}{\frac{t}{z}}}\]

    if -14015800.082841884 < x < 1.709797410018517e-278

    1. Initial program 3.1

      \[x + \left(y - x\right) \cdot \frac{z}{t}\]
    2. Taylor expanded around 0 4.8

      \[\leadsto x + \color{blue}{\left(\frac{z \cdot y}{t} - \frac{x \cdot z}{t}\right)}\]
    3. Using strategy rm
    4. Applied associate-/l*4.7

      \[\leadsto x + \left(\color{blue}{\frac{z}{\frac{t}{y}}} - \frac{x \cdot z}{t}\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -14015800.0828418843448162078857421875:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right) - \frac{x}{\frac{t}{z}}\\ \mathbf{elif}\;x \le 1.709797410018517080639012525016209371533 \cdot 10^{-278}:\\ \;\;\;\;\left(\frac{z}{\frac{t}{y}} - \frac{z \cdot x}{t}\right) + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right) - \frac{x}{\frac{t}{z}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019168 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"

  :herbie-target
  (if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) -0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))

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