Average Error: 7.3 → 1.4
Time: 4.0s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y = -\infty \lor \neg \left(x \cdot y - z \cdot y \le 9.43843652885612725 \cdot 10^{196}\right):\\ \;\;\;\;1 \cdot \left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot y = -\infty \lor \neg \left(x \cdot y - z \cdot y \le 9.43843652885612725 \cdot 10^{196}\right):\\
\;\;\;\;1 \cdot \left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r531741 = x;
        double r531742 = y;
        double r531743 = r531741 * r531742;
        double r531744 = z;
        double r531745 = r531744 * r531742;
        double r531746 = r531743 - r531745;
        double r531747 = t;
        double r531748 = r531746 * r531747;
        return r531748;
}

double f(double x, double y, double z, double t) {
        double r531749 = x;
        double r531750 = y;
        double r531751 = r531749 * r531750;
        double r531752 = z;
        double r531753 = r531752 * r531750;
        double r531754 = r531751 - r531753;
        double r531755 = -inf.0;
        bool r531756 = r531754 <= r531755;
        double r531757 = 9.438436528856127e+196;
        bool r531758 = r531754 <= r531757;
        double r531759 = !r531758;
        bool r531760 = r531756 || r531759;
        double r531761 = 1.0;
        double r531762 = t;
        double r531763 = r531762 * r531750;
        double r531764 = r531749 - r531752;
        double r531765 = r531763 * r531764;
        double r531766 = r531761 * r531765;
        double r531767 = r531754 * r531762;
        double r531768 = r531760 ? r531766 : r531767;
        return r531768;
}

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.3
Herbie1.4
\[\begin{array}{l} \mathbf{if}\;t \lt -9.2318795828867769 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t \lt 2.5430670515648771 \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 (- (* x y) (* z y)) < -inf.0 or 9.438436528856127e+196 < (- (* x y) (* z y))

    1. Initial program 39.0

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Using strategy rm
    3. Applied *-un-lft-identity39.0

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

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

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

    if -inf.0 < (- (* x y) (* z y)) < 9.438436528856127e+196

    1. Initial program 1.5

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y = -\infty \lor \neg \left(x \cdot y - z \cdot y \le 9.43843652885612725 \cdot 10^{196}\right):\\ \;\;\;\;1 \cdot \left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \end{array}\]

Reproduce

herbie shell --seed 2020089 +o rules:numerics
(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))