Average Error: 23.1 → 10.0
Time: 23.7s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -4.576904563487002 \cdot 10^{+105}:\\ \;\;\;\;t + \left(\frac{x}{z} - \frac{t}{z}\right) \cdot y\\ \mathbf{elif}\;z \le 2.4122683507888716 \cdot 10^{+184}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}, \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \left(y - z\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;t + \left(\frac{x}{z} - \frac{t}{z}\right) \cdot y\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -4.576904563487002 \cdot 10^{+105}:\\
\;\;\;\;t + \left(\frac{x}{z} - \frac{t}{z}\right) \cdot y\\

\mathbf{elif}\;z \le 2.4122683507888716 \cdot 10^{+184}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}, \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \left(y - z\right), x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r27710329 = x;
        double r27710330 = y;
        double r27710331 = z;
        double r27710332 = r27710330 - r27710331;
        double r27710333 = t;
        double r27710334 = r27710333 - r27710329;
        double r27710335 = r27710332 * r27710334;
        double r27710336 = a;
        double r27710337 = r27710336 - r27710331;
        double r27710338 = r27710335 / r27710337;
        double r27710339 = r27710329 + r27710338;
        return r27710339;
}

double f(double x, double y, double z, double t, double a) {
        double r27710340 = z;
        double r27710341 = -4.576904563487002e+105;
        bool r27710342 = r27710340 <= r27710341;
        double r27710343 = t;
        double r27710344 = x;
        double r27710345 = r27710344 / r27710340;
        double r27710346 = r27710343 / r27710340;
        double r27710347 = r27710345 - r27710346;
        double r27710348 = y;
        double r27710349 = r27710347 * r27710348;
        double r27710350 = r27710343 + r27710349;
        double r27710351 = 2.4122683507888716e+184;
        bool r27710352 = r27710340 <= r27710351;
        double r27710353 = r27710343 - r27710344;
        double r27710354 = cbrt(r27710353);
        double r27710355 = r27710354 * r27710354;
        double r27710356 = a;
        double r27710357 = r27710356 - r27710340;
        double r27710358 = cbrt(r27710357);
        double r27710359 = r27710358 * r27710358;
        double r27710360 = r27710355 / r27710359;
        double r27710361 = r27710354 / r27710358;
        double r27710362 = r27710348 - r27710340;
        double r27710363 = r27710361 * r27710362;
        double r27710364 = fma(r27710360, r27710363, r27710344);
        double r27710365 = r27710352 ? r27710364 : r27710350;
        double r27710366 = r27710342 ? r27710350 : r27710365;
        return r27710366;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original23.1
Target11.7
Herbie10.0
\[\begin{array}{l} \mathbf{if}\;z \lt -1.2536131056095036 \cdot 10^{+188}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{elif}\;z \lt 4.446702369113811 \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 < -4.576904563487002e+105 or 2.4122683507888716e+184 < z

    1. Initial program 44.1

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

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

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

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

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

      \[\leadsto \left(t - x\right) \cdot \color{blue}{\frac{y - z}{a - z}} + x\]
    9. Taylor expanded around inf 24.7

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

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

    if -4.576904563487002e+105 < z < 2.4122683507888716e+184

    1. Initial program 14.4

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

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

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

      \[\leadsto \frac{t - x}{\color{blue}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}} \cdot \left(y - z\right) + x\]
    7. Applied add-cube-cbrt9.9

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \left(\frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \left(y - z\right)\right)} + x\]
    10. Using strategy rm
    11. Applied fma-def7.1

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

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

Reproduce

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

  :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))))