Average Error: 6.4 → 2.7
Time: 8.2s
Precision: binary64
Cost: 1218
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -1.1179816606133411 \cdot 10^{+64}:\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{elif}\;z \leq 7.433079287520896 \cdot 10^{+172}:\\ \;\;\;\;x + \frac{z \cdot \left(y - x\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;z \leq -1.1179816606133411 \cdot 10^{+64}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\

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

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

\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
(FPCore (x y z t)
 :precision binary64
 (if (<= z -1.1179816606133411e+64)
   (+ x (* z (/ (- y x) t)))
   (if (<= z 7.433079287520896e+172)
     (+ x (/ (* z (- y x)) t))
     (+ x (* (- y x) (/ z 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 (z <= -1.1179816606133411e+64) {
		tmp = x + (z * ((y - x) / t));
	} else if (z <= 7.433079287520896e+172) {
		tmp = x + ((z * (y - x)) / t);
	} else {
		tmp = x + ((y - x) * (z / 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.4
Target1.8
Herbie2.7
\[\begin{array}{l} \mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \mathbf{elif}\;x < 4.275032163700715 \cdot 10^{-250}:\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Alternatives

Alternative 1
Error1.0
Cost59200
\[x + \frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}} \cdot \frac{\sqrt[3]{y - x}}{\frac{\sqrt[3]{t}}{\sqrt[3]{z}}}\]
Alternative 2
Error2.0
Cost1218
\[\begin{array}{l} \mathbf{if}\;x \leq -1.2721410838003617 \cdot 10^{-210}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{elif}\;x \leq 1.5448624974210764 \cdot 10^{-41}:\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \end{array}\]
Alternative 3
Error2.2
Cost904
\[\begin{array}{l} \mathbf{if}\;y \leq 1.7884550304038338 \cdot 10^{-272} \lor \neg \left(y \leq 3.436078276673044 \cdot 10^{-50}\right):\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \end{array}\]
Alternative 4
Error2.0
Cost904
\[\begin{array}{l} \mathbf{if}\;t \leq -3.8100894990775214 \cdot 10^{-245} \lor \neg \left(t \leq 3.9280415182811897 \cdot 10^{-218}\right):\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot \left(y - x\right)}{t}\\ \end{array}\]
Alternative 5
Error7.9
Cost1090
\[\begin{array}{l} \mathbf{if}\;y \leq -7.801735086200885 \cdot 10^{-46}:\\ \;\;\;\;x + y \cdot \frac{z}{t}\\ \mathbf{elif}\;y \leq 8.422277528823603 \cdot 10^{-175}:\\ \;\;\;\;x - x \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z}}\\ \end{array}\]
Alternative 6
Error8.0
Cost776
\[\begin{array}{l} \mathbf{if}\;y \leq -1.3030022012353711 \cdot 10^{-47} \lor \neg \left(y \leq 6.6451556900716525 \cdot 10^{-174}\right):\\ \;\;\;\;x + \frac{y}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot \frac{z}{t}\\ \end{array}\]
Alternative 7
Error17.3
Cost1090
\[\begin{array}{l} \mathbf{if}\;x \leq -1.774159551238286 \cdot 10^{-120}:\\ \;\;\;\;x - \frac{x}{\frac{t}{z}}\\ \mathbf{elif}\;x \leq 8.2997827565203 \cdot 10^{-114}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot \frac{z}{t}\\ \end{array}\]
Alternative 8
Error17.4
Cost776
\[\begin{array}{l} \mathbf{if}\;x \leq -2.6598175863133953 \cdot 10^{-120} \lor \neg \left(x \leq 9.146839396854014 \cdot 10^{-111}\right):\\ \;\;\;\;x - x \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \end{array}\]
Alternative 9
Error25.7
Cost1101
\[\begin{array}{l} \mathbf{if}\;x \leq -1.2926537485615926 \cdot 10^{-104}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.108090910559699 \cdot 10^{-100} \lor \neg \left(x \leq 2.7724922578735122 \cdot 10^{-68}\right) \land x \leq 2.9387611468666887 \cdot 10^{-30}:\\ \;\;\;\;y \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 10
Error25.7
Cost1101
\[\begin{array}{l} \mathbf{if}\;x \leq -3.807593210986246 \cdot 10^{-95}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 5.109114698568901 \cdot 10^{-106} \lor \neg \left(x \leq 2.99765774095701 \cdot 10^{-68}\right) \land x \leq 2.9387611468666887 \cdot 10^{-30}:\\ \;\;\;\;\frac{y}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 11
Error31.3
Cost64
\[x\]
Alternative 12
Error61.8
Cost64
\[-1\]
Alternative 13
Error61.8
Cost64
\[1\]

Error

Derivation

  1. Split input into 3 regimes
  2. if z < -1.11798166061334114e64

    1. Initial program 19.7

      \[x + \frac{\left(y - x\right) \cdot z}{t}\]
    2. Using strategy rm
    3. Applied associate-/l*_binary64_140044.1

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    4. Using strategy rm
    5. Applied associate-/r/_binary64_140051.8

      \[\leadsto x + \color{blue}{\frac{y - x}{t} \cdot z}\]
    6. Simplified1.8

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

    if -1.11798166061334114e64 < z < 7.43307928752089636e172

    1. Initial program 2.6

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

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

    if 7.43307928752089636e172 < z

    1. Initial program 25.0

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.1179816606133411 \cdot 10^{+64}:\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{elif}\;z \leq 7.433079287520896 \cdot 10^{+172}:\\ \;\;\;\;x + \frac{z \cdot \left(y - x\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \end{array}\]

Reproduce

herbie shell --seed 2021044 
(FPCore (x y z t)
  :name "Numeric.Histogram:binBounds from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))

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