Average Error: 10.9 → 0.3
Time: 13.0s
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 \lor \neg \left(\frac{y \cdot \left(z - t\right)}{a - t} \leq 8.36607743914692 \cdot 10^{+265}\right):\\ \;\;\;\;x + \frac{y}{\frac{a - t}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left(z - t\right)}{a - t} + x\\ \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 \lor \neg \left(\frac{y \cdot \left(z - t\right)}{a - t} \leq 8.36607743914692 \cdot 10^{+265}\right):\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z - t}}\\

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

\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 (or (<= (/ (* y (- z t)) (- a t)) (- INFINITY))
         (not (<= (/ (* y (- z t)) (- a t)) 8.36607743914692e+265)))
   (+ x (/ y (/ (- a t) (- z t))))
   (+ (/ (* y (- z t)) (- a t)) x)))
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)) || !(((y * (z - t)) / (a - t)) <= 8.36607743914692e+265)) {
		tmp = x + (y / ((a - t) / (z - t)));
	} else {
		tmp = ((y * (z - t)) / (a - t)) + x;
	}
	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.2
Herbie0.3
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

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

    1. Initial program 61.1

      \[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
    2. Simplified0.5

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

    if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 8.3660774391469199e265

    1. Initial program 0.2

      \[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

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

Reproduce

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