Average Error: 10.9 → 0.4
Time: 8.3s
Precision: binary64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a - t} \leq -\infty:\\ \;\;\;\;x + \frac{1}{\frac{a - t}{y}} \cdot \frac{1}{\frac{1}{z - t}}\\ \mathbf{elif}\;\frac{y \cdot \left(z - t\right)}{a - t} \leq 1.0296131601567404 \cdot 10^{+212}:\\ \;\;\;\;\frac{y \cdot \left(z - t\right)}{a - t} + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{a - t}{z - t}}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a - t} \leq -\infty:\\
\;\;\;\;x + \frac{1}{\frac{a - t}{y}} \cdot \frac{1}{\frac{1}{z - t}}\\

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

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

\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
(FPCore (x y z t a)
 :precision binary64
 (if (<= (/ (* y (- z t)) (- a t)) (- INFINITY))
   (+ x (* (/ 1.0 (/ (- a t) y)) (/ 1.0 (/ 1.0 (- z t)))))
   (if (<= (/ (* y (- z t)) (- a t)) 1.0296131601567404e+212)
     (+ (/ (* y (- z t)) (- a t)) x)
     (+ x (/ y (/ (- a t) (- z t)))))))
double code(double x, double y, double z, double t, double a) {
	return x + ((y * (z - t)) / (a - t));
}
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (((y * (z - t)) / (a - t)) <= -((double) INFINITY)) {
		tmp = x + ((1.0 / ((a - t) / y)) * (1.0 / (1.0 / (z - t))));
	} else if (((y * (z - t)) / (a - t)) <= 1.0296131601567404e+212) {
		tmp = ((y * (z - t)) / (a - t)) + x;
	} else {
		tmp = x + (y / ((a - t) / (z - t)));
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.9
Target1.4
Herbie0.4
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Split input into 3 regimes
  2. if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -inf.0

    1. Initial program 64.0

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

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

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

      \[\leadsto x + \frac{\color{blue}{\frac{y}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}} \cdot \left(z - t\right)}}{\sqrt[3]{a - t}}\]
    6. Using strategy rm
    7. Applied clear-num_binary6419.4

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

      \[\leadsto x + \frac{1}{\color{blue}{\frac{\frac{a - t}{y}}{z - t}}}\]
    9. Using strategy rm
    10. Applied div-inv_binary640.3

      \[\leadsto x + \frac{1}{\color{blue}{\frac{a - t}{y} \cdot \frac{1}{z - t}}}\]
    11. Applied *-un-lft-identity_binary640.3

      \[\leadsto x + \frac{\color{blue}{1 \cdot 1}}{\frac{a - t}{y} \cdot \frac{1}{z - t}}\]
    12. Applied times-frac_binary640.3

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

    if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 1.02961316015674038e212

    1. Initial program 0.2

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

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

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

      \[\leadsto x + \color{blue}{y} \cdot \frac{z - t}{a - t}\]
    6. Taylor expanded around 0 0.2

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

    if 1.02961316015674038e212 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t))

    1. Initial program 49.3

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

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

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

Alternatives

Reproduce

herbie shell --seed 2021118 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
  :precision binary64

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

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