Average Error: 10.1 → 1.1
Time: 2.7s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.3556285618525312 \cdot 10^{-32}:\\ \;\;\;\;x + \frac{y}{z - a} \cdot \left(z - t\right)\\ \mathbf{elif}\;y \le 1.21539727317836126 \cdot 10^{-115}:\\ \;\;\;\;x + \frac{1}{\frac{z - a}{y \cdot \left(z - t\right)}}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(\frac{z}{z - a} - \frac{t}{z - a}\right)\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{z - a}
\begin{array}{l}
\mathbf{if}\;y \le -2.3556285618525312 \cdot 10^{-32}:\\
\;\;\;\;x + \frac{y}{z - a} \cdot \left(z - t\right)\\

\mathbf{elif}\;y \le 1.21539727317836126 \cdot 10^{-115}:\\
\;\;\;\;x + \frac{1}{\frac{z - a}{y \cdot \left(z - t\right)}}\\

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

\end{array}
double code(double x, double y, double z, double t, double a) {
	return ((double) (x + ((double) (((double) (y * ((double) (z - t)))) / ((double) (z - a))))));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if ((y <= -2.3556285618525312e-32)) {
		VAR = ((double) (x + ((double) (((double) (y / ((double) (z - a)))) * ((double) (z - t))))));
	} else {
		double VAR_1;
		if ((y <= 1.2153972731783613e-115)) {
			VAR_1 = ((double) (x + ((double) (1.0 / ((double) (((double) (z - a)) / ((double) (y * ((double) (z - t))))))))));
		} else {
			VAR_1 = ((double) (x + ((double) (y * ((double) (((double) (z / ((double) (z - a)))) - ((double) (t / ((double) (z - a))))))))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.1
Target1.3
Herbie1.1
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Split input into 3 regimes
  2. if y < -2.3556285618525312e-32

    1. Initial program 20.0

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

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

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

      \[\leadsto x + \color{blue}{y} \cdot \frac{z - t}{z - a}\]
    6. Using strategy rm
    7. Applied div-sub0.5

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{z}{z - a} - \frac{t}{z - a}\right)}\]
    8. Using strategy rm
    9. Applied div-inv0.5

      \[\leadsto x + y \cdot \left(\frac{z}{z - a} - \color{blue}{t \cdot \frac{1}{z - a}}\right)\]
    10. Applied div-inv0.6

      \[\leadsto x + y \cdot \left(\color{blue}{z \cdot \frac{1}{z - a}} - t \cdot \frac{1}{z - a}\right)\]
    11. Applied distribute-rgt-out--0.6

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

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

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

    if -2.3556285618525312e-32 < y < 1.2153972731783613e-115

    1. Initial program 0.5

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

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

    if 1.2153972731783613e-115 < y

    1. Initial program 14.8

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

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

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

      \[\leadsto x + \color{blue}{y} \cdot \frac{z - t}{z - a}\]
    6. Using strategy rm
    7. Applied div-sub0.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.3556285618525312 \cdot 10^{-32}:\\ \;\;\;\;x + \frac{y}{z - a} \cdot \left(z - t\right)\\ \mathbf{elif}\;y \le 1.21539727317836126 \cdot 10^{-115}:\\ \;\;\;\;x + \frac{1}{\frac{z - a}{y \cdot \left(z - t\right)}}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(\frac{z}{z - a} - \frac{t}{z - a}\right)\\ \end{array}\]

Reproduce

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

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

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