Average Error: 6.4 → 1.9
Time: 10.9s
Precision: binary64
Cost: 20995
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -2.7213483651068796 \cdot 10^{-22}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{elif}\;x \leq -9.293346139724548 \cdot 10^{-230}:\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{elif}\;x \leq 4.308057124917876 \cdot 10^{-147}:\\ \;\;\;\;x + \frac{y - x}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z}{\sqrt[3]{t}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;x \leq -2.7213483651068796 \cdot 10^{-22}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\

\mathbf{elif}\;x \leq -9.293346139724548 \cdot 10^{-230}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\

\mathbf{elif}\;x \leq 4.308057124917876 \cdot 10^{-147}:\\
\;\;\;\;x + \frac{y - x}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z}{\sqrt[3]{t}}\\

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

\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
(FPCore (x y z t)
 :precision binary64
 (if (<= x -2.7213483651068796e-22)
   (+ x (/ (- y x) (/ t z)))
   (if (<= x -9.293346139724548e-230)
     (+ x (* z (/ (- y x) t)))
     (if (<= x 4.308057124917876e-147)
       (+ x (* (/ (- y x) (* (cbrt t) (cbrt t))) (/ z (cbrt t))))
       (+ x (/ (- y x) (/ t z)))))))
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 <= -2.7213483651068796e-22) {
		tmp = x + ((y - x) / (t / z));
	} else if (x <= -9.293346139724548e-230) {
		tmp = x + (z * ((y - x) / t));
	} else if (x <= 4.308057124917876e-147) {
		tmp = x + (((y - x) / (cbrt(t) * cbrt(t))) * (z / cbrt(t)));
	} else {
		tmp = x + ((y - x) / (t / z));
	}
	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
Target2.1
Herbie1.9
\[\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
Error6.9
Cost20800
\[x + \sqrt[3]{\frac{\left(y - x\right) \cdot z}{t}} \cdot \left(\sqrt[3]{\frac{\left(y - x\right) \cdot z}{t}} \cdot \sqrt[3]{\frac{\left(y - x\right) \cdot z}{t}}\right)\]
Alternative 2
Error6.9
Cost20544
\[x + \frac{\sqrt[3]{\left(y - x\right) \cdot z} \cdot \left(\sqrt[3]{\left(y - x\right) \cdot z} \cdot \sqrt[3]{\left(y - x\right) \cdot z}\right)}{t}\]
Alternative 3
Error6.9
Cost20288
\[x + \frac{\left(\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}\right) \cdot \left(z \cdot \sqrt[3]{y - x}\right)}{t}\]
Alternative 4
Error6.9
Cost20032
\[x + \frac{\sqrt[3]{z} \cdot \left(\left(y - x\right) \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)}{t}\]
Alternative 5
Error4.8
Cost20032
\[x + \frac{y - x}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z}{\sqrt[3]{t}}\]
Alternative 6
Error31.9
Cost13888
\[x + \sqrt{\frac{\left(y - x\right) \cdot z}{t}} \cdot \sqrt{\frac{\left(y - x\right) \cdot z}{t}}\]
Alternative 7
Error34.1
Cost13760
\[x + \sqrt{\frac{y - x}{t}} \cdot \left(z \cdot \sqrt{\frac{y - x}{t}}\right)\]
Alternative 8
Error33.4
Cost13504
\[x + \frac{y - x}{\sqrt{t}} \cdot \frac{z}{\sqrt{t}}\]
Alternative 9
Error27.5
Cost13440
\[x + \frac{\sqrt[3]{{\left(\left(y - x\right) \cdot z\right)}^{3}}}{t}\]
Alternative 10
Error26.2
Cost13440
\[x + \sqrt[3]{{\left(\frac{\left(y - x\right) \cdot z}{t}\right)}^{3}}\]
Alternative 11
Error30.9
Cost1088
\[x + \frac{z \cdot \left(y \cdot y - x \cdot x\right)}{t \cdot \left(x + y\right)}\]
Alternative 12
Error6.5
Cost704
\[x + \left(\left(y - x\right) \cdot z\right) \cdot \frac{1}{t}\]
Alternative 13
Error6.5
Cost704
\[x + \frac{1}{\frac{t}{\left(y - x\right) \cdot z}}\]
Alternative 14
Error6.4
Cost576
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
Alternative 15
Error2.2
Cost576
\[x + \frac{y - x}{\frac{t}{z}}\]
Alternative 16
Error2.2
Cost576
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
Alternative 17
Error14.3
Cost576
\[x + \left(y \cdot z\right) \cdot \frac{1}{t}\]
Alternative 18
Error6.5
Cost576
\[x + z \cdot \frac{y - x}{t}\]
Alternative 19
Error14.4
Cost448
\[x + z \cdot \frac{y}{t}\]
Alternative 20
Error36.4
Cost448
\[\frac{\left(y - x\right) \cdot z}{t}\]
Alternative 21
Error21.9
Cost448
\[x - x \cdot \frac{z}{t}\]
Alternative 22
Error14.2
Cost448
\[x + \frac{y \cdot z}{t}\]
Alternative 23
Error24.3
Cost448
\[x - \frac{x \cdot z}{t}\]
Alternative 24
Error12.3
Cost448
\[x + y \cdot \frac{z}{t}\]
Alternative 25
Error21.8
Cost448
\[x - \frac{x}{\frac{t}{z}}\]
Alternative 26
Error12.3
Cost448
\[x + \frac{y}{\frac{t}{z}}\]
Alternative 27
Error44.9
Cost320
\[z \cdot \frac{y}{t}\]
Alternative 28
Error43.3
Cost320
\[y \cdot \frac{z}{t}\]
Alternative 29
Error43.3
Cost320
\[\frac{y}{\frac{t}{z}}\]
Alternative 30
Error31.4
Cost64
\[x\]
Alternative 31
Error61.8
Cost64
\[1\]
Alternative 32
Error62.1
Cost64
\[0\]
Alternative 33
Error61.8
Cost64
\[-1\]

Error

Derivation

  1. Split input into 3 regimes
  2. if x < -2.7213483651068796e-22 or 4.3080571249178761e-147 < x

    1. Initial program 7.6

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    4. Simplified0.4

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

    if -2.7213483651068796e-22 < x < -9.2933461397245484e-230

    1. Initial program 4.2

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

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

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

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

    if -9.2933461397245484e-230 < x < 4.3080571249178761e-147

    1. Initial program 5.1

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

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z}{\sqrt[3]{t}}}\]
    5. Simplified4.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.7213483651068796 \cdot 10^{-22}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{elif}\;x \leq -9.293346139724548 \cdot 10^{-230}:\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{elif}\;x \leq 4.308057124917876 \cdot 10^{-147}:\\ \;\;\;\;x + \frac{y - x}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z}{\sqrt[3]{t}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Reproduce

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