Average Error: 6.9 → 0.3
Time: 4.5s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -1.2464801089300593 \cdot 10^{269}:\\ \;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -2.13568086354090478 \cdot 10^{-295}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.9498152 \cdot 10^{-318}:\\ \;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 5.41316001391597297 \cdot 10^{273}:\\ \;\;\;\;\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 -1.2464801089300593 \cdot 10^{269}:\\
\;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\

\mathbf{elif}\;x \cdot y - z \cdot y \le -2.13568086354090478 \cdot 10^{-295}:\\
\;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\

\mathbf{elif}\;x \cdot y - z \cdot y \le 1.9498152 \cdot 10^{-318}:\\
\;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\

\mathbf{elif}\;x \cdot y - z \cdot y \le 5.41316001391597297 \cdot 10^{273}:\\
\;\;\;\;\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 r492345 = x;
        double r492346 = y;
        double r492347 = r492345 * r492346;
        double r492348 = z;
        double r492349 = r492348 * r492346;
        double r492350 = r492347 - r492349;
        double r492351 = t;
        double r492352 = r492350 * r492351;
        return r492352;
}

double f(double x, double y, double z, double t) {
        double r492353 = x;
        double r492354 = y;
        double r492355 = r492353 * r492354;
        double r492356 = z;
        double r492357 = r492356 * r492354;
        double r492358 = r492355 - r492357;
        double r492359 = -1.2464801089300593e+269;
        bool r492360 = r492358 <= r492359;
        double r492361 = t;
        double r492362 = r492361 * r492354;
        double r492363 = r492353 - r492356;
        double r492364 = r492362 * r492363;
        double r492365 = 1.0;
        double r492366 = pow(r492364, r492365);
        double r492367 = -2.1356808635409048e-295;
        bool r492368 = r492358 <= r492367;
        double r492369 = r492358 * r492361;
        double r492370 = 1.9498152493431e-318;
        bool r492371 = r492358 <= r492370;
        double r492372 = 5.413160013915973e+273;
        bool r492373 = r492358 <= r492372;
        double r492374 = r492363 * r492361;
        double r492375 = r492354 * r492374;
        double r492376 = r492373 ? r492369 : r492375;
        double r492377 = r492371 ? r492366 : r492376;
        double r492378 = r492368 ? r492369 : r492377;
        double r492379 = r492360 ? r492366 : r492378;
        return r492379;
}

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.9
Target3.1
Herbie0.3
\[\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)) < -1.2464801089300593e+269 or -2.1356808635409048e-295 < (- (* x y) (* z y)) < 1.9498152493431e-318

    1. Initial program 31.3

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

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

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

      \[\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 -1.2464801089300593e+269 < (- (* x y) (* z y)) < -2.1356808635409048e-295 or 1.9498152493431e-318 < (- (* x y) (* z y)) < 5.413160013915973e+273

    1. Initial program 0.3

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

    if 5.413160013915973e+273 < (- (* x y) (* z y))

    1. Initial program 48.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -1.2464801089300593 \cdot 10^{269}:\\ \;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -2.13568086354090478 \cdot 10^{-295}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.9498152 \cdot 10^{-318}:\\ \;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 5.41316001391597297 \cdot 10^{273}:\\ \;\;\;\;\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 2020036 +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))