Average Error: 6.7 → 2.2
Time: 3.5s
Precision: binary64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \leq -2.050259458564103 \cdot 10^{+106} \lor \neg \left(x + \frac{y \cdot \left(z - x\right)}{t} \leq 9.009182702278423 \cdot 10^{-57}\right):\\ \;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{1}{\frac{t}{z - x}}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \leq -2.050259458564103 \cdot 10^{+106} \lor \neg \left(x + \frac{y \cdot \left(z - x\right)}{t} \leq 9.009182702278423 \cdot 10^{-57}\right):\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{1}{\frac{t}{z - x}}\\

\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (+ x (/ (* y (- z x)) t)) -2.050259458564103e+106)
         (not (<= (+ x (/ (* y (- z x)) t)) 9.009182702278423e-57)))
   (+ x (* (- z x) (/ y t)))
   (+ x (* y (/ 1.0 (/ t (- z x)))))))
double code(double x, double y, double z, double t) {
	return ((double) (x + (((double) (y * ((double) (z - x)))) / t)));
}
double code(double x, double y, double z, double t) {
	double tmp;
	if (((((double) (x + (((double) (y * ((double) (z - x)))) / t))) <= -2.050259458564103e+106) || !(((double) (x + (((double) (y * ((double) (z - x)))) / t))) <= 9.009182702278423e-57))) {
		tmp = ((double) (x + ((double) (((double) (z - x)) * (y / t)))));
	} else {
		tmp = ((double) (x + ((double) (y * (1.0 / (t / ((double) (z - x))))))));
	}
	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.7
Target2.0
Herbie2.2
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 2 regimes
  2. if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -2.0502594585641032e106 or 9.0091827022784228e-57 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t))

    1. Initial program 9.7

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary649.7

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

      \[\leadsto x + \color{blue}{\frac{y}{1} \cdot \frac{z - x}{t}}\]
    5. Simplified8.8

      \[\leadsto x + \color{blue}{y} \cdot \frac{z - x}{t}\]
    6. Using strategy rm
    7. Applied div-sub_binary648.8

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{z}{t} - \frac{x}{t}\right)}\]
    8. Using strategy rm
    9. Applied div-inv_binary648.8

      \[\leadsto x + y \cdot \left(\frac{z}{t} - \color{blue}{x \cdot \frac{1}{t}}\right)\]
    10. Applied div-inv_binary648.8

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

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{1}{t} \cdot \left(z - x\right)\right)}\]
    12. Applied associate-*r*_binary642.2

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

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

    if -2.0502594585641032e106 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 9.0091827022784228e-57

    1. Initial program 1.6

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary641.6

      \[\leadsto x + \frac{y \cdot \left(z - x\right)}{\color{blue}{1 \cdot t}}\]
    4. Applied times-frac_binary642.0

      \[\leadsto x + \color{blue}{\frac{y}{1} \cdot \frac{z - x}{t}}\]
    5. Simplified2.0

      \[\leadsto x + \color{blue}{y} \cdot \frac{z - x}{t}\]
    6. Using strategy rm
    7. Applied clear-num_binary642.2

      \[\leadsto x + y \cdot \color{blue}{\frac{1}{\frac{t}{z - x}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \leq -2.050259458564103 \cdot 10^{+106} \lor \neg \left(x + \frac{y \cdot \left(z - x\right)}{t} \leq 9.009182702278423 \cdot 10^{-57}\right):\\ \;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{1}{\frac{t}{z - x}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020205 
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
  :precision binary64

  :herbie-target
  (- x (+ (* x (/ y t)) (* (- z) (/ y t))))

  (+ x (/ (* y (- z x)) t)))