Average Error: 6.8 → 2.9
Time: 16.2s
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 r22766362 = x;
        double r22766363 = y;
        double r22766364 = r22766362 * r22766363;
        double r22766365 = z;
        double r22766366 = r22766365 * r22766363;
        double r22766367 = r22766364 - r22766366;
        double r22766368 = t;
        double r22766369 = r22766367 * r22766368;
        return r22766369;
}

double f(double x, double y, double z, double t) {
        double r22766370 = y;
        double r22766371 = -1.726221282888553e+37;
        bool r22766372 = r22766370 <= r22766371;
        double r22766373 = x;
        double r22766374 = z;
        double r22766375 = r22766373 - r22766374;
        double r22766376 = t;
        double r22766377 = r22766375 * r22766376;
        double r22766378 = r22766377 * r22766370;
        double r22766379 = 1.0004031038538675e-14;
        bool r22766380 = r22766370 <= r22766379;
        double r22766381 = r22766375 * r22766370;
        double r22766382 = r22766381 * r22766376;
        double r22766383 = r22766370 * r22766376;
        double r22766384 = r22766375 * r22766383;
        double r22766385 = r22766380 ? r22766382 : r22766384;
        double r22766386 = r22766372 ? r22766378 : r22766385;
        return r22766386;
}

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(\left(x - z\right) \cdot y\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(t \cdot y\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 +o rules:numerics
(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))