Average Error: 6.7 → 3.4
Time: 19.7s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;t \le -876245470925403675688960:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \mathbf{elif}\;t \le 1.423758204789824948069288977989847450071 \cdot 10^{161}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;t \le -876245470925403675688960:\\
\;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r152931533 = x;
        double r152931534 = y;
        double r152931535 = r152931533 * r152931534;
        double r152931536 = z;
        double r152931537 = r152931536 * r152931534;
        double r152931538 = r152931535 - r152931537;
        double r152931539 = t;
        double r152931540 = r152931538 * r152931539;
        return r152931540;
}

double f(double x, double y, double z, double t) {
        double r152931541 = t;
        double r152931542 = -8.762454709254037e+23;
        bool r152931543 = r152931541 <= r152931542;
        double r152931544 = y;
        double r152931545 = x;
        double r152931546 = z;
        double r152931547 = r152931545 - r152931546;
        double r152931548 = r152931544 * r152931547;
        double r152931549 = r152931548 * r152931541;
        double r152931550 = 1.423758204789825e+161;
        bool r152931551 = r152931541 <= r152931550;
        double r152931552 = r152931547 * r152931541;
        double r152931553 = r152931544 * r152931552;
        double r152931554 = r152931551 ? r152931553 : r152931549;
        double r152931555 = r152931543 ? r152931549 : r152931554;
        return r152931555;
}

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.7
Target3.2
Herbie3.4
\[\begin{array}{l} \mathbf{if}\;t \lt -9.231879582886776938073886590448747944753 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t \lt 2.543067051564877116200336808272775217995 \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 2 regimes
  2. if t < -8.762454709254037e+23 or 1.423758204789825e+161 < t

    1. Initial program 3.9

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified3.9

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

    if -8.762454709254037e+23 < t < 1.423758204789825e+161

    1. Initial program 7.5

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified7.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -876245470925403675688960:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \mathbf{elif}\;t \le 1.423758204789824948069288977989847450071 \cdot 10^{161}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \end{array}\]

Reproduce

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