Average Error: 7.3 → 0.5
Time: 36.6s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y = -\infty:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -3.305196693480939713514581034193979623053 \cdot 10^{-153}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.717842953697809163237341802420612798171 \cdot 10^{-196}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 9.555835303684123458062564353397121419313 \cdot 10^{230}:\\ \;\;\;\;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 = -\infty:\\
\;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\

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

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

\mathbf{elif}\;x \cdot y - z \cdot y \le 9.555835303684123458062564353397121419313 \cdot 10^{230}:\\
\;\;\;\;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 r20552698 = x;
        double r20552699 = y;
        double r20552700 = r20552698 * r20552699;
        double r20552701 = z;
        double r20552702 = r20552701 * r20552699;
        double r20552703 = r20552700 - r20552702;
        double r20552704 = t;
        double r20552705 = r20552703 * r20552704;
        return r20552705;
}

double f(double x, double y, double z, double t) {
        double r20552706 = x;
        double r20552707 = y;
        double r20552708 = r20552706 * r20552707;
        double r20552709 = z;
        double r20552710 = r20552709 * r20552707;
        double r20552711 = r20552708 - r20552710;
        double r20552712 = -inf.0;
        bool r20552713 = r20552711 <= r20552712;
        double r20552714 = r20552706 - r20552709;
        double r20552715 = t;
        double r20552716 = r20552707 * r20552715;
        double r20552717 = r20552714 * r20552716;
        double r20552718 = -3.3051966934809397e-153;
        bool r20552719 = r20552711 <= r20552718;
        double r20552720 = r20552715 * r20552711;
        double r20552721 = 1.7178429536978092e-196;
        bool r20552722 = r20552711 <= r20552721;
        double r20552723 = 9.555835303684123e+230;
        bool r20552724 = r20552711 <= r20552723;
        double r20552725 = r20552715 * r20552714;
        double r20552726 = r20552725 * r20552707;
        double r20552727 = r20552724 ? r20552720 : r20552726;
        double r20552728 = r20552722 ? r20552717 : r20552727;
        double r20552729 = r20552719 ? r20552720 : r20552728;
        double r20552730 = r20552713 ? r20552717 : r20552729;
        return r20552730;
}

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

Original7.3
Target3.1
Herbie0.5
\[\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)) < -inf.0 or -3.3051966934809397e-153 < (- (* x y) (* z y)) < 1.7178429536978092e-196

    1. Initial program 19.4

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified1.1

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

    if -inf.0 < (- (* x y) (* z y)) < -3.3051966934809397e-153 or 1.7178429536978092e-196 < (- (* x y) (* z y)) < 9.555835303684123e+230

    1. Initial program 0.3

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

    if 9.555835303684123e+230 < (- (* x y) (* z y))

    1. Initial program 36.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y = -\infty:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -3.305196693480939713514581034193979623053 \cdot 10^{-153}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.717842953697809163237341802420612798171 \cdot 10^{-196}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 9.555835303684123458062564353397121419313 \cdot 10^{230}:\\ \;\;\;\;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 2019168 +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))