Average Error: 24.1 → 9.8
Time: 8.4s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -3.3348818478163845 \cdot 10^{-40}:\\ \;\;\;\;\frac{z}{\frac{a - t}{y - x}} - \mathsf{fma}\left(\frac{t}{a - t}, y - x, -1 \cdot x\right)\\ \mathbf{elif}\;t \le 1.87885427265612864 \cdot 10^{-162}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)\\ \mathbf{elif}\;t \le 5.014268344444687 \cdot 10^{226}:\\ \;\;\;\;\frac{\sqrt[3]{z}}{\frac{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}{\sqrt[3]{z}}} \cdot \frac{\sqrt[3]{z}}{\frac{\sqrt[3]{a - t}}{y - x}} - \left(\frac{t}{\frac{a - t}{y - x}} - x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{t}, z, y - \frac{z \cdot y}{t}\right)\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;t \le -3.3348818478163845 \cdot 10^{-40}:\\
\;\;\;\;\frac{z}{\frac{a - t}{y - x}} - \mathsf{fma}\left(\frac{t}{a - t}, y - x, -1 \cdot x\right)\\

\mathbf{elif}\;t \le 1.87885427265612864 \cdot 10^{-162}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)\\

\mathbf{elif}\;t \le 5.014268344444687 \cdot 10^{226}:\\
\;\;\;\;\frac{\sqrt[3]{z}}{\frac{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}{\sqrt[3]{z}}} \cdot \frac{\sqrt[3]{z}}{\frac{\sqrt[3]{a - t}}{y - x}} - \left(\frac{t}{\frac{a - t}{y - x}} - x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r588558 = x;
        double r588559 = y;
        double r588560 = r588559 - r588558;
        double r588561 = z;
        double r588562 = t;
        double r588563 = r588561 - r588562;
        double r588564 = r588560 * r588563;
        double r588565 = a;
        double r588566 = r588565 - r588562;
        double r588567 = r588564 / r588566;
        double r588568 = r588558 + r588567;
        return r588568;
}

double f(double x, double y, double z, double t, double a) {
        double r588569 = t;
        double r588570 = -3.3348818478163845e-40;
        bool r588571 = r588569 <= r588570;
        double r588572 = z;
        double r588573 = a;
        double r588574 = r588573 - r588569;
        double r588575 = y;
        double r588576 = x;
        double r588577 = r588575 - r588576;
        double r588578 = r588574 / r588577;
        double r588579 = r588572 / r588578;
        double r588580 = r588569 / r588574;
        double r588581 = -1.0;
        double r588582 = r588581 * r588576;
        double r588583 = fma(r588580, r588577, r588582);
        double r588584 = r588579 - r588583;
        double r588585 = 1.8788542726561286e-162;
        bool r588586 = r588569 <= r588585;
        double r588587 = r588572 - r588569;
        double r588588 = r588587 / r588574;
        double r588589 = fma(r588588, r588577, r588576);
        double r588590 = 5.014268344444687e+226;
        bool r588591 = r588569 <= r588590;
        double r588592 = cbrt(r588572);
        double r588593 = cbrt(r588574);
        double r588594 = r588593 * r588593;
        double r588595 = r588594 / r588592;
        double r588596 = r588592 / r588595;
        double r588597 = r588593 / r588577;
        double r588598 = r588592 / r588597;
        double r588599 = r588596 * r588598;
        double r588600 = r588569 / r588578;
        double r588601 = r588600 - r588576;
        double r588602 = r588599 - r588601;
        double r588603 = r588576 / r588569;
        double r588604 = r588572 * r588575;
        double r588605 = r588604 / r588569;
        double r588606 = r588575 - r588605;
        double r588607 = fma(r588603, r588572, r588606);
        double r588608 = r588591 ? r588602 : r588607;
        double r588609 = r588586 ? r588589 : r588608;
        double r588610 = r588571 ? r588584 : r588609;
        return r588610;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.1
Target9.3
Herbie9.8
\[\begin{array}{l} \mathbf{if}\;a \lt -1.6153062845442575 \cdot 10^{-142}:\\ \;\;\;\;x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;a \lt 3.7744031700831742 \cdot 10^{-182}:\\ \;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\ \end{array}\]

Derivation

  1. Split input into 4 regimes
  2. if t < -3.3348818478163845e-40

    1. Initial program 34.2

      \[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
    2. Simplified18.9

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a - t}{y - x}} \cdot \left(z - t\right) + x}\]
    7. Simplified19.2

      \[\leadsto \color{blue}{\frac{z - t}{\frac{a - t}{y - x}}} + x\]
    8. Using strategy rm
    9. Applied div-sub19.1

      \[\leadsto \color{blue}{\left(\frac{z}{\frac{a - t}{y - x}} - \frac{t}{\frac{a - t}{y - x}}\right)} + x\]
    10. Applied associate-+l-15.6

      \[\leadsto \color{blue}{\frac{z}{\frac{a - t}{y - x}} - \left(\frac{t}{\frac{a - t}{y - x}} - x\right)}\]
    11. Using strategy rm
    12. Applied associate-/r/13.1

      \[\leadsto \frac{z}{\frac{a - t}{y - x}} - \left(\color{blue}{\frac{t}{a - t} \cdot \left(y - x\right)} - x\right)\]
    13. Applied fma-neg13.1

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

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

    if -3.3348818478163845e-40 < t < 1.8788542726561286e-162

    1. Initial program 8.6

      \[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
    2. Simplified8.3

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a - t}{y - x}} \cdot \left(z - t\right) + x}\]
    7. Simplified7.9

      \[\leadsto \color{blue}{\frac{z - t}{\frac{a - t}{y - x}}} + x\]
    8. Using strategy rm
    9. Applied associate-/r/3.9

      \[\leadsto \color{blue}{\frac{z - t}{a - t} \cdot \left(y - x\right)} + x\]
    10. Applied fma-def3.9

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

    if 1.8788542726561286e-162 < t < 5.014268344444687e+226

    1. Initial program 22.7

      \[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
    2. Simplified13.1

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a - t}{y - x}} \cdot \left(z - t\right) + x}\]
    7. Simplified13.1

      \[\leadsto \color{blue}{\frac{z - t}{\frac{a - t}{y - x}}} + x\]
    8. Using strategy rm
    9. Applied div-sub13.1

      \[\leadsto \color{blue}{\left(\frac{z}{\frac{a - t}{y - x}} - \frac{t}{\frac{a - t}{y - x}}\right)} + x\]
    10. Applied associate-+l-10.4

      \[\leadsto \color{blue}{\frac{z}{\frac{a - t}{y - x}} - \left(\frac{t}{\frac{a - t}{y - x}} - x\right)}\]
    11. Using strategy rm
    12. Applied *-un-lft-identity10.4

      \[\leadsto \frac{z}{\frac{a - t}{\color{blue}{1 \cdot \left(y - x\right)}}} - \left(\frac{t}{\frac{a - t}{y - x}} - x\right)\]
    13. Applied add-cube-cbrt10.7

      \[\leadsto \frac{z}{\frac{\color{blue}{\left(\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}\right) \cdot \sqrt[3]{a - t}}}{1 \cdot \left(y - x\right)}} - \left(\frac{t}{\frac{a - t}{y - x}} - x\right)\]
    14. Applied times-frac10.7

      \[\leadsto \frac{z}{\color{blue}{\frac{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}{1} \cdot \frac{\sqrt[3]{a - t}}{y - x}}} - \left(\frac{t}{\frac{a - t}{y - x}} - x\right)\]
    15. Applied add-cube-cbrt10.8

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}{\frac{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}{1} \cdot \frac{\sqrt[3]{a - t}}{y - x}} - \left(\frac{t}{\frac{a - t}{y - x}} - x\right)\]
    16. Applied times-frac9.9

      \[\leadsto \color{blue}{\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\frac{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}{1}} \cdot \frac{\sqrt[3]{z}}{\frac{\sqrt[3]{a - t}}{y - x}}} - \left(\frac{t}{\frac{a - t}{y - x}} - x\right)\]
    17. Simplified10.0

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

    if 5.014268344444687e+226 < t

    1. Initial program 51.1

      \[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
    2. Simplified30.3

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a - t}{y - x}} \cdot \left(z - t\right) + x}\]
    7. Simplified30.9

      \[\leadsto \color{blue}{\frac{z - t}{\frac{a - t}{y - x}}} + x\]
    8. Taylor expanded around inf 22.7

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{t}, z, y - \frac{z \cdot y}{t}\right)}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification9.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -3.3348818478163845 \cdot 10^{-40}:\\ \;\;\;\;\frac{z}{\frac{a - t}{y - x}} - \mathsf{fma}\left(\frac{t}{a - t}, y - x, -1 \cdot x\right)\\ \mathbf{elif}\;t \le 1.87885427265612864 \cdot 10^{-162}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)\\ \mathbf{elif}\;t \le 5.014268344444687 \cdot 10^{226}:\\ \;\;\;\;\frac{\sqrt[3]{z}}{\frac{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}{\sqrt[3]{z}}} \cdot \frac{\sqrt[3]{z}}{\frac{\sqrt[3]{a - t}}{y - x}} - \left(\frac{t}{\frac{a - t}{y - x}} - x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{t}, z, y - \frac{z \cdot y}{t}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020064 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< a -1.6153062845442575e-142) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t))))))

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