Average Error: 25.2 → 7.4
Time: 5.3s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -6.19554989470960079 \cdot 10^{225}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{\frac{y - z}{a - z}} \cdot \sqrt[3]{\frac{y - z}{a - z}}\right) \cdot \left(\sqrt[3]{\frac{y - z}{a - z}} \cdot t\right) + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -6.19554989470960079 \cdot 10^{225}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r692243 = x;
        double r692244 = y;
        double r692245 = z;
        double r692246 = r692244 - r692245;
        double r692247 = t;
        double r692248 = r692247 - r692243;
        double r692249 = r692246 * r692248;
        double r692250 = a;
        double r692251 = r692250 - r692245;
        double r692252 = r692249 / r692251;
        double r692253 = r692243 + r692252;
        return r692253;
}

double f(double x, double y, double z, double t, double a) {
        double r692254 = z;
        double r692255 = -6.195549894709601e+225;
        bool r692256 = r692254 <= r692255;
        double r692257 = y;
        double r692258 = x;
        double r692259 = r692258 / r692254;
        double r692260 = t;
        double r692261 = r692260 / r692254;
        double r692262 = r692259 - r692261;
        double r692263 = fma(r692257, r692262, r692260);
        double r692264 = r692257 - r692254;
        double r692265 = a;
        double r692266 = r692265 - r692254;
        double r692267 = r692264 / r692266;
        double r692268 = cbrt(r692267);
        double r692269 = r692268 * r692268;
        double r692270 = r692268 * r692260;
        double r692271 = r692269 * r692270;
        double r692272 = -r692258;
        double r692273 = fma(r692272, r692267, r692258);
        double r692274 = r692271 + r692273;
        double r692275 = r692256 ? r692263 : r692274;
        return r692275;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original25.2
Target12.0
Herbie7.4
\[\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 z < -6.195549894709601e+225

    1. Initial program 51.4

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

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

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

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

    if -6.195549894709601e+225 < z

    1. Initial program 23.1

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

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

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

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

      \[\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.7

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

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

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

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

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

Reproduce

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