Average Error: 7.3 → 3.1
Time: 3.4s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.650344883041308410572910824772997614991 \cdot 10^{-37} \lor \neg \left(y \le 9.863081147940308437771723311194267196393 \cdot 10^{-76}\right):\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot y\right) + t \cdot \left(\left(-z\right) \cdot y\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;y \le -2.650344883041308410572910824772997614991 \cdot 10^{-37} \lor \neg \left(y \le 9.863081147940308437771723311194267196393 \cdot 10^{-76}\right):\\
\;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r589407 = x;
        double r589408 = y;
        double r589409 = r589407 * r589408;
        double r589410 = z;
        double r589411 = r589410 * r589408;
        double r589412 = r589409 - r589411;
        double r589413 = t;
        double r589414 = r589412 * r589413;
        return r589414;
}

double f(double x, double y, double z, double t) {
        double r589415 = y;
        double r589416 = -2.6503448830413084e-37;
        bool r589417 = r589415 <= r589416;
        double r589418 = 9.863081147940308e-76;
        bool r589419 = r589415 <= r589418;
        double r589420 = !r589419;
        bool r589421 = r589417 || r589420;
        double r589422 = t;
        double r589423 = r589422 * r589415;
        double r589424 = x;
        double r589425 = z;
        double r589426 = r589424 - r589425;
        double r589427 = r589423 * r589426;
        double r589428 = r589424 * r589415;
        double r589429 = r589422 * r589428;
        double r589430 = -r589425;
        double r589431 = r589430 * r589415;
        double r589432 = r589422 * r589431;
        double r589433 = r589429 + r589432;
        double r589434 = r589421 ? r589427 : r589433;
        return r589434;
}

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
Herbie3.1
\[\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 y < -2.6503448830413084e-37 or 9.863081147940308e-76 < y

    1. Initial program 12.3

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified12.3

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

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

    if -2.6503448830413084e-37 < y < 9.863081147940308e-76

    1. Initial program 2.6

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified2.6

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \left(x - z\right)\right)}\]
    3. Using strategy rm
    4. Applied sub-neg2.6

      \[\leadsto t \cdot \left(y \cdot \color{blue}{\left(x + \left(-z\right)\right)}\right)\]
    5. Applied distribute-lft-in2.6

      \[\leadsto t \cdot \color{blue}{\left(y \cdot x + y \cdot \left(-z\right)\right)}\]
    6. Applied distribute-lft-in2.6

      \[\leadsto \color{blue}{t \cdot \left(y \cdot x\right) + t \cdot \left(y \cdot \left(-z\right)\right)}\]
    7. Simplified2.6

      \[\leadsto \color{blue}{t \cdot \left(x \cdot y\right)} + t \cdot \left(y \cdot \left(-z\right)\right)\]
    8. Simplified2.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.650344883041308410572910824772997614991 \cdot 10^{-37} \lor \neg \left(y \le 9.863081147940308437771723311194267196393 \cdot 10^{-76}\right):\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot y\right) + t \cdot \left(\left(-z\right) \cdot y\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020001 
(FPCore (x y z t)
  :name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"
  :precision binary64

  :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))