Average Error: 23.1 → 9.7
Time: 23.5s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.4099298907342983 \cdot 10^{-190}:\\ \;\;\;\;x + \left(t - x\right) \cdot \frac{y - z}{a - z}\\ \mathbf{elif}\;a \le 6.167365069204261 \cdot 10^{-186}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right) - \frac{t}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\left(x + \left(-\frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right) \cdot \left(\frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot z\right)\right) + \left(y \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right) \cdot \frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -2.4099298907342983 \cdot 10^{-190}:\\
\;\;\;\;x + \left(t - x\right) \cdot \frac{y - z}{a - z}\\

\mathbf{elif}\;a \le 6.167365069204261 \cdot 10^{-186}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right) - \frac{t}{\frac{z}{y}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r28699819 = x;
        double r28699820 = y;
        double r28699821 = z;
        double r28699822 = r28699820 - r28699821;
        double r28699823 = t;
        double r28699824 = r28699823 - r28699819;
        double r28699825 = r28699822 * r28699824;
        double r28699826 = a;
        double r28699827 = r28699826 - r28699821;
        double r28699828 = r28699825 / r28699827;
        double r28699829 = r28699819 + r28699828;
        return r28699829;
}

double f(double x, double y, double z, double t, double a) {
        double r28699830 = a;
        double r28699831 = -2.4099298907342983e-190;
        bool r28699832 = r28699830 <= r28699831;
        double r28699833 = x;
        double r28699834 = t;
        double r28699835 = r28699834 - r28699833;
        double r28699836 = y;
        double r28699837 = z;
        double r28699838 = r28699836 - r28699837;
        double r28699839 = r28699830 - r28699837;
        double r28699840 = r28699838 / r28699839;
        double r28699841 = r28699835 * r28699840;
        double r28699842 = r28699833 + r28699841;
        double r28699843 = 6.167365069204261e-186;
        bool r28699844 = r28699830 <= r28699843;
        double r28699845 = r28699833 / r28699837;
        double r28699846 = fma(r28699845, r28699836, r28699834);
        double r28699847 = r28699837 / r28699836;
        double r28699848 = r28699834 / r28699847;
        double r28699849 = r28699846 - r28699848;
        double r28699850 = cbrt(r28699835);
        double r28699851 = r28699850 * r28699850;
        double r28699852 = cbrt(r28699839);
        double r28699853 = r28699852 * r28699852;
        double r28699854 = r28699851 / r28699853;
        double r28699855 = -r28699854;
        double r28699856 = r28699850 / r28699852;
        double r28699857 = r28699856 * r28699837;
        double r28699858 = r28699855 * r28699857;
        double r28699859 = r28699833 + r28699858;
        double r28699860 = r28699836 * r28699856;
        double r28699861 = r28699860 * r28699854;
        double r28699862 = r28699859 + r28699861;
        double r28699863 = r28699844 ? r28699849 : r28699862;
        double r28699864 = r28699832 ? r28699842 : r28699863;
        return r28699864;
}

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
Herbie9.7
\[\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 3 regimes
  2. if a < -2.4099298907342983e-190

    1. Initial program 21.8

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

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

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

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

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

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

    if -2.4099298907342983e-190 < a < 6.167365069204261e-186

    1. Initial program 27.9

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

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

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

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

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

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

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

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

    if 6.167365069204261e-186 < a

    1. Initial program 22.5

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

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

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

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

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

      \[\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*10.3

      \[\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 sub-neg10.3

      \[\leadsto \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 \color{blue}{\left(y + \left(-z\right)\right)}\right) + x\]
    12. Applied distribute-rgt-in10.3

      \[\leadsto \frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \color{blue}{\left(y \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} + \left(-z\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)} + x\]
    13. Applied distribute-rgt-in10.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.4099298907342983 \cdot 10^{-190}:\\ \;\;\;\;x + \left(t - x\right) \cdot \frac{y - z}{a - z}\\ \mathbf{elif}\;a \le 6.167365069204261 \cdot 10^{-186}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right) - \frac{t}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\left(x + \left(-\frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right) \cdot \left(\frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot z\right)\right) + \left(y \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right) \cdot \frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\\ \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))))