Average Error: 7.3 → 3.1
Time: 3.3s
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 r618962 = x;
        double r618963 = y;
        double r618964 = r618962 * r618963;
        double r618965 = z;
        double r618966 = r618965 * r618963;
        double r618967 = r618964 - r618966;
        double r618968 = t;
        double r618969 = r618967 * r618968;
        return r618969;
}

double f(double x, double y, double z, double t) {
        double r618970 = y;
        double r618971 = -2.6503448830413084e-37;
        bool r618972 = r618970 <= r618971;
        double r618973 = 9.863081147940308e-76;
        bool r618974 = r618970 <= r618973;
        double r618975 = !r618974;
        bool r618976 = r618972 || r618975;
        double r618977 = t;
        double r618978 = r618977 * r618970;
        double r618979 = x;
        double r618980 = z;
        double r618981 = r618979 - r618980;
        double r618982 = r618978 * r618981;
        double r618983 = r618979 * r618970;
        double r618984 = r618977 * r618983;
        double r618985 = -r618980;
        double r618986 = r618985 * r618970;
        double r618987 = r618977 * r618986;
        double r618988 = r618984 + r618987;
        double r618989 = r618976 ? r618982 : r618988;
        return r618989;
}

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