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

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

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


\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.0
Target2.2
Herbie1.9
\[\begin{array}{l} \mathbf{if}\;z < 2.759456554562692 \cdot 10^{-282}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \mathbf{elif}\;z < 2.326994450874436 \cdot 10^{-110}:\\ \;\;\;\;x \cdot \frac{z - t}{y} + t\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \end{array} \]

Derivation

  1. Split input into 2 regimes
  2. if t < -4.3999999999999998e-162 or -2.75e-288 < t

    1. Initial program 1.6

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Applied egg-rr1.5

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

    if -4.3999999999999998e-162 < t < -2.75e-288

    1. Initial program 4.8

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Applied egg-rr5.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.4 \cdot 10^{-162}:\\ \;\;\;\;t + \frac{z - t}{\frac{y}{x}}\\ \mathbf{elif}\;t \leq -2.75 \cdot 10^{-288}:\\ \;\;\;\;t + \frac{\left(z - t\right) \cdot x}{y}\\ \mathbf{else}:\\ \;\;\;\;t + \frac{z - t}{\frac{y}{x}}\\ \end{array} \]

Reproduce

herbie shell --seed 2022162 
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
  :precision binary64

  :herbie-target
  (if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))

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