Average Error: 7.0 → 2.9
Time: 13.4s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;t \le -2.164959082202829261262267562936587814033 \cdot 10^{46}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \mathbf{elif}\;t \le 3.511302294888070566297225262481384388676 \cdot 10^{-116}:\\ \;\;\;\;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 -2.164959082202829261262267562936587814033 \cdot 10^{46}:\\
\;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\

\mathbf{elif}\;t \le 3.511302294888070566297225262481384388676 \cdot 10^{-116}:\\
\;\;\;\;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 r29483839 = x;
        double r29483840 = y;
        double r29483841 = r29483839 * r29483840;
        double r29483842 = z;
        double r29483843 = r29483842 * r29483840;
        double r29483844 = r29483841 - r29483843;
        double r29483845 = t;
        double r29483846 = r29483844 * r29483845;
        return r29483846;
}

double f(double x, double y, double z, double t) {
        double r29483847 = t;
        double r29483848 = -2.1649590822028293e+46;
        bool r29483849 = r29483847 <= r29483848;
        double r29483850 = y;
        double r29483851 = x;
        double r29483852 = z;
        double r29483853 = r29483851 - r29483852;
        double r29483854 = r29483850 * r29483853;
        double r29483855 = r29483854 * r29483847;
        double r29483856 = 3.5113022948880706e-116;
        bool r29483857 = r29483847 <= r29483856;
        double r29483858 = r29483853 * r29483847;
        double r29483859 = r29483850 * r29483858;
        double r29483860 = r29483857 ? r29483859 : r29483855;
        double r29483861 = r29483849 ? r29483855 : r29483860;
        return r29483861;
}

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.0
Target3.2
Herbie2.9
\[\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 < -2.1649590822028293e+46 or 3.5113022948880706e-116 < t

    1. Initial program 3.5

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

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

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

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

    if -2.1649590822028293e+46 < t < 3.5113022948880706e-116

    1. Initial program 9.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -2.164959082202829261262267562936587814033 \cdot 10^{46}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \mathbf{elif}\;t \le 3.511302294888070566297225262481384388676 \cdot 10^{-116}:\\ \;\;\;\;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 2019174 +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))