Average Error: 24.8 → 10.4
Time: 49.6s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.72473621819271822983298906704764536646 \cdot 10^{278}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z}, t - \frac{y}{\frac{z}{t}}\right)\\ \mathbf{elif}\;z \le 2.352105029248821724688499574476619091463 \cdot 10^{184}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a - z} - \frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\frac{a - z}{\sqrt[3]{z}}}, t - x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z}, t - \frac{y}{\frac{z}{t}}\right)\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -1.72473621819271822983298906704764536646 \cdot 10^{278}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z}, t - \frac{y}{\frac{z}{t}}\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r26910107 = x;
        double r26910108 = y;
        double r26910109 = z;
        double r26910110 = r26910108 - r26910109;
        double r26910111 = t;
        double r26910112 = r26910111 - r26910107;
        double r26910113 = r26910110 * r26910112;
        double r26910114 = a;
        double r26910115 = r26910114 - r26910109;
        double r26910116 = r26910113 / r26910115;
        double r26910117 = r26910107 + r26910116;
        return r26910117;
}

double f(double x, double y, double z, double t, double a) {
        double r26910118 = z;
        double r26910119 = -1.7247362181927182e+278;
        bool r26910120 = r26910118 <= r26910119;
        double r26910121 = y;
        double r26910122 = x;
        double r26910123 = r26910122 / r26910118;
        double r26910124 = t;
        double r26910125 = r26910118 / r26910124;
        double r26910126 = r26910121 / r26910125;
        double r26910127 = r26910124 - r26910126;
        double r26910128 = fma(r26910121, r26910123, r26910127);
        double r26910129 = 2.3521050292488217e+184;
        bool r26910130 = r26910118 <= r26910129;
        double r26910131 = a;
        double r26910132 = r26910131 - r26910118;
        double r26910133 = r26910121 / r26910132;
        double r26910134 = cbrt(r26910118);
        double r26910135 = r26910134 * r26910134;
        double r26910136 = r26910132 / r26910134;
        double r26910137 = r26910135 / r26910136;
        double r26910138 = r26910133 - r26910137;
        double r26910139 = r26910124 - r26910122;
        double r26910140 = fma(r26910138, r26910139, r26910122);
        double r26910141 = r26910130 ? r26910140 : r26910128;
        double r26910142 = r26910120 ? r26910128 : r26910141;
        return r26910142;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.8
Target12.0
Herbie10.4
\[\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 2 regimes
  2. if z < -1.7247362181927182e+278 or 2.3521050292488217e+184 < z

    1. Initial program 51.2

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

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

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

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

    if -1.7247362181927182e+278 < z < 2.3521050292488217e+184

    1. Initial program 20.2

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

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

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

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

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

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

Reproduce

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