Average Error: 2.2 → 2.8
Time: 5.4s
Precision: binary64
\[\frac{x - y}{z - y} \cdot t \]
\[\begin{array}{l} \mathbf{if}\;y \leq -1.2 \cdot 10^{+83}:\\ \;\;\;\;\frac{t}{\frac{y - z}{y - x}}\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{-198}:\\ \;\;\;\;\left(y - x\right) \cdot \frac{t}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{z}{x - y} - \frac{y}{x - y}}\\ \end{array} \]
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
(FPCore (x y z t)
 :precision binary64
 (if (<= y -1.2e+83)
   (/ t (/ (- y z) (- y x)))
   (if (<= y 2.3e-198)
     (* (- y x) (/ t (- y z)))
     (/ t (- (/ z (- x y)) (/ y (- x y)))))))
double code(double x, double y, double z, double t) {
	return ((x - y) / (z - y)) * t;
}
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.2e+83) {
		tmp = t / ((y - z) / (y - x));
	} else if (y <= 2.3e-198) {
		tmp = (y - x) * (t / (y - z));
	} else {
		tmp = t / ((z / (x - y)) - (y / (x - y)));
	}
	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 - y)) * 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) :: tmp
    if (y <= (-1.2d+83)) then
        tmp = t / ((y - z) / (y - x))
    else if (y <= 2.3d-198) then
        tmp = (y - x) * (t / (y - z))
    else
        tmp = t / ((z / (x - y)) - (y / (x - y)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	return ((x - y) / (z - y)) * t;
}
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.2e+83) {
		tmp = t / ((y - z) / (y - x));
	} else if (y <= 2.3e-198) {
		tmp = (y - x) * (t / (y - z));
	} else {
		tmp = t / ((z / (x - y)) - (y / (x - y)));
	}
	return tmp;
}
def code(x, y, z, t):
	return ((x - y) / (z - y)) * t
def code(x, y, z, t):
	tmp = 0
	if y <= -1.2e+83:
		tmp = t / ((y - z) / (y - x))
	elif y <= 2.3e-198:
		tmp = (y - x) * (t / (y - z))
	else:
		tmp = t / ((z / (x - y)) - (y / (x - y)))
	return tmp
function code(x, y, z, t)
	return Float64(Float64(Float64(x - y) / Float64(z - y)) * t)
end
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -1.2e+83)
		tmp = Float64(t / Float64(Float64(y - z) / Float64(y - x)));
	elseif (y <= 2.3e-198)
		tmp = Float64(Float64(y - x) * Float64(t / Float64(y - z)));
	else
		tmp = Float64(t / Float64(Float64(z / Float64(x - y)) - Float64(y / Float64(x - y))));
	end
	return tmp
end
function tmp = code(x, y, z, t)
	tmp = ((x - y) / (z - y)) * t;
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -1.2e+83)
		tmp = t / ((y - z) / (y - x));
	elseif (y <= 2.3e-198)
		tmp = (y - x) * (t / (y - z));
	else
		tmp = t / ((z / (x - y)) - (y / (x - y)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
code[x_, y_, z_, t_] := If[LessEqual[y, -1.2e+83], N[(t / N[(N[(y - z), $MachinePrecision] / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e-198], N[(N[(y - x), $MachinePrecision] * N[(t / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t / N[(N[(z / N[(x - y), $MachinePrecision]), $MachinePrecision] - N[(y / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+83}:\\
\;\;\;\;\frac{t}{\frac{y - z}{y - x}}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{z}{x - y} - \frac{y}{x - y}}\\


\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.2
Target2.2
Herbie2.8
\[\frac{t}{\frac{z - y}{x - y}} \]

Derivation

  1. Split input into 3 regimes
  2. if y < -1.19999999999999996e83

    1. Initial program 0.1

      \[\frac{x - y}{z - y} \cdot t \]
    2. Applied egg-rr0.1

      \[\leadsto \color{blue}{\frac{t}{\frac{z - y}{x - y}}} \]
    3. Applied egg-rr0.1

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

    if -1.19999999999999996e83 < y < 2.30000000000000013e-198

    1. Initial program 3.9

      \[\frac{x - y}{z - y} \cdot t \]
    2. Simplified5.5

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

    if 2.30000000000000013e-198 < y

    1. Initial program 1.5

      \[\frac{x - y}{z - y} \cdot t \]
    2. Applied egg-rr1.6

      \[\leadsto \color{blue}{\frac{t}{\frac{z - y}{x - y}}} \]
    3. Taylor expanded in z around 0 1.6

      \[\leadsto \frac{t}{\color{blue}{\frac{z}{x - y} - \frac{y}{x - y}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification2.8

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

Reproduce

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

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

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