Average Error: 6.8 → 2.9
Time: 14.0s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.726221282888553 \cdot 10^{+37}:\\ \;\;\;\;\left(\left(x - z\right) \cdot t\right) \cdot y\\ \mathbf{elif}\;y \le 1.0004031038538675 \cdot 10^{-14}:\\ \;\;\;\;\left(\left(x - z\right) \cdot y\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;y \le -1.726221282888553 \cdot 10^{+37}:\\
\;\;\;\;\left(\left(x - z\right) \cdot t\right) \cdot y\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r25730543 = x;
        double r25730544 = y;
        double r25730545 = r25730543 * r25730544;
        double r25730546 = z;
        double r25730547 = r25730546 * r25730544;
        double r25730548 = r25730545 - r25730547;
        double r25730549 = t;
        double r25730550 = r25730548 * r25730549;
        return r25730550;
}

double f(double x, double y, double z, double t) {
        double r25730551 = y;
        double r25730552 = -1.726221282888553e+37;
        bool r25730553 = r25730551 <= r25730552;
        double r25730554 = x;
        double r25730555 = z;
        double r25730556 = r25730554 - r25730555;
        double r25730557 = t;
        double r25730558 = r25730556 * r25730557;
        double r25730559 = r25730558 * r25730551;
        double r25730560 = 1.0004031038538675e-14;
        bool r25730561 = r25730551 <= r25730560;
        double r25730562 = r25730556 * r25730551;
        double r25730563 = r25730562 * r25730557;
        double r25730564 = r25730551 * r25730557;
        double r25730565 = r25730556 * r25730564;
        double r25730566 = r25730561 ? r25730563 : r25730565;
        double r25730567 = r25730553 ? r25730559 : r25730566;
        return r25730567;
}

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.8
Target3.1
Herbie2.9
\[\begin{array}{l} \mathbf{if}\;t \lt -9.231879582886777 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t \lt 2.543067051564877 \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 y < -1.726221282888553e+37

    1. Initial program 16.2

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

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

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

    if -1.726221282888553e+37 < y < 1.0004031038538675e-14

    1. Initial program 2.3

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

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

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

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

    if 1.0004031038538675e-14 < y

    1. Initial program 13.4

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

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

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

      \[\leadsto \color{blue}{t \cdot \left(x \cdot y\right) - t \cdot \left(z \cdot y\right)}\]
    6. Simplified3.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.726221282888553 \cdot 10^{+37}:\\ \;\;\;\;\left(\left(x - z\right) \cdot t\right) \cdot y\\ \mathbf{elif}\;y \le 1.0004031038538675 \cdot 10^{-14}:\\ \;\;\;\;\left(\left(x - z\right) \cdot y\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019158 
(FPCore (x y z t)
  :name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"

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