Average Error: 6.7 → 1.8
Time: 5.1s
Precision: binary64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \leq -4.7704861853011726 \cdot 10^{-138}:\\ \;\;\;\;x + \left(\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}\right) \cdot \frac{\sqrt[3]{y - x} \cdot z}{t}\\ \mathbf{elif}\;t \leq 8.045671285241528 \cdot 10^{-300}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\left(y - x\right) \cdot \frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt{t}}\right) \cdot \frac{\sqrt[3]{z}}{\sqrt{t}}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;t \leq -4.7704861853011726 \cdot 10^{-138}:\\
\;\;\;\;x + \left(\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}\right) \cdot \frac{\sqrt[3]{y - x} \cdot z}{t}\\

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

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

\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
(FPCore (x y z t)
 :precision binary64
 (if (<= t -4.7704861853011726e-138)
   (+ x (* (* (cbrt (- y x)) (cbrt (- y x))) (/ (* (cbrt (- y x)) z) t)))
   (if (<= t 8.045671285241528e-300)
     (+ x (/ (* (- y x) z) t))
     (+
      x
      (*
       (* (- y x) (/ (* (cbrt z) (cbrt z)) (sqrt t)))
       (/ (cbrt z) (sqrt 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 (t <= -4.7704861853011726e-138) {
		tmp = x + ((cbrt(y - x) * cbrt(y - x)) * ((cbrt(y - x) * z) / t));
	} else if (t <= 8.045671285241528e-300) {
		tmp = x + (((y - x) * z) / t);
	} else {
		tmp = x + (((y - x) * ((cbrt(z) * cbrt(z)) / sqrt(t))) * (cbrt(z) / sqrt(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.7
Target2.0
Herbie1.8
\[\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}\]

Derivation

  1. Split input into 3 regimes
  2. if t < -4.7704861853011726e-138

    1. Initial program 7.3

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

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

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

      \[\leadsto x + \color{blue}{\left(y - x\right)} \cdot \frac{z}{t}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt_binary641.8

      \[\leadsto x + \color{blue}{\left(\left(\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}\right) \cdot \sqrt[3]{y - x}\right)} \cdot \frac{z}{t}\]
    8. Applied associate-*l*_binary641.8

      \[\leadsto x + \color{blue}{\left(\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}\right) \cdot \left(\sqrt[3]{y - x} \cdot \frac{z}{t}\right)}\]
    9. Simplified1.8

      \[\leadsto x + \left(\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}\right) \cdot \color{blue}{\left(\frac{z}{t} \cdot \sqrt[3]{y - x}\right)}\]
    10. Using strategy rm
    11. Applied associate-*l/_binary642.3

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

    if -4.7704861853011726e-138 < t < 8.0456712852415279e-300

    1. Initial program 3.5

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

    if 8.0456712852415279e-300 < t

    1. Initial program 6.8

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

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

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

      \[\leadsto x + \color{blue}{\left(y - x\right)} \cdot \frac{z}{t}\]
    6. Using strategy rm
    7. Applied add-sqr-sqrt_binary642.1

      \[\leadsto x + \left(y - x\right) \cdot \frac{z}{\color{blue}{\sqrt{t} \cdot \sqrt{t}}}\]
    8. Applied add-cube-cbrt_binary642.4

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

      \[\leadsto x + \left(y - x\right) \cdot \color{blue}{\left(\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt{t}} \cdot \frac{\sqrt[3]{z}}{\sqrt{t}}\right)}\]
    10. Applied associate-*r*_binary641.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.7704861853011726 \cdot 10^{-138}:\\ \;\;\;\;x + \left(\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}\right) \cdot \frac{\sqrt[3]{y - x} \cdot z}{t}\\ \mathbf{elif}\;t \leq 8.045671285241528 \cdot 10^{-300}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\left(y - x\right) \cdot \frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt{t}}\right) \cdot \frac{\sqrt[3]{z}}{\sqrt{t}}\\ \end{array}\]

Alternatives

Reproduce

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