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

\mathbf{elif}\;z \leq 2.5 \cdot 10^{-177}:\\
\;\;\;\;\frac{x \cdot y - z \cdot x}{t - z}\\

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


\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

Original11.7
Target2.2
Herbie2.3
\[\frac{x}{\frac{t - z}{y - z}} \]

Derivation

  1. Split input into 3 regimes
  2. if z < -2.7000000000000001e-93

    1. Initial program 14.9

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

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

    if -2.7000000000000001e-93 < z < 2.5e-177

    1. Initial program 6.0

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Simplified5.7

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

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

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

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

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

    if 2.5e-177 < z

    1. Initial program 12.8

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.7 \cdot 10^{-93}:\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-177}:\\ \;\;\;\;\frac{x \cdot y - z \cdot x}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \end{array} \]

Reproduce

herbie shell --seed 2022166 
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
  :precision binary64

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

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