Average Error: 6.8 → 1.4
Time: 16.6s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -7.637749908568344465245783068255842775677 \cdot 10^{244}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 5.591524763393076235512857121471251248446 \cdot 10^{289}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t \cdot \left(x - z\right)\right) \cdot y\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot y \le -7.637749908568344465245783068255842775677 \cdot 10^{244}:\\
\;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r18760561 = x;
        double r18760562 = y;
        double r18760563 = r18760561 * r18760562;
        double r18760564 = z;
        double r18760565 = r18760564 * r18760562;
        double r18760566 = r18760563 - r18760565;
        double r18760567 = t;
        double r18760568 = r18760566 * r18760567;
        return r18760568;
}

double f(double x, double y, double z, double t) {
        double r18760569 = x;
        double r18760570 = y;
        double r18760571 = r18760569 * r18760570;
        double r18760572 = z;
        double r18760573 = r18760572 * r18760570;
        double r18760574 = r18760571 - r18760573;
        double r18760575 = -7.637749908568344e+244;
        bool r18760576 = r18760574 <= r18760575;
        double r18760577 = r18760569 - r18760572;
        double r18760578 = t;
        double r18760579 = r18760570 * r18760578;
        double r18760580 = r18760577 * r18760579;
        double r18760581 = 5.591524763393076e+289;
        bool r18760582 = r18760574 <= r18760581;
        double r18760583 = r18760578 * r18760574;
        double r18760584 = r18760578 * r18760577;
        double r18760585 = r18760584 * r18760570;
        double r18760586 = r18760582 ? r18760583 : r18760585;
        double r18760587 = r18760576 ? r18760580 : r18760586;
        return r18760587;
}

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.0
Herbie1.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 3 regimes
  2. if (- (* x y) (* z y)) < -7.637749908568344e+244

    1. Initial program 35.5

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified0.4

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

    if -7.637749908568344e+244 < (- (* x y) (* z y)) < 5.591524763393076e+289

    1. Initial program 1.5

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

    if 5.591524763393076e+289 < (- (* x y) (* z y))

    1. Initial program 53.1

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified0.3

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

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

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

Reproduce

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