Average Error: 6.9 → 1.8
Time: 2.3s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -2.4497457395774816 \cdot 10^{274}:\\ \;\;\;\;1 \cdot \left(\left(t \cdot y\right) \cdot x + \left(t \cdot y\right) \cdot \left(-z\right)\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 5.194293911522653 \cdot 10^{144}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot y \le -2.4497457395774816 \cdot 10^{274}:\\
\;\;\;\;1 \cdot \left(\left(t \cdot y\right) \cdot x + \left(t \cdot y\right) \cdot \left(-z\right)\right)\\

\mathbf{elif}\;x \cdot y - z \cdot y \le 5.194293911522653 \cdot 10^{144}:\\
\;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\

\end{array}
double f(double x, double y, double z, double t) {
        double r512408 = x;
        double r512409 = y;
        double r512410 = r512408 * r512409;
        double r512411 = z;
        double r512412 = r512411 * r512409;
        double r512413 = r512410 - r512412;
        double r512414 = t;
        double r512415 = r512413 * r512414;
        return r512415;
}

double f(double x, double y, double z, double t) {
        double r512416 = x;
        double r512417 = y;
        double r512418 = r512416 * r512417;
        double r512419 = z;
        double r512420 = r512419 * r512417;
        double r512421 = r512418 - r512420;
        double r512422 = -2.4497457395774816e+274;
        bool r512423 = r512421 <= r512422;
        double r512424 = 1.0;
        double r512425 = t;
        double r512426 = r512425 * r512417;
        double r512427 = r512426 * r512416;
        double r512428 = -r512419;
        double r512429 = r512426 * r512428;
        double r512430 = r512427 + r512429;
        double r512431 = r512424 * r512430;
        double r512432 = 5.1942939115226525e+144;
        bool r512433 = r512421 <= r512432;
        double r512434 = r512421 * r512425;
        double r512435 = r512416 - r512419;
        double r512436 = r512435 * r512425;
        double r512437 = r512417 * r512436;
        double r512438 = r512433 ? r512434 : r512437;
        double r512439 = r512423 ? r512431 : r512438;
        return r512439;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.9
Target3.1
Herbie1.8
\[\begin{array}{l} \mathbf{if}\;t \lt -9.2318795828867769 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t \lt 2.5430670515648771 \cdot 10^{83}:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if (- (* x y) (* z y)) < -2.4497457395774816e+274

    1. Initial program 48.4

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Using strategy rm
    3. Applied *-un-lft-identity48.4

      \[\leadsto \color{blue}{\left(1 \cdot \left(x \cdot y - z \cdot y\right)\right)} \cdot t\]
    4. Applied associate-*l*48.4

      \[\leadsto \color{blue}{1 \cdot \left(\left(x \cdot y - z \cdot y\right) \cdot t\right)}\]
    5. Simplified0.3

      \[\leadsto 1 \cdot \color{blue}{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}\]
    6. Using strategy rm
    7. Applied sub-neg0.3

      \[\leadsto 1 \cdot \left(\left(t \cdot y\right) \cdot \color{blue}{\left(x + \left(-z\right)\right)}\right)\]
    8. Applied distribute-lft-in0.3

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

    if -2.4497457395774816e+274 < (- (* x y) (* z y)) < 5.1942939115226525e+144

    1. Initial program 1.7

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]

    if 5.1942939115226525e+144 < (- (* x y) (* z y))

    1. Initial program 21.1

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Using strategy rm
    3. Applied distribute-rgt-out--21.1

      \[\leadsto \color{blue}{\left(y \cdot \left(x - z\right)\right)} \cdot t\]
    4. Applied associate-*l*2.7

      \[\leadsto \color{blue}{y \cdot \left(\left(x - z\right) \cdot t\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -2.4497457395774816 \cdot 10^{274}:\\ \;\;\;\;1 \cdot \left(\left(t \cdot y\right) \cdot x + \left(t \cdot y\right) \cdot \left(-z\right)\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 5.194293911522653 \cdot 10^{144}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020065 +o rules:numerics
(FPCore (x y z t)
  :name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"
  :precision binary64

  :herbie-target
  (if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t)))

  (* (- (* x y) (* z y)) t))