Average Error: 10.5 → 1.0
Time: 5.7s
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 -1.705858826938391 \cdot 10^{+96}:\\ \;\;\;\;x + \frac{\frac{y}{a - t}}{\frac{1}{z - t}}\\ \mathbf{elif}\;\frac{y \cdot \left(z - t\right)}{a - t} \leq 6.839925195301661 \cdot 10^{+266}:\\ \;\;\;\;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}\]
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 -1.705858826938391 \cdot 10^{+96}:\\
\;\;\;\;x + \frac{\frac{y}{a - t}}{\frac{1}{z - t}}\\

\mathbf{elif}\;\frac{y \cdot \left(z - t\right)}{a - t} \leq 6.839925195301661 \cdot 10^{+266}:\\
\;\;\;\;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}
(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)) -1.705858826938391e+96)
   (+ x (/ (/ y (- a t)) (/ 1.0 (- z t))))
   (if (<= (/ (* y (- z t)) (- a t)) 6.839925195301661e+266)
     (+ x (* (* y (- z t)) (/ 1.0 (- a t))))
     (+ x (* y (/ (- z t) (- a 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)) <= -1.705858826938391e+96) {
		tmp = x + ((y / (a - t)) / (1.0 / (z - t)));
	} else if (((y * (z - t)) / (a - t)) <= 6.839925195301661e+266) {
		tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
	} else {
		tmp = x + (y * ((z - t) / (a - 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.5
Target1.1
Herbie1.0
\[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)) < -1.70585882693839089e96

    1. Initial program 32.4

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

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

      \[\leadsto x + \frac{y}{\color{blue}{\left(a - t\right) \cdot \frac{1}{z - t}}}\]
    6. Applied associate-/r*_binary64_117193.8

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

    if -1.70585882693839089e96 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 6.839925195301661e266

    1. Initial program 0.3

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

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

    if 6.839925195301661e266 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t))

    1. Initial program 56.9

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a - t} \leq -1.705858826938391 \cdot 10^{+96}:\\ \;\;\;\;x + \frac{\frac{y}{a - t}}{\frac{1}{z - t}}\\ \mathbf{elif}\;\frac{y \cdot \left(z - t\right)}{a - t} \leq 6.839925195301661 \cdot 10^{+266}:\\ \;\;\;\;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}\]

Reproduce

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