Average Error: 24.2 → 9.6
Time: 25.4s
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 r441260 = x;
        double r441261 = y;
        double r441262 = z;
        double r441263 = r441261 - r441262;
        double r441264 = t;
        double r441265 = r441264 - r441260;
        double r441266 = r441263 * r441265;
        double r441267 = a;
        double r441268 = r441267 - r441262;
        double r441269 = r441266 / r441268;
        double r441270 = r441260 + r441269;
        return r441270;
}

double f(double x, double y, double z, double t, double a) {
        double r441271 = a;
        double r441272 = -5.991117286694601e-124;
        bool r441273 = r441271 <= r441272;
        double r441274 = y;
        double r441275 = z;
        double r441276 = r441274 - r441275;
        double r441277 = r441271 - r441275;
        double r441278 = cbrt(r441277);
        double r441279 = r441278 * r441278;
        double r441280 = r441276 / r441279;
        double r441281 = r441280 / r441278;
        double r441282 = t;
        double r441283 = x;
        double r441284 = r441282 - r441283;
        double r441285 = fma(r441281, r441284, r441283);
        double r441286 = 4.148123673034126e-100;
        bool r441287 = r441271 <= r441286;
        double r441288 = r441274 / r441275;
        double r441289 = r441288 * r441284;
        double r441290 = r441282 - r441289;
        double r441291 = cbrt(r441276);
        double r441292 = r441291 * r441291;
        double r441293 = r441291 / r441277;
        double r441294 = r441292 * r441293;
        double r441295 = fma(r441294, r441284, r441283);
        double r441296 = r441287 ? r441290 : r441295;
        double r441297 = r441273 ? r441285 : r441296;
        return r441297;
}

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))))