Average Error: 7.0 → 2.9
Time: 13.3s
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(\left(x - z\right) \cdot y\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(\left(x - z\right) \cdot y\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(\left(x - z\right) \cdot y\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(\left(x - z\right) \cdot y\right) \cdot t\\

\end{array}
double f(double x, double y, double z, double t) {
        double r33894325 = x;
        double r33894326 = y;
        double r33894327 = r33894325 * r33894326;
        double r33894328 = z;
        double r33894329 = r33894328 * r33894326;
        double r33894330 = r33894327 - r33894329;
        double r33894331 = t;
        double r33894332 = r33894330 * r33894331;
        return r33894332;
}

double f(double x, double y, double z, double t) {
        double r33894333 = t;
        double r33894334 = -2.1649590822028293e+46;
        bool r33894335 = r33894333 <= r33894334;
        double r33894336 = x;
        double r33894337 = z;
        double r33894338 = r33894336 - r33894337;
        double r33894339 = y;
        double r33894340 = r33894338 * r33894339;
        double r33894341 = r33894340 * r33894333;
        double r33894342 = 3.5113022948880706e-116;
        bool r33894343 = r33894333 <= r33894342;
        double r33894344 = r33894338 * r33894333;
        double r33894345 = r33894339 * r33894344;
        double r33894346 = r33894343 ? r33894345 : r33894341;
        double r33894347 = r33894335 ? r33894341 : r33894346;
        return r33894347;
}

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 *-commutative3.5

      \[\leadsto \color{blue}{\left(\left(x - z\right) \cdot y\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(\left(x - z\right) \cdot y\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(\left(x - z\right) \cdot y\right) \cdot t\\ \end{array}\]

Reproduce

herbie shell --seed 2019174 
(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))