Average Error: 7.2 → 2.8
Time: 3.7s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;t \le -5.11190814655835692 \cdot 10^{-81} \lor \neg \left(t \le 1.97666788664023624 \cdot 10^{-21}\right):\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;t \le -5.11190814655835692 \cdot 10^{-81} \lor \neg \left(t \le 1.97666788664023624 \cdot 10^{-21}\right):\\
\;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r468672 = x;
        double r468673 = y;
        double r468674 = r468672 * r468673;
        double r468675 = z;
        double r468676 = r468675 * r468673;
        double r468677 = r468674 - r468676;
        double r468678 = t;
        double r468679 = r468677 * r468678;
        return r468679;
}

double f(double x, double y, double z, double t) {
        double r468680 = t;
        double r468681 = -5.111908146558357e-81;
        bool r468682 = r468680 <= r468681;
        double r468683 = 1.9766678866402362e-21;
        bool r468684 = r468680 <= r468683;
        double r468685 = !r468684;
        bool r468686 = r468682 || r468685;
        double r468687 = y;
        double r468688 = x;
        double r468689 = z;
        double r468690 = r468688 - r468689;
        double r468691 = r468687 * r468690;
        double r468692 = r468691 * r468680;
        double r468693 = r468690 * r468680;
        double r468694 = r468687 * r468693;
        double r468695 = r468686 ? r468692 : r468694;
        return r468695;
}

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.2
Target3.1
Herbie2.8
\[\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 t < -5.111908146558357e-81 or 1.9766678866402362e-21 < t

    1. Initial program 3.4

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

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

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

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

    if -5.111908146558357e-81 < t < 1.9766678866402362e-21

    1. Initial program 10.7

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Using strategy rm
    3. Applied distribute-rgt-out--10.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -5.11190814655835692 \cdot 10^{-81} \lor \neg \left(t \le 1.97666788664023624 \cdot 10^{-21}\right):\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020035 +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))