Average Error: 2.0 → 1.3
Time: 8.1s
Precision: binary64
Cost: 1537
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
\[\begin{array}{l} \mathbf{if}\;x + \left(y - x\right) \cdot \frac{z}{t} \leq 4.4511333104284477 \cdot 10^{+307}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\left(y - x\right) \cdot z\right) \cdot \frac{1}{t}\\ \end{array}\]
x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
\mathbf{if}\;x + \left(y - x\right) \cdot \frac{z}{t} \leq 4.4511333104284477 \cdot 10^{+307}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\

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

\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
(FPCore (x y z t)
 :precision binary64
 (if (<= (+ x (* (- y x) (/ z t))) 4.4511333104284477e+307)
   (+ x (* (- y x) (/ z t)))
   (+ x (* (* (- y x) z) (/ 1.0 t)))))
double code(double x, double y, double z, double t) {
	return x + ((y - x) * (z / t));
}
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x + ((y - x) * (z / t))) <= 4.4511333104284477e+307) {
		tmp = x + ((y - x) * (z / t));
	} else {
		tmp = x + (((y - x) * z) * (1.0 / 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

Original2.0
Target2.1
Herbie1.3
\[\begin{array}{l} \mathbf{if}\;\left(y - x\right) \cdot \frac{z}{t} < -1013646692435.8867:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{elif}\;\left(y - x\right) \cdot \frac{z}{t} < 0:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Alternatives

Alternative 1
Error0.9
Cost39488
\[x + \left(\left(y - x\right) \cdot \frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{t} \cdot \sqrt[3]{t}}\right) \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{t}}\]
Alternative 2
Error1.3
Cost1409
\[\begin{array}{l} \mathbf{if}\;x + \left(y - x\right) \cdot \frac{z}{t} \leq 4.4511333104284477 \cdot 10^{+307}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \end{array}\]
Alternative 3
Error2.0
Cost576
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
Alternative 4
Error3.1
Cost1032
\[\begin{array}{l} \mathbf{if}\;\frac{z}{t} \leq -12461456824397808 \lor \neg \left(\frac{z}{t} \leq 2.4877559077139454 \cdot 10^{-06}\right):\\ \;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \end{array}\]
Alternative 5
Error12.6
Cost1032
\[\begin{array}{l} \mathbf{if}\;\frac{z}{t} \leq -6.259877436126282 \cdot 10^{-40} \lor \neg \left(\frac{z}{t} \leq 1.5179613331006957 \cdot 10^{-37}\right):\\ \;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot \frac{z}{t}\\ \end{array}\]
Alternative 6
Error12.5
Cost1032
\[\begin{array}{l} \mathbf{if}\;\frac{z}{t} \leq -3.102881876237006 \cdot 10^{-40} \lor \neg \left(\frac{z}{t} \leq 6.108925997071627 \cdot 10^{-34}\right):\\ \;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 7
Error21.9
Cost904
\[\begin{array}{l} \mathbf{if}\;\frac{z}{t} \leq -2.714597133531598 \cdot 10^{-40} \lor \neg \left(\frac{z}{t} \leq 1.321026748004904 \cdot 10^{-35}\right):\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 8
Error31.5
Cost64
\[x\]
Alternative 9
Error61.8
Cost64
\[-1\]
Alternative 10
Error61.8
Cost64
\[1\]

Error

Derivation

  1. Split input into 2 regimes
  2. if (+.f64 x (*.f64 (-.f64 y x) (/.f64 z t))) < 4.4511333104284477e307

    1. Initial program 1.3

      \[x + \left(y - x\right) \cdot \frac{z}{t}\]
    2. Simplified1.3

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

    if 4.4511333104284477e307 < (+.f64 x (*.f64 (-.f64 y x) (/.f64 z t)))

    1. Initial program 60.3

      \[x + \left(y - x\right) \cdot \frac{z}{t}\]
    2. Using strategy rm
    3. Applied div-inv_binary64_1644360.3

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \left(y - x\right) \cdot \frac{z}{t} \leq 4.4511333104284477 \cdot 10^{+307}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\left(y - x\right) \cdot z\right) \cdot \frac{1}{t}\\ \end{array}\]

Reproduce

herbie shell --seed 2021044 
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
  :precision binary64

  :herbie-target
  (if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) 0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))

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