Average Error: 10.5 → 0.3
Time: 8.6s
Precision: binary64
\[x + \frac{y \cdot \left(z - t\right)}{a - t} \]
\[\begin{array}{l} t_1 := \frac{y \cdot \left(z - t\right)}{a - t}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{a - t}, x\right)\\ \mathbf{elif}\;t_1 \leq 7.699020357290224 \cdot 10^{+278}:\\ \;\;\;\;t_1 + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{1}{\frac{a}{z - t} - \frac{t}{z - t}}, x\right)\\ \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 (/ (* y (- z t)) (- a t))))
   (if (<= t_1 (- INFINITY))
     (fma (- z t) (/ y (- a t)) x)
     (if (<= t_1 7.699020357290224e+278)
       (+ t_1 x)
       (fma y (/ 1.0 (- (/ a (- z t)) (/ t (- z 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 t_1 = (y * (z - t)) / (a - t);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = fma((z - t), (y / (a - t)), x);
	} else if (t_1 <= 7.699020357290224e+278) {
		tmp = t_1 + x;
	} else {
		tmp = fma(y, (1.0 / ((a / (z - t)) - (t / (z - t)))), x);
	}
	return tmp;
}
function code(x, y, z, t, a)
	return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t)))
end
function code(x, y, z, t, a)
	t_1 = Float64(Float64(y * Float64(z - t)) / Float64(a - t))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = fma(Float64(z - t), Float64(y / Float64(a - t)), x);
	elseif (t_1 <= 7.699020357290224e+278)
		tmp = Float64(t_1 + x);
	else
		tmp = fma(y, Float64(1.0 / Float64(Float64(a / Float64(z - t)) - Float64(t / Float64(z - t)))), x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(z - t), $MachinePrecision] * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 7.699020357290224e+278], N[(t$95$1 + x), $MachinePrecision], N[(y * N[(1.0 / N[(N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision] - N[(t / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{a - t}, x\right)\\

\mathbf{elif}\;t_1 \leq 7.699020357290224 \cdot 10^{+278}:\\
\;\;\;\;t_1 + x\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{1}{\frac{a}{z - t} - \frac{t}{z - t}}, x\right)\\


\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original10.5
Target1.3
Herbie0.3
\[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)) < -inf.0

    1. Initial program 64.0

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)} \]
    3. Taylor expanded in y around 0 64.0

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

      \[\leadsto \color{blue}{x + \frac{y}{a - t} \cdot \left(z - t\right)} \]
    5. Taylor expanded in x around 0 64.0

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z - t, \frac{y}{a - t}, x\right)} \]

    if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 7.699020357290224e278

    1. Initial program 0.3

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)} \]
    3. Taylor expanded in y around 0 0.3

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

      \[\leadsto \color{blue}{x + \frac{y}{a - t} \cdot \left(z - t\right)} \]
    5. Applied *-un-lft-identity_binary643.5

      \[\leadsto x + \color{blue}{\left(1 \cdot \frac{y}{a - t}\right)} \cdot \left(z - t\right) \]
    6. Applied associate-*l*_binary643.5

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

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

    if 7.699020357290224e278 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t))

    1. Initial program 59.3

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)} \]
    3. Applied clear-num_binary641.1

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{1}{\frac{a - t}{z - t}}}, x\right) \]
    4. Taylor expanded in a around 0 1.1

      \[\leadsto \mathsf{fma}\left(y, \frac{1}{\color{blue}{\frac{a}{z - t} - \frac{t}{z - t}}}, x\right) \]
  3. Recombined 3 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:\\ \;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{a - t}, x\right)\\ \mathbf{elif}\;\frac{y \cdot \left(z - t\right)}{a - t} \leq 7.699020357290224 \cdot 10^{+278}:\\ \;\;\;\;\frac{y \cdot \left(z - t\right)}{a - t} + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{1}{\frac{a}{z - t} - \frac{t}{z - t}}, x\right)\\ \end{array} \]

Reproduce

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