Average Error: 6.9 → 0.4
Time: 14.4s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -8.195669489681609678798574875257253827771 \cdot 10^{239}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -3.838984261423296633673495406852766881499 \cdot 10^{-245}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.584401045790907446074774340867010475211 \cdot 10^{-151}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 8.47804001699789240780003797872227611413 \cdot 10^{211}:\\ \;\;\;\;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 -8.195669489681609678798574875257253827771 \cdot 10^{239}:\\
\;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\

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

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

\mathbf{elif}\;x \cdot y - z \cdot y \le 8.47804001699789240780003797872227611413 \cdot 10^{211}:\\
\;\;\;\;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 r472903 = x;
        double r472904 = y;
        double r472905 = r472903 * r472904;
        double r472906 = z;
        double r472907 = r472906 * r472904;
        double r472908 = r472905 - r472907;
        double r472909 = t;
        double r472910 = r472908 * r472909;
        return r472910;
}

double f(double x, double y, double z, double t) {
        double r472911 = x;
        double r472912 = y;
        double r472913 = r472911 * r472912;
        double r472914 = z;
        double r472915 = r472914 * r472912;
        double r472916 = r472913 - r472915;
        double r472917 = -8.19566948968161e+239;
        bool r472918 = r472916 <= r472917;
        double r472919 = r472911 - r472914;
        double r472920 = t;
        double r472921 = r472912 * r472920;
        double r472922 = r472919 * r472921;
        double r472923 = -3.838984261423297e-245;
        bool r472924 = r472916 <= r472923;
        double r472925 = r472920 * r472916;
        double r472926 = 1.5844010457909074e-151;
        bool r472927 = r472916 <= r472926;
        double r472928 = 8.478040016997892e+211;
        bool r472929 = r472916 <= r472928;
        double r472930 = r472920 * r472919;
        double r472931 = r472930 * r472912;
        double r472932 = r472929 ? r472925 : r472931;
        double r472933 = r472927 ? r472922 : r472932;
        double r472934 = r472924 ? r472925 : r472933;
        double r472935 = r472918 ? r472922 : r472934;
        return r472935;
}

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.9
Target3.2
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)) < -8.19566948968161e+239 or -3.838984261423297e-245 < (- (* x y) (* z y)) < 1.5844010457909074e-151

    1. Initial program 17.9

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

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

    if -8.19566948968161e+239 < (- (* x y) (* z y)) < -3.838984261423297e-245 or 1.5844010457909074e-151 < (- (* x y) (* z y)) < 8.478040016997892e+211

    1. Initial program 0.2

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

    if 8.478040016997892e+211 < (- (* x y) (* z y))

    1. Initial program 29.4

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

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

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

      \[\leadsto y \cdot \color{blue}{\left(t \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 -8.195669489681609678798574875257253827771 \cdot 10^{239}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -3.838984261423296633673495406852766881499 \cdot 10^{-245}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.584401045790907446074774340867010475211 \cdot 10^{-151}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 8.47804001699789240780003797872227611413 \cdot 10^{211}:\\ \;\;\;\;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 2019194 +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))