Average Error: 24.5 → 9.5
Time: 7.8s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -6.8292046976100912 \cdot 10^{155} \lor \neg \left(z \le 7.37344260106273469 \cdot 10^{217}\right):\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \left(\frac{\sqrt[3]{y - z}}{\sqrt[3]{a - z}} \cdot \left(t - x\right)\right) + x\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -6.8292046976100912 \cdot 10^{155} \lor \neg \left(z \le 7.37344260106273469 \cdot 10^{217}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r583788 = x;
        double r583789 = y;
        double r583790 = z;
        double r583791 = r583789 - r583790;
        double r583792 = t;
        double r583793 = r583792 - r583788;
        double r583794 = r583791 * r583793;
        double r583795 = a;
        double r583796 = r583795 - r583790;
        double r583797 = r583794 / r583796;
        double r583798 = r583788 + r583797;
        return r583798;
}

double f(double x, double y, double z, double t, double a) {
        double r583799 = z;
        double r583800 = -6.829204697610091e+155;
        bool r583801 = r583799 <= r583800;
        double r583802 = 7.373442601062735e+217;
        bool r583803 = r583799 <= r583802;
        double r583804 = !r583803;
        bool r583805 = r583801 || r583804;
        double r583806 = y;
        double r583807 = x;
        double r583808 = r583807 / r583799;
        double r583809 = t;
        double r583810 = r583809 / r583799;
        double r583811 = r583808 - r583810;
        double r583812 = fma(r583806, r583811, r583809);
        double r583813 = r583806 - r583799;
        double r583814 = cbrt(r583813);
        double r583815 = r583814 * r583814;
        double r583816 = a;
        double r583817 = r583816 - r583799;
        double r583818 = cbrt(r583817);
        double r583819 = r583818 * r583818;
        double r583820 = r583815 / r583819;
        double r583821 = r583814 / r583818;
        double r583822 = r583809 - r583807;
        double r583823 = r583821 * r583822;
        double r583824 = r583820 * r583823;
        double r583825 = r583824 + r583807;
        double r583826 = r583805 ? r583812 : r583825;
        return r583826;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.5
Target11.5
Herbie9.5
\[\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.829204697610091e+155 or 7.373442601062735e+217 < z

    1. Initial program 49.2

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

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

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

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

    if -6.829204697610091e+155 < z < 7.373442601062735e+217

    1. Initial program 17.1

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

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

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

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

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

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

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

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

Reproduce

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