Average Error: 10.8 → 0.4
Time: 4.5s
Precision: binary64
\[x + \frac{y \cdot \left(z - t\right)}{a - t} \]
\[\begin{array}{l} t_1 := x + \frac{y}{\frac{a - t}{z - t}}\\ \mathbf{if}\;y \leq -4.292063565913367 \cdot 10^{-41}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.3766154638147954 \cdot 10^{-20}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a - t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
t_1 := x + \frac{y}{\frac{a - t}{z - t}}\\
\mathbf{if}\;y \leq -4.292063565913367 \cdot 10^{-41}:\\
\;\;\;\;t_1\\

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (/ y (/ (- a t) (- z t))))))
   (if (<= y -4.292063565913367e-41)
     t_1
     (if (<= y 5.3766154638147954e-20) (+ x (/ (* y (- z t)) (- a t))) t_1))))
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 t_1 = x + (y / ((a - t) / (z - t)));
	double tmp;
	if (y <= -4.292063565913367e-41) {
		tmp = t_1;
	} else if (y <= 5.3766154638147954e-20) {
		tmp = x + ((y * (z - t)) / (a - t));
	} else {
		tmp = t_1;
	}
	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.8
Target1.3
Herbie0.4
\[x + \frac{y}{\frac{a - t}{z - t}} \]

Derivation

  1. Split input into 2 regimes
  2. if y < -4.2920635659133672e-41 or 5.3766154638147954e-20 < y

    1. Initial program 21.0

      \[x + \frac{y \cdot \left(z - t\right)}{a - t} \]
    2. Applied associate-/l*_binary640.6

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

    if -4.2920635659133672e-41 < y < 5.3766154638147954e-20

    1. Initial program 0.3

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

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

Reproduce

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