Average Error: 24.6 → 7.7
Time: 18.7s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -4.7879417768073183 \cdot 10^{-198} \lor \neg \left(a \le 3.09882776451733747 \cdot 10^{-174}\right):\\ \;\;\;\;\frac{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}}{\sqrt[3]{a - z}} \cdot t + \mathsf{fma}\left(\frac{y - z}{a - z}, -x, x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\frac{x}{z} - \frac{t}{z}\right) + t\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -4.7879417768073183 \cdot 10^{-198} \lor \neg \left(a \le 3.09882776451733747 \cdot 10^{-174}\right):\\
\;\;\;\;\frac{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}}{\sqrt[3]{a - z}} \cdot t + \mathsf{fma}\left(\frac{y - z}{a - z}, -x, x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r711290 = x;
        double r711291 = y;
        double r711292 = z;
        double r711293 = r711291 - r711292;
        double r711294 = t;
        double r711295 = r711294 - r711290;
        double r711296 = r711293 * r711295;
        double r711297 = a;
        double r711298 = r711297 - r711292;
        double r711299 = r711296 / r711298;
        double r711300 = r711290 + r711299;
        return r711300;
}

double f(double x, double y, double z, double t, double a) {
        double r711301 = a;
        double r711302 = -4.787941776807318e-198;
        bool r711303 = r711301 <= r711302;
        double r711304 = 3.0988277645173375e-174;
        bool r711305 = r711301 <= r711304;
        double r711306 = !r711305;
        bool r711307 = r711303 || r711306;
        double r711308 = y;
        double r711309 = z;
        double r711310 = r711308 - r711309;
        double r711311 = r711301 - r711309;
        double r711312 = cbrt(r711311);
        double r711313 = r711312 * r711312;
        double r711314 = r711310 / r711313;
        double r711315 = r711314 / r711312;
        double r711316 = t;
        double r711317 = r711315 * r711316;
        double r711318 = r711310 / r711311;
        double r711319 = x;
        double r711320 = -r711319;
        double r711321 = fma(r711318, r711320, r711319);
        double r711322 = r711317 + r711321;
        double r711323 = r711319 / r711309;
        double r711324 = r711316 / r711309;
        double r711325 = r711323 - r711324;
        double r711326 = r711308 * r711325;
        double r711327 = r711326 + r711316;
        double r711328 = r711307 ? r711322 : r711327;
        return r711328;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.6
Target11.6
Herbie7.7
\[\begin{array}{l} \mathbf{if}\;z \lt -1.25361310560950359 \cdot 10^{188}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{elif}\;z \lt 4.44670236911381103 \cdot 10^{64}:\\ \;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\ \mathbf{else}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if a < -4.787941776807318e-198 or 3.0988277645173375e-174 < a

    1. Initial program 23.4

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

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

      \[\leadsto \color{blue}{\frac{y - z}{a - z} \cdot \left(t - x\right) + x}\]
    5. Using strategy rm
    6. Applied sub-neg9.9

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

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

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

      \[\leadsto \frac{y - z}{a - z} \cdot t + \color{blue}{\mathsf{fma}\left(\frac{y - z}{a - z}, -x, x\right)}\]
    10. Using strategy rm
    11. Applied add-cube-cbrt7.4

      \[\leadsto \frac{y - z}{\color{blue}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}} \cdot t + \mathsf{fma}\left(\frac{y - z}{a - z}, -x, x\right)\]
    12. Applied associate-/r*7.4

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

    if -4.787941776807318e-198 < a < 3.0988277645173375e-174

    1. Initial program 30.5

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y - z\right) \cdot \frac{1}{a - z}}, t - x, x\right)\]
    5. Taylor expanded around inf 11.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -4.7879417768073183 \cdot 10^{-198} \lor \neg \left(a \le 3.09882776451733747 \cdot 10^{-174}\right):\\ \;\;\;\;\frac{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}}{\sqrt[3]{a - z}} \cdot t + \mathsf{fma}\left(\frac{y - z}{a - z}, -x, x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\frac{x}{z} - \frac{t}{z}\right) + t\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< z -1.2536131056095036e+188) (- t (* (/ y z) (- t x))) (if (< z 4.446702369113811e+64) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x)))))

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