Average Error: 6.6 → 0.4
Time: 9.1s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -4.459424609020142156947398974899037795759 \cdot 10^{249}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -1.008422558588387463522628361222361000871 \cdot 10^{-262}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 4.940656458412465441765687928682213723651 \cdot 10^{-324}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.788444888601380616753990222655785959076 \cdot 10^{215}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\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 -4.459424609020142156947398974899037795759 \cdot 10^{249}:\\
\;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\

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

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

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r413588 = x;
        double r413589 = y;
        double r413590 = r413588 * r413589;
        double r413591 = z;
        double r413592 = r413591 * r413589;
        double r413593 = r413590 - r413592;
        double r413594 = t;
        double r413595 = r413593 * r413594;
        return r413595;
}

double f(double x, double y, double z, double t) {
        double r413596 = x;
        double r413597 = y;
        double r413598 = r413596 * r413597;
        double r413599 = z;
        double r413600 = r413599 * r413597;
        double r413601 = r413598 - r413600;
        double r413602 = -4.459424609020142e+249;
        bool r413603 = r413601 <= r413602;
        double r413604 = r413596 - r413599;
        double r413605 = t;
        double r413606 = r413604 * r413605;
        double r413607 = r413597 * r413606;
        double r413608 = -1.0084225585883875e-262;
        bool r413609 = r413601 <= r413608;
        double r413610 = r413601 * r413605;
        double r413611 = 4.9406564584125e-324;
        bool r413612 = r413601 <= r413611;
        double r413613 = 1.7884448886013806e+215;
        bool r413614 = r413601 <= r413613;
        double r413615 = r413605 * r413597;
        double r413616 = r413615 * r413604;
        double r413617 = r413614 ? r413610 : r413616;
        double r413618 = r413612 ? r413607 : r413617;
        double r413619 = r413609 ? r413610 : r413618;
        double r413620 = r413603 ? r413607 : r413619;
        return r413620;
}

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.6
Target2.9
Herbie0.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)) < -4.459424609020142e+249 or -1.0084225585883875e-262 < (- (* x y) (* z y)) < 4.9406564584125e-324

    1. Initial program 26.3

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

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

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

    if -4.459424609020142e+249 < (- (* x y) (* z y)) < -1.0084225585883875e-262 or 4.9406564584125e-324 < (- (* x y) (* z y)) < 1.7884448886013806e+215

    1. Initial program 0.3

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

    if 1.7884448886013806e+215 < (- (* x y) (* z y))

    1. Initial program 32.7

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -4.459424609020142156947398974899037795759 \cdot 10^{249}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -1.008422558588387463522628361222361000871 \cdot 10^{-262}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 4.940656458412465441765687928682213723651 \cdot 10^{-324}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.788444888601380616753990222655785959076 \cdot 10^{215}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019212 +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.2318795828867769e-80) (* (* y t) (- x z)) (if (< t 2.5430670515648771e83) (* y (* t (- x z))) (* (* y (- x z)) t)))

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