Average Error: 1.3 → 1.0
Time: 8.0s
Precision: binary64
\[x + y \cdot \frac{z - t}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \leq -1.903298031775812 \cdot 10^{+79}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y \leq 5.328190999737839 \cdot 10^{-77}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{a - t}{z - t}}\\ \end{array}\]
x + y \cdot \frac{z - t}{a - t}
\begin{array}{l}
\mathbf{if}\;y \leq -1.903298031775812 \cdot 10^{+79}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a - t}\\

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

\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 -1.903298031775812e+79)
   (+ x (* y (/ (- z t) (- a t))))
   (if (<= y 5.328190999737839e-77)
     (+ x (/ (* y (- z t)) (- a t)))
     (+ 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 <= -1.903298031775812e+79) {
		tmp = x + (y * ((z - t) / (a - t)));
	} else if (y <= 5.328190999737839e-77) {
		tmp = x + ((y * (z - t)) / (a - t));
	} 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

Original1.3
Target0.4
Herbie1.0
\[\begin{array}{l} \mathbf{if}\;y < -8.508084860551241 \cdot 10^{-17}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if y < -1.90329803177581204e79

    1. Initial program 0.7

      \[x + y \cdot \frac{z - t}{a - t}\]

    if -1.90329803177581204e79 < y < 5.3281909997378391e-77

    1. Initial program 2.0

      \[x + y \cdot \frac{z - t}{a - t}\]
    2. Using strategy rm
    3. Applied associate-*r/_binary64_150241.3

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

    if 5.3281909997378391e-77 < y

    1. Initial program 0.5

      \[x + y \cdot \frac{z - t}{a - t}\]
    2. Using strategy rm
    3. Applied clear-num_binary64_150810.6

      \[\leadsto x + y \cdot \color{blue}{\frac{1}{\frac{a - t}{z - t}}}\]
    4. Using strategy rm
    5. Applied un-div-inv_binary64_150800.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.903298031775812 \cdot 10^{+79}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y \leq 5.328190999737839 \cdot 10^{-77}:\\ \;\;\;\;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 2020344 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
  :precision binary64

  :herbie-target
  (if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))

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