Average Error: 16.6 → 6.2
Time: 58.2s
Precision: binary64
\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \]
\[\begin{array}{l} t_1 := x + \frac{y}{t} \cdot \left(z - a\right)\\ \mathbf{if}\;t \leq -4.198064154831332 \cdot 10^{+96}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 4.65767209864162 \cdot 10^{+83}:\\ \;\;\;\;\left(y + \left(x + \frac{t \cdot y}{a - t}\right)\right) - \frac{y}{\frac{a - t}{z}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (* (/ y t) (- z a)))))
   (if (<= t -4.198064154831332e+96)
     t_1
     (if (<= t 4.65767209864162e+83)
       (- (+ y (+ x (/ (* t y) (- a t)))) (/ y (/ (- a t) z)))
       t_1))))
double code(double x, double y, double z, double t, double a) {
	return (x + y) - (((z - t) * y) / (a - t));
}
double code(double x, double y, double z, double t, double a) {
	double t_1 = x + ((y / t) * (z - a));
	double tmp;
	if (t <= -4.198064154831332e+96) {
		tmp = t_1;
	} else if (t <= 4.65767209864162e+83) {
		tmp = (y + (x + ((t * y) / (a - t)))) - (y / ((a - t) / z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = (x + y) - (((z - t) * y) / (a - t))
end function
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x + ((y / t) * (z - a))
    if (t <= (-4.198064154831332d+96)) then
        tmp = t_1
    else if (t <= 4.65767209864162d+83) then
        tmp = (y + (x + ((t * y) / (a - t)))) - (y / ((a - t) / z))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	return (x + y) - (((z - t) * y) / (a - t));
}
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = x + ((y / t) * (z - a));
	double tmp;
	if (t <= -4.198064154831332e+96) {
		tmp = t_1;
	} else if (t <= 4.65767209864162e+83) {
		tmp = (y + (x + ((t * y) / (a - t)))) - (y / ((a - t) / z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	return (x + y) - (((z - t) * y) / (a - t))
def code(x, y, z, t, a):
	t_1 = x + ((y / t) * (z - a))
	tmp = 0
	if t <= -4.198064154831332e+96:
		tmp = t_1
	elif t <= 4.65767209864162e+83:
		tmp = (y + (x + ((t * y) / (a - t)))) - (y / ((a - t) / z))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t)))
end
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(Float64(y / t) * Float64(z - a)))
	tmp = 0.0
	if (t <= -4.198064154831332e+96)
		tmp = t_1;
	elseif (t <= 4.65767209864162e+83)
		tmp = Float64(Float64(y + Float64(x + Float64(Float64(t * y) / Float64(a - t)))) - Float64(y / Float64(Float64(a - t) / z)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp = code(x, y, z, t, a)
	tmp = (x + y) - (((z - t) * y) / (a - t));
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + ((y / t) * (z - a));
	tmp = 0.0;
	if (t <= -4.198064154831332e+96)
		tmp = t_1;
	elseif (t <= 4.65767209864162e+83)
		tmp = (y + (x + ((t * y) / (a - t)))) - (y / ((a - t) / z));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.198064154831332e+96], t$95$1, If[LessEqual[t, 4.65767209864162e+83], N[(N[(y + N[(x + N[(N[(t * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
t_1 := x + \frac{y}{t} \cdot \left(z - a\right)\\
\mathbf{if}\;t \leq -4.198064154831332 \cdot 10^{+96}:\\
\;\;\;\;t_1\\

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

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


\end{array}

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

Original16.6
Target8.8
Herbie6.2
\[\begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} < -1.3664970889390727 \cdot 10^{-7}:\\ \;\;\;\;\left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\ \mathbf{elif}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} < 1.4754293444577233 \cdot 10^{-239}:\\ \;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\ \mathbf{else}:\\ \;\;\;\;\left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\ \end{array} \]

Derivation

  1. Split input into 2 regimes
  2. if t < -4.19806415483133219e96 or 4.65767209864161974e83 < t

    1. Initial program 30.3

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

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

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

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

    if -4.19806415483133219e96 < t < 4.65767209864161974e83

    1. Initial program 8.1

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

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

      \[\leadsto \color{blue}{\left(y + \left(\frac{y \cdot t}{a - t} + x\right)\right) - \frac{y \cdot z}{a - t}} \]
    4. Applied associate-/l*_binary645.3

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

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

Reproduce

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

  :herbie-target
  (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-7) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y))))

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