Average Error: 24.2 → 9.6
Time: 27.8s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -5.99111728669460137343493361641315421585 \cdot 10^{-124}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}}{\sqrt[3]{a - z}}, t - x, x\right)\\ \mathbf{elif}\;a \le 4.148123673034126016993570331008942926337 \cdot 10^{-100}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}\right) \cdot \frac{\sqrt[3]{y - z}}{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 -5.99111728669460137343493361641315421585 \cdot 10^{-124}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}}{\sqrt[3]{a - z}}, t - x, x\right)\\

\mathbf{elif}\;a \le 4.148123673034126016993570331008942926337 \cdot 10^{-100}:\\
\;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r439798 = x;
        double r439799 = y;
        double r439800 = z;
        double r439801 = r439799 - r439800;
        double r439802 = t;
        double r439803 = r439802 - r439798;
        double r439804 = r439801 * r439803;
        double r439805 = a;
        double r439806 = r439805 - r439800;
        double r439807 = r439804 / r439806;
        double r439808 = r439798 + r439807;
        return r439808;
}

double f(double x, double y, double z, double t, double a) {
        double r439809 = a;
        double r439810 = -5.991117286694601e-124;
        bool r439811 = r439809 <= r439810;
        double r439812 = y;
        double r439813 = z;
        double r439814 = r439812 - r439813;
        double r439815 = r439809 - r439813;
        double r439816 = cbrt(r439815);
        double r439817 = r439816 * r439816;
        double r439818 = r439814 / r439817;
        double r439819 = r439818 / r439816;
        double r439820 = t;
        double r439821 = x;
        double r439822 = r439820 - r439821;
        double r439823 = fma(r439819, r439822, r439821);
        double r439824 = 4.148123673034126e-100;
        bool r439825 = r439809 <= r439824;
        double r439826 = r439812 / r439813;
        double r439827 = r439826 * r439822;
        double r439828 = r439820 - r439827;
        double r439829 = cbrt(r439814);
        double r439830 = r439829 * r439829;
        double r439831 = r439829 / r439815;
        double r439832 = r439830 * r439831;
        double r439833 = fma(r439832, r439822, r439821);
        double r439834 = r439825 ? r439828 : r439833;
        double r439835 = r439811 ? r439823 : r439834;
        return r439835;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.2
Target12.2
Herbie9.6
\[\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 < -5.991117286694601e-124

    1. Initial program 23.1

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

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

      \[\leadsto \mathsf{fma}\left(\frac{y - z}{\color{blue}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}}, t - x, x\right)\]
    5. Applied associate-/r*9.5

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

    if -5.991117286694601e-124 < a < 4.148123673034126e-100

    1. Initial program 28.7

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

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

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

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

    if 4.148123673034126e-100 < a

    1. Initial program 21.6

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

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

      \[\leadsto \mathsf{fma}\left(\frac{y - z}{\color{blue}{1 \cdot \left(a - z\right)}}, t - x, x\right)\]
    5. Applied add-cube-cbrt8.3

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\left(\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}\right) \cdot \sqrt[3]{y - z}}}{1 \cdot \left(a - z\right)}, t - x, x\right)\]
    6. Applied times-frac8.3

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}}{1} \cdot \frac{\sqrt[3]{y - z}}{a - z}}, t - x, x\right)\]
    7. Simplified8.3

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

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

Reproduce

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