Average Error: 6.8 → 1.4
Time: 3.0s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -4.63836268060687826 \cdot 10^{307}:\\ \;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.95547411306134 \cdot 10^{248}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\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}\;x \cdot y - z \cdot y \le -4.63836268060687826 \cdot 10^{307}:\\
\;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\

\mathbf{elif}\;x \cdot y - z \cdot y \le 1.95547411306134 \cdot 10^{248}:\\
\;\;\;\;\left(x \cdot y - z \cdot y\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 r498952 = x;
        double r498953 = y;
        double r498954 = r498952 * r498953;
        double r498955 = z;
        double r498956 = r498955 * r498953;
        double r498957 = r498954 - r498956;
        double r498958 = t;
        double r498959 = r498957 * r498958;
        return r498959;
}

double f(double x, double y, double z, double t) {
        double r498960 = x;
        double r498961 = y;
        double r498962 = r498960 * r498961;
        double r498963 = z;
        double r498964 = r498963 * r498961;
        double r498965 = r498962 - r498964;
        double r498966 = -4.638362680606878e+307;
        bool r498967 = r498965 <= r498966;
        double r498968 = t;
        double r498969 = r498968 * r498961;
        double r498970 = r498960 - r498963;
        double r498971 = r498969 * r498970;
        double r498972 = 1.0;
        double r498973 = pow(r498971, r498972);
        double r498974 = 1.955474113061338e+248;
        bool r498975 = r498965 <= r498974;
        double r498976 = r498965 * r498968;
        double r498977 = r498970 * r498968;
        double r498978 = r498961 * r498977;
        double r498979 = r498975 ? r498976 : r498978;
        double r498980 = r498967 ? r498973 : r498979;
        return r498980;
}

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

Original6.8
Target3.1
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 3 regimes
  2. if (- (* x y) (* z y)) < -4.638362680606878e+307

    1. Initial program 63.4

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

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

      \[\leadsto \color{blue}{{\left(x \cdot y - z \cdot y\right)}^{1}} \cdot {t}^{1}\]
    5. Applied pow-prod-down63.4

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

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

    if -4.638362680606878e+307 < (- (* x y) (* z y)) < 1.955474113061338e+248

    1. Initial program 1.6

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]

    if 1.955474113061338e+248 < (- (* x y) (* z y))

    1. Initial program 39.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -4.63836268060687826 \cdot 10^{307}:\\ \;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.95547411306134 \cdot 10^{248}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \end{array}\]

Reproduce

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