Average Error: 7.1 → 2.8
Time: 3.1s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.68361982243040008 \cdot 10^{31} \lor \neg \left(t \le 4.2319166616304514 \cdot 10^{-10}\right):\\ \;\;\;\;1 \cdot \left(\left(x - z\right) \cdot \left(t \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\left(\left(x - z\right) \cdot t\right) \cdot y\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;t \le -1.68361982243040008 \cdot 10^{31} \lor \neg \left(t \le 4.2319166616304514 \cdot 10^{-10}\right):\\
\;\;\;\;1 \cdot \left(\left(x - z\right) \cdot \left(t \cdot y\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r606148 = x;
        double r606149 = y;
        double r606150 = r606148 * r606149;
        double r606151 = z;
        double r606152 = r606151 * r606149;
        double r606153 = r606150 - r606152;
        double r606154 = t;
        double r606155 = r606153 * r606154;
        return r606155;
}

double f(double x, double y, double z, double t) {
        double r606156 = t;
        double r606157 = -1.6836198224304e+31;
        bool r606158 = r606156 <= r606157;
        double r606159 = 4.2319166616304514e-10;
        bool r606160 = r606156 <= r606159;
        double r606161 = !r606160;
        bool r606162 = r606158 || r606161;
        double r606163 = 1.0;
        double r606164 = x;
        double r606165 = z;
        double r606166 = r606164 - r606165;
        double r606167 = y;
        double r606168 = r606156 * r606167;
        double r606169 = r606166 * r606168;
        double r606170 = r606163 * r606169;
        double r606171 = r606166 * r606156;
        double r606172 = r606171 * r606167;
        double r606173 = r606163 * r606172;
        double r606174 = r606162 ? r606170 : r606173;
        return r606174;
}

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.1
Target3.3
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 < -1.6836198224304e+31 or 4.2319166616304514e-10 < t

    1. Initial program 3.4

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified3.4

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

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

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

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

    if -1.6836198224304e+31 < t < 4.2319166616304514e-10

    1. Initial program 9.3

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

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

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

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

      \[\leadsto 1 \cdot \color{blue}{\left(\left(x - z\right) \cdot \left(t \cdot y\right)\right)}\]
    7. Using strategy rm
    8. Applied associate-*r*2.3

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

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

Reproduce

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