Average Error: 6.8 → 0.9
Time: 5.9s
Precision: binary64
\[[y, t]=\mathsf{sort}([y, t])\]
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - y \cdot z \leq -6.902129959376691 \cdot 10^{+145}:\\ \;\;\;\;y \cdot \left(x \cdot t - z \cdot t\right)\\ \mathbf{elif}\;x \cdot y - y \cdot z \leq -4.7999445602809516 \cdot 10^{-234}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \mathbf{elif}\;x \cdot y - y \cdot z \leq 6.228974896488953 \cdot 10^{-270}:\\ \;\;\;\;y \cdot \left(x \cdot t - z \cdot t\right)\\ \mathbf{elif}\;x \cdot y - y \cdot z \leq 1.941003136626665 \cdot 10^{+168}:\\ \;\;\;\;\left(x \cdot y - y \cdot z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;x \cdot y - y \cdot z \leq -6.902129959376691 \cdot 10^{+145}:\\
\;\;\;\;y \cdot \left(x \cdot t - z \cdot t\right)\\

\mathbf{elif}\;x \cdot y - y \cdot z \leq -4.7999445602809516 \cdot 10^{-234}:\\
\;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\

\mathbf{elif}\;x \cdot y - y \cdot z \leq 6.228974896488953 \cdot 10^{-270}:\\
\;\;\;\;y \cdot \left(x \cdot t - z \cdot t\right)\\

\mathbf{elif}\;x \cdot y - y \cdot z \leq 1.941003136626665 \cdot 10^{+168}:\\
\;\;\;\;\left(x \cdot y - y \cdot z\right) \cdot t\\

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

\end{array}
(FPCore (x y z t) :precision binary64 (* (- (* x y) (* z y)) t))
(FPCore (x y z t)
 :precision binary64
 (if (<= (- (* x y) (* y z)) -6.902129959376691e+145)
   (* y (- (* x t) (* z t)))
   (if (<= (- (* x y) (* y z)) -4.7999445602809516e-234)
     (* t (* y (- x z)))
     (if (<= (- (* x y) (* y z)) 6.228974896488953e-270)
       (* y (- (* x t) (* z t)))
       (if (<= (- (* x y) (* y z)) 1.941003136626665e+168)
         (* (- (* x y) (* y z)) t)
         (* (- x z) (* y t)))))))
double code(double x, double y, double z, double t) {
	return ((x * y) - (z * y)) * t;
}
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * y) - (y * z)) <= -6.902129959376691e+145) {
		tmp = y * ((x * t) - (z * t));
	} else if (((x * y) - (y * z)) <= -4.7999445602809516e-234) {
		tmp = t * (y * (x - z));
	} else if (((x * y) - (y * z)) <= 6.228974896488953e-270) {
		tmp = y * ((x * t) - (z * t));
	} else if (((x * y) - (y * z)) <= 1.941003136626665e+168) {
		tmp = ((x * y) - (y * z)) * t;
	} else {
		tmp = (x - z) * (y * t);
	}
	return tmp;
}

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.5
Herbie0.9
\[\begin{array}{l} \mathbf{if}\;t < -9.231879582886777 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t < 2.543067051564877 \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 4 regimes
  2. if (-.f64 (*.f64 x y) (*.f64 z y)) < -6.90212995937669148e145 or -4.79994456028095162e-234 < (-.f64 (*.f64 x y) (*.f64 z y)) < 6.22897489648895273e-270

    1. Initial program 15.4

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

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

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

      \[\leadsto 1 \cdot \color{blue}{\left(t \cdot \left(y \cdot \left(x - z\right)\right)\right)}\]
    6. Using strategy rm
    7. Applied sub-neg_binary6415.4

      \[\leadsto 1 \cdot \left(t \cdot \left(y \cdot \color{blue}{\left(x + \left(-z\right)\right)}\right)\right)\]
    8. Applied distribute-rgt-in_binary6415.4

      \[\leadsto 1 \cdot \left(t \cdot \color{blue}{\left(x \cdot y + \left(-z\right) \cdot y\right)}\right)\]
    9. Applied distribute-rgt-in_binary6415.4

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

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

      \[\leadsto 1 \cdot \left(t \cdot \left(x \cdot y\right) + \color{blue}{\left(-t \cdot \left(y \cdot z\right)\right)}\right)\]
    12. Taylor expanded around -inf 1.9

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

    if -6.90212995937669148e145 < (-.f64 (*.f64 x y) (*.f64 z y)) < -4.79994456028095162e-234

    1. Initial program 0.2

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Taylor expanded around inf 0.2

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

    if 6.22897489648895273e-270 < (-.f64 (*.f64 x y) (*.f64 z y)) < 1.94100313662666503e168

    1. Initial program 0.2

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

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

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

      \[\leadsto 1 \cdot \color{blue}{\left(t \cdot \left(y \cdot \left(x - z\right)\right)\right)}\]
    6. Using strategy rm
    7. Applied sub-neg_binary640.2

      \[\leadsto 1 \cdot \left(t \cdot \left(y \cdot \color{blue}{\left(x + \left(-z\right)\right)}\right)\right)\]
    8. Applied distribute-rgt-in_binary640.2

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

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

    if 1.94100313662666503e168 < (-.f64 (*.f64 x y) (*.f64 z y))

    1. Initial program 24.3

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - y \cdot z \leq -6.902129959376691 \cdot 10^{+145}:\\ \;\;\;\;y \cdot \left(x \cdot t - z \cdot t\right)\\ \mathbf{elif}\;x \cdot y - y \cdot z \leq -4.7999445602809516 \cdot 10^{-234}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \mathbf{elif}\;x \cdot y - y \cdot z \leq 6.228974896488953 \cdot 10^{-270}:\\ \;\;\;\;y \cdot \left(x \cdot t - z \cdot t\right)\\ \mathbf{elif}\;x \cdot y - y \cdot z \leq 1.941003136626665 \cdot 10^{+168}:\\ \;\;\;\;\left(x \cdot y - y \cdot z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \end{array}\]

Alternatives

Reproduce

herbie shell --seed 2021118 
(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))