Average Error: 24.5 → 10.8
Time: 25.1s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -4.773373498705184261630054814651574103601 \cdot 10^{-248}:\\ \;\;\;\;\left(\frac{\sqrt[3]{y - z}}{\frac{a - z}{\sqrt[3]{y - z}}} \cdot \left(t - x\right)\right) \cdot \sqrt[3]{y - z} + x\\ \mathbf{elif}\;a \le 2.8263443798943843254538667974456882638 \cdot 10^{-123}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right) - \frac{t \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(y - z\right) \cdot \frac{1}{a - z}, t - x, x\right)\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -4.773373498705184261630054814651574103601 \cdot 10^{-248}:\\
\;\;\;\;\left(\frac{\sqrt[3]{y - z}}{\frac{a - z}{\sqrt[3]{y - z}}} \cdot \left(t - x\right)\right) \cdot \sqrt[3]{y - z} + x\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(y - z\right) \cdot \frac{1}{a - z}, t - x, x\right)\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r436894 = x;
        double r436895 = y;
        double r436896 = z;
        double r436897 = r436895 - r436896;
        double r436898 = t;
        double r436899 = r436898 - r436894;
        double r436900 = r436897 * r436899;
        double r436901 = a;
        double r436902 = r436901 - r436896;
        double r436903 = r436900 / r436902;
        double r436904 = r436894 + r436903;
        return r436904;
}

double f(double x, double y, double z, double t, double a) {
        double r436905 = a;
        double r436906 = -4.773373498705184e-248;
        bool r436907 = r436905 <= r436906;
        double r436908 = y;
        double r436909 = z;
        double r436910 = r436908 - r436909;
        double r436911 = cbrt(r436910);
        double r436912 = r436905 - r436909;
        double r436913 = r436912 / r436911;
        double r436914 = r436911 / r436913;
        double r436915 = t;
        double r436916 = x;
        double r436917 = r436915 - r436916;
        double r436918 = r436914 * r436917;
        double r436919 = r436918 * r436911;
        double r436920 = r436919 + r436916;
        double r436921 = 2.8263443798943843e-123;
        bool r436922 = r436905 <= r436921;
        double r436923 = r436916 / r436909;
        double r436924 = fma(r436923, r436908, r436915);
        double r436925 = r436915 * r436908;
        double r436926 = r436925 / r436909;
        double r436927 = r436924 - r436926;
        double r436928 = 1.0;
        double r436929 = r436928 / r436912;
        double r436930 = r436910 * r436929;
        double r436931 = fma(r436930, r436917, r436916);
        double r436932 = r436922 ? r436927 : r436931;
        double r436933 = r436907 ? r436920 : r436932;
        return r436933;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.5
Target12.0
Herbie10.8
\[\begin{array}{l} \mathbf{if}\;z \lt -1.253613105609503593846459977496550767343 \cdot 10^{188}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{elif}\;z \lt 4.446702369113811028051510715777703865332 \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 < -4.773373498705184e-248

    1. Initial program 23.2

      \[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 add-cube-cbrt11.1

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}}{\frac{a - z}{\sqrt[3]{y - z}}}} \cdot \left(t - x\right) + x\]
    8. Using strategy rm
    9. Applied *-un-lft-identity11.2

      \[\leadsto \frac{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}}{\frac{a - z}{\sqrt[3]{\color{blue}{1 \cdot \left(y - z\right)}}}} \cdot \left(t - x\right) + x\]
    10. Applied cbrt-prod11.2

      \[\leadsto \frac{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}}{\frac{a - z}{\color{blue}{\sqrt[3]{1} \cdot \sqrt[3]{y - z}}}} \cdot \left(t - x\right) + x\]
    11. Applied *-un-lft-identity11.2

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

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

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

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

    if -4.773373498705184e-248 < a < 2.8263443798943843e-123

    1. Initial program 31.5

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

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

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

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

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

    if 2.8263443798943843e-123 < a

    1. Initial program 22.7

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

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

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

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

Reproduce

herbie shell --seed 2019305 +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.25361310560950359e188) (- t (* (/ y z) (- t x))) (if (< z 4.44670236911381103e64) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x)))))

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