Average Error: 24.9 → 9.3
Time: 6.2s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} = -\infty:\\ \;\;\;\;\mathsf{fma}\left(\left(y - x\right) \cdot \frac{1}{a - t}, z - t, x\right)\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \le -3.75564871917852029 \cdot 10^{-299}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \le 0.0:\\ \;\;\;\;y\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \le 3.6671185442121014 \cdot 10^{307}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(\sqrt[3]{\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}} \cdot \sqrt[3]{\frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}}}\right) \cdot \sqrt[3]{\frac{y - x}{a - t}}\right) \cdot \sqrt[3]{\frac{y - x}{a - t}}, z - t, x\right)\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} = -\infty:\\
\;\;\;\;\mathsf{fma}\left(\left(y - x\right) \cdot \frac{1}{a - t}, z - t, x\right)\\

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

\mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \le 0.0:\\
\;\;\;\;y\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r566055 = x;
        double r566056 = y;
        double r566057 = r566056 - r566055;
        double r566058 = z;
        double r566059 = t;
        double r566060 = r566058 - r566059;
        double r566061 = r566057 * r566060;
        double r566062 = a;
        double r566063 = r566062 - r566059;
        double r566064 = r566061 / r566063;
        double r566065 = r566055 + r566064;
        return r566065;
}

double f(double x, double y, double z, double t, double a) {
        double r566066 = x;
        double r566067 = y;
        double r566068 = r566067 - r566066;
        double r566069 = z;
        double r566070 = t;
        double r566071 = r566069 - r566070;
        double r566072 = r566068 * r566071;
        double r566073 = a;
        double r566074 = r566073 - r566070;
        double r566075 = r566072 / r566074;
        double r566076 = r566066 + r566075;
        double r566077 = -inf.0;
        bool r566078 = r566076 <= r566077;
        double r566079 = 1.0;
        double r566080 = r566079 / r566074;
        double r566081 = r566068 * r566080;
        double r566082 = fma(r566081, r566071, r566066);
        double r566083 = -3.7556487191785203e-299;
        bool r566084 = r566076 <= r566083;
        double r566085 = 0.0;
        bool r566086 = r566076 <= r566085;
        double r566087 = 3.6671185442121014e+307;
        bool r566088 = r566076 <= r566087;
        double r566089 = cbrt(r566068);
        double r566090 = r566089 * r566089;
        double r566091 = cbrt(r566074);
        double r566092 = r566091 * r566091;
        double r566093 = r566090 / r566092;
        double r566094 = cbrt(r566093);
        double r566095 = r566089 / r566091;
        double r566096 = cbrt(r566095);
        double r566097 = r566094 * r566096;
        double r566098 = r566068 / r566074;
        double r566099 = cbrt(r566098);
        double r566100 = r566097 * r566099;
        double r566101 = r566100 * r566099;
        double r566102 = fma(r566101, r566071, r566066);
        double r566103 = r566088 ? r566076 : r566102;
        double r566104 = r566086 ? r566067 : r566103;
        double r566105 = r566084 ? r566076 : r566104;
        double r566106 = r566078 ? r566082 : r566105;
        return r566106;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.9
Target9.3
Herbie9.3
\[\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 (+ x (/ (* (- y x) (- z t)) (- a t))) < -inf.0

    1. Initial program 64.0

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

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

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

    if -inf.0 < (+ x (/ (* (- y x) (- z t)) (- a t))) < -3.7556487191785203e-299 or 0.0 < (+ x (/ (* (- y x) (- z t)) (- a t))) < 3.6671185442121014e+307

    1. Initial program 2.0

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

    if -3.7556487191785203e-299 < (+ x (/ (* (- y x) (- z t)) (- a t))) < 0.0

    1. Initial program 60.7

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - x}{a - t}, z - t, x\right)}\]
    3. Taylor expanded around 0 34.4

      \[\leadsto \color{blue}{y}\]

    if 3.6671185442121014e+307 < (+ x (/ (* (- y x) (- z t)) (- a t)))

    1. Initial program 63.9

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\sqrt[3]{\frac{y - x}{a - t}} \cdot \sqrt[3]{\frac{y - x}{a - t}}\right) \cdot \sqrt[3]{\frac{y - x}{a - t}}}, z - t, x\right)\]
    5. Using strategy rm
    6. Applied add-cube-cbrt18.4

      \[\leadsto \mathsf{fma}\left(\left(\sqrt[3]{\frac{y - x}{\color{blue}{\left(\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}\right) \cdot \sqrt[3]{a - t}}}} \cdot \sqrt[3]{\frac{y - x}{a - t}}\right) \cdot \sqrt[3]{\frac{y - x}{a - t}}, z - t, x\right)\]
    7. Applied add-cube-cbrt18.4

      \[\leadsto \mathsf{fma}\left(\left(\sqrt[3]{\frac{\color{blue}{\left(\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}\right) \cdot \sqrt[3]{y - x}}}{\left(\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}\right) \cdot \sqrt[3]{a - t}}} \cdot \sqrt[3]{\frac{y - x}{a - t}}\right) \cdot \sqrt[3]{\frac{y - x}{a - t}}, z - t, x\right)\]
    8. Applied times-frac18.4

      \[\leadsto \mathsf{fma}\left(\left(\sqrt[3]{\color{blue}{\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}} \cdot \frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}}}} \cdot \sqrt[3]{\frac{y - x}{a - t}}\right) \cdot \sqrt[3]{\frac{y - x}{a - t}}, z - t, x\right)\]
    9. Applied cbrt-prod18.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} = -\infty:\\ \;\;\;\;\mathsf{fma}\left(\left(y - x\right) \cdot \frac{1}{a - t}, z - t, x\right)\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \le -3.75564871917852029 \cdot 10^{-299}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \le 0.0:\\ \;\;\;\;y\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \le 3.6671185442121014 \cdot 10^{307}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(\sqrt[3]{\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}} \cdot \sqrt[3]{\frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}}}\right) \cdot \sqrt[3]{\frac{y - x}{a - t}}\right) \cdot \sqrt[3]{\frac{y - x}{a - t}}, z - t, x\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020036 +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))))