Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, B

Percentage Accurate: 88.6% → 97.9%
Time: 11.7s
Alternatives: 18
Speedup: 0.4×

Specification

?
\[\begin{array}{l} \\ \frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
double code(double x, double y, double z, double t) {
	return x / ((y - z) * (t - z));
}
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
public static double code(double x, double y, double z, double t) {
	return x / ((y - z) * (t - z));
}
def code(x, y, z, t):
	return x / ((y - z) * (t - z))
function code(x, y, z, t)
	return Float64(x / Float64(Float64(y - z) * Float64(t - z)))
end
function tmp = code(x, y, z, t)
	tmp = x / ((y - z) * (t - z));
end
code[x_, y_, z_, t_] := N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 18 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 88.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
double code(double x, double y, double z, double t) {
	return x / ((y - z) * (t - z));
}
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
public static double code(double x, double y, double z, double t) {
	return x / ((y - z) * (t - z));
}
def code(x, y, z, t):
	return x / ((y - z) * (t - z))
function code(x, y, z, t)
	return Float64(x / Float64(Float64(y - z) * Float64(t - z)))
end
function tmp = code(x, y, z, t)
	tmp = x / ((y - z) * (t - z));
end
code[x_, y_, z_, t_] := N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\end{array}

Alternative 1: 97.9% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ \begin{array}{l} t_1 := \frac{x\_m}{\left(y - z\right) \cdot \left(t - z\right)}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-312}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x\_m}{t - z}}{y - z}\\ \end{array} \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (let* ((t_1 (/ x_m (* (- y z) (- t z)))))
   (* x_s (if (<= t_1 -2e-312) t_1 (/ (/ x_m (- t z)) (- y z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = x_m / ((y - z) * (t - z));
	double tmp;
	if (t_1 <= -2e-312) {
		tmp = t_1;
	} else {
		tmp = (x_m / (t - z)) / (y - z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x_m / ((y - z) * (t - z))
    if (t_1 <= (-2d-312)) then
        tmp = t_1
    else
        tmp = (x_m / (t - z)) / (y - z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = x_m / ((y - z) * (t - z));
	double tmp;
	if (t_1 <= -2e-312) {
		tmp = t_1;
	} else {
		tmp = (x_m / (t - z)) / (y - z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	t_1 = x_m / ((y - z) * (t - z))
	tmp = 0
	if t_1 <= -2e-312:
		tmp = t_1
	else:
		tmp = (x_m / (t - z)) / (y - z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	t_1 = Float64(x_m / Float64(Float64(y - z) * Float64(t - z)))
	tmp = 0.0
	if (t_1 <= -2e-312)
		tmp = t_1;
	else
		tmp = Float64(Float64(x_m / Float64(t - z)) / Float64(y - z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	t_1 = x_m / ((y - z) * (t - z));
	tmp = 0.0;
	if (t_1 <= -2e-312)
		tmp = t_1;
	else
		tmp = (x_m / (t - z)) / (y - z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(x$95$m / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$1, -2e-312], t$95$1, N[(N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x\_m}{\left(y - z\right) \cdot \left(t - z\right)}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-312}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x (*.f64 (-.f64 y z) (-.f64 t z))) < -2.0000000000019e-312

    1. Initial program 98.2%

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

    if -2.0000000000019e-312 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 t z)))

    1. Initial program 82.2%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Step-by-step derivation
      1. associate-/l/97.4%

        \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    3. Simplified97.4%

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

Alternative 2: 93.2% accurate, 0.3× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ \begin{array}{l} t_1 := \frac{x\_m}{y - z}\\ t_2 := \left(y - z\right) \cdot \left(t - z\right)\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;\frac{t\_1}{t}\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+306}:\\ \;\;\;\;\frac{x\_m}{t\_2}\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \frac{-1}{z}\\ \end{array} \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (let* ((t_1 (/ x_m (- y z))) (t_2 (* (- y z) (- t z))))
   (*
    x_s
    (if (<= t_2 (- INFINITY))
      (/ t_1 t)
      (if (<= t_2 5e+306) (/ x_m t_2) (* t_1 (/ -1.0 z)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = x_m / (y - z);
	double t_2 = (y - z) * (t - z);
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = t_1 / t;
	} else if (t_2 <= 5e+306) {
		tmp = x_m / t_2;
	} else {
		tmp = t_1 * (-1.0 / z);
	}
	return x_s * tmp;
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = x_m / (y - z);
	double t_2 = (y - z) * (t - z);
	double tmp;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		tmp = t_1 / t;
	} else if (t_2 <= 5e+306) {
		tmp = x_m / t_2;
	} else {
		tmp = t_1 * (-1.0 / z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	t_1 = x_m / (y - z)
	t_2 = (y - z) * (t - z)
	tmp = 0
	if t_2 <= -math.inf:
		tmp = t_1 / t
	elif t_2 <= 5e+306:
		tmp = x_m / t_2
	else:
		tmp = t_1 * (-1.0 / z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	t_1 = Float64(x_m / Float64(y - z))
	t_2 = Float64(Float64(y - z) * Float64(t - z))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = Float64(t_1 / t);
	elseif (t_2 <= 5e+306)
		tmp = Float64(x_m / t_2);
	else
		tmp = Float64(t_1 * Float64(-1.0 / z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	t_1 = x_m / (y - z);
	t_2 = (y - z) * (t - z);
	tmp = 0.0;
	if (t_2 <= -Inf)
		tmp = t_1 / t;
	elseif (t_2 <= 5e+306)
		tmp = x_m / t_2;
	else
		tmp = t_1 * (-1.0 / z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(x$95$m / N[(y - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$2, (-Infinity)], N[(t$95$1 / t), $MachinePrecision], If[LessEqual[t$95$2, 5e+306], N[(x$95$m / t$95$2), $MachinePrecision], N[(t$95$1 * N[(-1.0 / z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x\_m}{y - z}\\
t_2 := \left(y - z\right) \cdot \left(t - z\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\frac{t\_1}{t}\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;\frac{x\_m}{t\_2}\\

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{-1}{z}\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (-.f64 y z) (-.f64 t z)) < -inf.0

    1. Initial program 67.7%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 67.7%

      \[\leadsto \color{blue}{\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}} \]
    4. Step-by-step derivation
      1. associate-/l/99.9%

        \[\leadsto \color{blue}{\frac{\frac{x}{y - z}}{t - z}} \]
    5. Simplified99.9%

      \[\leadsto \color{blue}{\frac{\frac{x}{y - z}}{t - z}} \]
    6. Taylor expanded in t around inf 86.3%

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

    if -inf.0 < (*.f64 (-.f64 y z) (-.f64 t z)) < 4.99999999999999993e306

    1. Initial program 99.1%

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

    if 4.99999999999999993e306 < (*.f64 (-.f64 y z) (-.f64 t z))

    1. Initial program 68.0%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 68.0%

      \[\leadsto \color{blue}{\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}} \]
    4. Step-by-step derivation
      1. associate-/l/99.8%

        \[\leadsto \color{blue}{\frac{\frac{x}{y - z}}{t - z}} \]
    5. Simplified99.8%

      \[\leadsto \color{blue}{\frac{\frac{x}{y - z}}{t - z}} \]
    6. Step-by-step derivation
      1. div-inv99.9%

        \[\leadsto \color{blue}{\frac{x}{y - z} \cdot \frac{1}{t - z}} \]
    7. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{x}{y - z} \cdot \frac{1}{t - z}} \]
    8. Taylor expanded in t around 0 84.3%

      \[\leadsto \frac{x}{y - z} \cdot \color{blue}{\frac{-1}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 83.5% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq -1.35 \cdot 10^{-77}:\\ \;\;\;\;\frac{\frac{x\_m}{t - z}}{y}\\ \mathbf{elif}\;t \leq 0.0024:\\ \;\;\;\;\frac{x\_m}{y - z} \cdot \frac{-1}{z}\\ \mathbf{elif}\;t \leq 2.2 \cdot 10^{+151}:\\ \;\;\;\;\frac{x\_m}{\left(y - z\right) \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x\_m}{t}}{y - z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= t -1.35e-77)
    (/ (/ x_m (- t z)) y)
    (if (<= t 0.0024)
      (* (/ x_m (- y z)) (/ -1.0 z))
      (if (<= t 2.2e+151) (/ x_m (* (- y z) t)) (/ (/ x_m t) (- y z)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (t <= -1.35e-77) {
		tmp = (x_m / (t - z)) / y;
	} else if (t <= 0.0024) {
		tmp = (x_m / (y - z)) * (-1.0 / z);
	} else if (t <= 2.2e+151) {
		tmp = x_m / ((y - z) * t);
	} else {
		tmp = (x_m / t) / (y - z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-1.35d-77)) then
        tmp = (x_m / (t - z)) / y
    else if (t <= 0.0024d0) then
        tmp = (x_m / (y - z)) * ((-1.0d0) / z)
    else if (t <= 2.2d+151) then
        tmp = x_m / ((y - z) * t)
    else
        tmp = (x_m / t) / (y - z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (t <= -1.35e-77) {
		tmp = (x_m / (t - z)) / y;
	} else if (t <= 0.0024) {
		tmp = (x_m / (y - z)) * (-1.0 / z);
	} else if (t <= 2.2e+151) {
		tmp = x_m / ((y - z) * t);
	} else {
		tmp = (x_m / t) / (y - z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if t <= -1.35e-77:
		tmp = (x_m / (t - z)) / y
	elif t <= 0.0024:
		tmp = (x_m / (y - z)) * (-1.0 / z)
	elif t <= 2.2e+151:
		tmp = x_m / ((y - z) * t)
	else:
		tmp = (x_m / t) / (y - z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (t <= -1.35e-77)
		tmp = Float64(Float64(x_m / Float64(t - z)) / y);
	elseif (t <= 0.0024)
		tmp = Float64(Float64(x_m / Float64(y - z)) * Float64(-1.0 / z));
	elseif (t <= 2.2e+151)
		tmp = Float64(x_m / Float64(Float64(y - z) * t));
	else
		tmp = Float64(Float64(x_m / t) / Float64(y - z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (t <= -1.35e-77)
		tmp = (x_m / (t - z)) / y;
	elseif (t <= 0.0024)
		tmp = (x_m / (y - z)) * (-1.0 / z);
	elseif (t <= 2.2e+151)
		tmp = x_m / ((y - z) * t);
	else
		tmp = (x_m / t) / (y - z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[t, -1.35e-77], N[(N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t, 0.0024], N[(N[(x$95$m / N[(y - z), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.2e+151], N[(x$95$m / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{-77}:\\
\;\;\;\;\frac{\frac{x\_m}{t - z}}{y}\\

\mathbf{elif}\;t \leq 0.0024:\\
\;\;\;\;\frac{x\_m}{y - z} \cdot \frac{-1}{z}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -1.35e-77

    1. Initial program 87.4%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Step-by-step derivation
      1. associate-/l/97.4%

        \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    3. Simplified97.4%

      \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 55.5%

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

    if -1.35e-77 < t < 0.00239999999999999979

    1. Initial program 87.2%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 87.2%

      \[\leadsto \color{blue}{\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}} \]
    4. Step-by-step derivation
      1. associate-/l/97.1%

        \[\leadsto \color{blue}{\frac{\frac{x}{y - z}}{t - z}} \]
    5. Simplified97.1%

      \[\leadsto \color{blue}{\frac{\frac{x}{y - z}}{t - z}} \]
    6. Step-by-step derivation
      1. div-inv97.0%

        \[\leadsto \color{blue}{\frac{x}{y - z} \cdot \frac{1}{t - z}} \]
    7. Applied egg-rr97.0%

      \[\leadsto \color{blue}{\frac{x}{y - z} \cdot \frac{1}{t - z}} \]
    8. Taylor expanded in t around 0 85.4%

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

    if 0.00239999999999999979 < t < 2.20000000000000007e151

    1. Initial program 96.2%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 83.6%

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

    if 2.20000000000000007e151 < t

    1. Initial program 70.0%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Step-by-step derivation
      1. associate-/l/97.1%

        \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    3. Simplified97.1%

      \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 91.8%

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

Alternative 4: 83.3% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq -2.2 \cdot 10^{-80}:\\ \;\;\;\;\frac{\frac{x\_m}{t - z}}{y}\\ \mathbf{elif}\;t \leq 0.0036:\\ \;\;\;\;\frac{\frac{x\_m}{z}}{z - y}\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{+149}:\\ \;\;\;\;\frac{x\_m}{\left(y - z\right) \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x\_m}{t}}{y - z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= t -2.2e-80)
    (/ (/ x_m (- t z)) y)
    (if (<= t 0.0036)
      (/ (/ x_m z) (- z y))
      (if (<= t 3.6e+149) (/ x_m (* (- y z) t)) (/ (/ x_m t) (- y z)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (t <= -2.2e-80) {
		tmp = (x_m / (t - z)) / y;
	} else if (t <= 0.0036) {
		tmp = (x_m / z) / (z - y);
	} else if (t <= 3.6e+149) {
		tmp = x_m / ((y - z) * t);
	} else {
		tmp = (x_m / t) / (y - z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-2.2d-80)) then
        tmp = (x_m / (t - z)) / y
    else if (t <= 0.0036d0) then
        tmp = (x_m / z) / (z - y)
    else if (t <= 3.6d+149) then
        tmp = x_m / ((y - z) * t)
    else
        tmp = (x_m / t) / (y - z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (t <= -2.2e-80) {
		tmp = (x_m / (t - z)) / y;
	} else if (t <= 0.0036) {
		tmp = (x_m / z) / (z - y);
	} else if (t <= 3.6e+149) {
		tmp = x_m / ((y - z) * t);
	} else {
		tmp = (x_m / t) / (y - z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if t <= -2.2e-80:
		tmp = (x_m / (t - z)) / y
	elif t <= 0.0036:
		tmp = (x_m / z) / (z - y)
	elif t <= 3.6e+149:
		tmp = x_m / ((y - z) * t)
	else:
		tmp = (x_m / t) / (y - z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (t <= -2.2e-80)
		tmp = Float64(Float64(x_m / Float64(t - z)) / y);
	elseif (t <= 0.0036)
		tmp = Float64(Float64(x_m / z) / Float64(z - y));
	elseif (t <= 3.6e+149)
		tmp = Float64(x_m / Float64(Float64(y - z) * t));
	else
		tmp = Float64(Float64(x_m / t) / Float64(y - z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (t <= -2.2e-80)
		tmp = (x_m / (t - z)) / y;
	elseif (t <= 0.0036)
		tmp = (x_m / z) / (z - y);
	elseif (t <= 3.6e+149)
		tmp = x_m / ((y - z) * t);
	else
		tmp = (x_m / t) / (y - z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[t, -2.2e-80], N[(N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t, 0.0036], N[(N[(x$95$m / z), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.6e+149], N[(x$95$m / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{-80}:\\
\;\;\;\;\frac{\frac{x\_m}{t - z}}{y}\\

\mathbf{elif}\;t \leq 0.0036:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{z - y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -2.2000000000000001e-80

    1. Initial program 87.4%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Step-by-step derivation
      1. associate-/l/97.4%

        \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    3. Simplified97.4%

      \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 55.5%

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

    if -2.2000000000000001e-80 < t < 0.0035999999999999999

    1. Initial program 87.2%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 74.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{z \cdot \left(y - z\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg74.8%

        \[\leadsto \color{blue}{-\frac{x}{z \cdot \left(y - z\right)}} \]
      2. associate-/r*85.9%

        \[\leadsto -\color{blue}{\frac{\frac{x}{z}}{y - z}} \]
      3. distribute-neg-frac285.9%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{-\left(y - z\right)}} \]
      4. neg-sub085.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{0 - \left(y - z\right)}} \]
      5. sub-neg85.9%

        \[\leadsto \frac{\frac{x}{z}}{0 - \color{blue}{\left(y + \left(-z\right)\right)}} \]
      6. +-commutative85.9%

        \[\leadsto \frac{\frac{x}{z}}{0 - \color{blue}{\left(\left(-z\right) + y\right)}} \]
      7. associate--r+85.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(0 - \left(-z\right)\right) - y}} \]
      8. neg-sub085.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(-\left(-z\right)\right)} - y} \]
      9. remove-double-neg85.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z} - y} \]
    5. Simplified85.9%

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

    if 0.0035999999999999999 < t < 3.59999999999999995e149

    1. Initial program 96.2%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 83.6%

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

    if 3.59999999999999995e149 < t

    1. Initial program 70.0%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Step-by-step derivation
      1. associate-/l/97.1%

        \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    3. Simplified97.1%

      \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 91.8%

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

Alternative 5: 83.3% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq -9 \cdot 10^{-151}:\\ \;\;\;\;\frac{\frac{x\_m}{y}}{t - z}\\ \mathbf{elif}\;t \leq 0.004:\\ \;\;\;\;\frac{\frac{x\_m}{z}}{z - y}\\ \mathbf{elif}\;t \leq 3.2 \cdot 10^{+151}:\\ \;\;\;\;\frac{x\_m}{\left(y - z\right) \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x\_m}{t}}{y - z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= t -9e-151)
    (/ (/ x_m y) (- t z))
    (if (<= t 0.004)
      (/ (/ x_m z) (- z y))
      (if (<= t 3.2e+151) (/ x_m (* (- y z) t)) (/ (/ x_m t) (- y z)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (t <= -9e-151) {
		tmp = (x_m / y) / (t - z);
	} else if (t <= 0.004) {
		tmp = (x_m / z) / (z - y);
	} else if (t <= 3.2e+151) {
		tmp = x_m / ((y - z) * t);
	} else {
		tmp = (x_m / t) / (y - z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-9d-151)) then
        tmp = (x_m / y) / (t - z)
    else if (t <= 0.004d0) then
        tmp = (x_m / z) / (z - y)
    else if (t <= 3.2d+151) then
        tmp = x_m / ((y - z) * t)
    else
        tmp = (x_m / t) / (y - z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (t <= -9e-151) {
		tmp = (x_m / y) / (t - z);
	} else if (t <= 0.004) {
		tmp = (x_m / z) / (z - y);
	} else if (t <= 3.2e+151) {
		tmp = x_m / ((y - z) * t);
	} else {
		tmp = (x_m / t) / (y - z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if t <= -9e-151:
		tmp = (x_m / y) / (t - z)
	elif t <= 0.004:
		tmp = (x_m / z) / (z - y)
	elif t <= 3.2e+151:
		tmp = x_m / ((y - z) * t)
	else:
		tmp = (x_m / t) / (y - z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (t <= -9e-151)
		tmp = Float64(Float64(x_m / y) / Float64(t - z));
	elseif (t <= 0.004)
		tmp = Float64(Float64(x_m / z) / Float64(z - y));
	elseif (t <= 3.2e+151)
		tmp = Float64(x_m / Float64(Float64(y - z) * t));
	else
		tmp = Float64(Float64(x_m / t) / Float64(y - z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (t <= -9e-151)
		tmp = (x_m / y) / (t - z);
	elseif (t <= 0.004)
		tmp = (x_m / z) / (z - y);
	elseif (t <= 3.2e+151)
		tmp = x_m / ((y - z) * t);
	else
		tmp = (x_m / t) / (y - z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[t, -9e-151], N[(N[(x$95$m / y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 0.004], N[(N[(x$95$m / z), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.2e+151], N[(x$95$m / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-151}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{t - z}\\

\mathbf{elif}\;t \leq 0.004:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{z - y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -9.0000000000000005e-151

    1. Initial program 86.9%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 52.2%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(t - z\right)}} \]
    4. Step-by-step derivation
      1. associate-/r*52.1%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{t - z}} \]
    5. Simplified52.1%

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

    if -9.0000000000000005e-151 < t < 0.0040000000000000001

    1. Initial program 87.6%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 76.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{z \cdot \left(y - z\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg76.5%

        \[\leadsto \color{blue}{-\frac{x}{z \cdot \left(y - z\right)}} \]
      2. associate-/r*87.1%

        \[\leadsto -\color{blue}{\frac{\frac{x}{z}}{y - z}} \]
      3. distribute-neg-frac287.1%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{-\left(y - z\right)}} \]
      4. neg-sub087.1%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{0 - \left(y - z\right)}} \]
      5. sub-neg87.1%

        \[\leadsto \frac{\frac{x}{z}}{0 - \color{blue}{\left(y + \left(-z\right)\right)}} \]
      6. +-commutative87.1%

        \[\leadsto \frac{\frac{x}{z}}{0 - \color{blue}{\left(\left(-z\right) + y\right)}} \]
      7. associate--r+87.1%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(0 - \left(-z\right)\right) - y}} \]
      8. neg-sub087.1%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(-\left(-z\right)\right)} - y} \]
      9. remove-double-neg87.1%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z} - y} \]
    5. Simplified87.1%

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

    if 0.0040000000000000001 < t < 3.19999999999999994e151

    1. Initial program 96.2%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 83.6%

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

    if 3.19999999999999994e151 < t

    1. Initial program 70.0%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Step-by-step derivation
      1. associate-/l/97.1%

        \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    3. Simplified97.1%

      \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 91.8%

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

Alternative 6: 82.7% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -1.12 \cdot 10^{+190}:\\ \;\;\;\;\frac{\frac{x\_m}{y}}{t - z}\\ \mathbf{elif}\;y \leq -2.8 \cdot 10^{-17}:\\ \;\;\;\;\frac{x\_m}{y \cdot \left(t - z\right)}\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{-18}:\\ \;\;\;\;\frac{\frac{x\_m}{z}}{z - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x\_m}{t}}{y - z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= y -1.12e+190)
    (/ (/ x_m y) (- t z))
    (if (<= y -2.8e-17)
      (/ x_m (* y (- t z)))
      (if (<= y 7.5e-18) (/ (/ x_m z) (- z t)) (/ (/ x_m t) (- y z)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (y <= -1.12e+190) {
		tmp = (x_m / y) / (t - z);
	} else if (y <= -2.8e-17) {
		tmp = x_m / (y * (t - z));
	} else if (y <= 7.5e-18) {
		tmp = (x_m / z) / (z - t);
	} else {
		tmp = (x_m / t) / (y - z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (y <= (-1.12d+190)) then
        tmp = (x_m / y) / (t - z)
    else if (y <= (-2.8d-17)) then
        tmp = x_m / (y * (t - z))
    else if (y <= 7.5d-18) then
        tmp = (x_m / z) / (z - t)
    else
        tmp = (x_m / t) / (y - z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (y <= -1.12e+190) {
		tmp = (x_m / y) / (t - z);
	} else if (y <= -2.8e-17) {
		tmp = x_m / (y * (t - z));
	} else if (y <= 7.5e-18) {
		tmp = (x_m / z) / (z - t);
	} else {
		tmp = (x_m / t) / (y - z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if y <= -1.12e+190:
		tmp = (x_m / y) / (t - z)
	elif y <= -2.8e-17:
		tmp = x_m / (y * (t - z))
	elif y <= 7.5e-18:
		tmp = (x_m / z) / (z - t)
	else:
		tmp = (x_m / t) / (y - z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (y <= -1.12e+190)
		tmp = Float64(Float64(x_m / y) / Float64(t - z));
	elseif (y <= -2.8e-17)
		tmp = Float64(x_m / Float64(y * Float64(t - z)));
	elseif (y <= 7.5e-18)
		tmp = Float64(Float64(x_m / z) / Float64(z - t));
	else
		tmp = Float64(Float64(x_m / t) / Float64(y - z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (y <= -1.12e+190)
		tmp = (x_m / y) / (t - z);
	elseif (y <= -2.8e-17)
		tmp = x_m / (y * (t - z));
	elseif (y <= 7.5e-18)
		tmp = (x_m / z) / (z - t);
	else
		tmp = (x_m / t) / (y - z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -1.12e+190], N[(N[(x$95$m / y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.8e-17], N[(x$95$m / N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e-18], N[(N[(x$95$m / z), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.12 \cdot 10^{+190}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{t - z}\\

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

\mathbf{elif}\;y \leq 7.5 \cdot 10^{-18}:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{z - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.12000000000000003e190

    1. Initial program 77.3%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 77.3%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(t - z\right)}} \]
    4. Step-by-step derivation
      1. associate-/r*93.3%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{t - z}} \]
    5. Simplified93.3%

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

    if -1.12000000000000003e190 < y < -2.7999999999999999e-17

    1. Initial program 91.8%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num91.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(y - z\right) \cdot \left(t - z\right)}{x}}} \]
      2. associate-/r/91.7%

        \[\leadsto \color{blue}{\frac{1}{\left(y - z\right) \cdot \left(t - z\right)} \cdot x} \]
    4. Applied egg-rr91.7%

      \[\leadsto \color{blue}{\frac{1}{\left(y - z\right) \cdot \left(t - z\right)} \cdot x} \]
    5. Step-by-step derivation
      1. associate-*l/91.8%

        \[\leadsto \color{blue}{\frac{1 \cdot x}{\left(y - z\right) \cdot \left(t - z\right)}} \]
      2. times-frac94.3%

        \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}} \]
      3. *-commutative94.3%

        \[\leadsto \color{blue}{\frac{x}{t - z} \cdot \frac{1}{y - z}} \]
      4. clear-num94.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{t - z}{x}}} \cdot \frac{1}{y - z} \]
      5. associate-*l/95.4%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{1}{y - z}}{\frac{t - z}{x}}} \]
      6. *-un-lft-identity95.4%

        \[\leadsto \frac{\color{blue}{\frac{1}{y - z}}}{\frac{t - z}{x}} \]
    6. Applied egg-rr95.4%

      \[\leadsto \color{blue}{\frac{\frac{1}{y - z}}{\frac{t - z}{x}}} \]
    7. Taylor expanded in y around inf 89.0%

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

    if -2.7999999999999999e-17 < y < 7.50000000000000015e-18

    1. Initial program 88.7%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 76.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{z \cdot \left(t - z\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg76.2%

        \[\leadsto \color{blue}{-\frac{x}{z \cdot \left(t - z\right)}} \]
      2. associate-/r*84.1%

        \[\leadsto -\color{blue}{\frac{\frac{x}{z}}{t - z}} \]
      3. distribute-neg-frac284.1%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{-\left(t - z\right)}} \]
      4. sub-neg84.1%

        \[\leadsto \frac{\frac{x}{z}}{-\color{blue}{\left(t + \left(-z\right)\right)}} \]
      5. +-commutative84.1%

        \[\leadsto \frac{\frac{x}{z}}{-\color{blue}{\left(\left(-z\right) + t\right)}} \]
      6. distribute-neg-in84.1%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(-\left(-z\right)\right) + \left(-t\right)}} \]
      7. remove-double-neg84.1%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z} + \left(-t\right)} \]
      8. unsub-neg84.1%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z - t}} \]
    5. Simplified84.1%

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

    if 7.50000000000000015e-18 < y

    1. Initial program 81.8%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Step-by-step derivation
      1. associate-/l/97.3%

        \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    3. Simplified97.3%

      \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 47.3%

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

Alternative 7: 79.6% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq -1.4 \cdot 10^{-250}:\\ \;\;\;\;\frac{\frac{x\_m}{y}}{t - z}\\ \mathbf{elif}\;t \leq 0.0012:\\ \;\;\;\;\frac{x\_m}{z \cdot \left(z - y\right)}\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{+149}:\\ \;\;\;\;\frac{x\_m}{\left(y - z\right) \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x\_m}{t}}{y - z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= t -1.4e-250)
    (/ (/ x_m y) (- t z))
    (if (<= t 0.0012)
      (/ x_m (* z (- z y)))
      (if (<= t 5.2e+149) (/ x_m (* (- y z) t)) (/ (/ x_m t) (- y z)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (t <= -1.4e-250) {
		tmp = (x_m / y) / (t - z);
	} else if (t <= 0.0012) {
		tmp = x_m / (z * (z - y));
	} else if (t <= 5.2e+149) {
		tmp = x_m / ((y - z) * t);
	} else {
		tmp = (x_m / t) / (y - z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-1.4d-250)) then
        tmp = (x_m / y) / (t - z)
    else if (t <= 0.0012d0) then
        tmp = x_m / (z * (z - y))
    else if (t <= 5.2d+149) then
        tmp = x_m / ((y - z) * t)
    else
        tmp = (x_m / t) / (y - z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (t <= -1.4e-250) {
		tmp = (x_m / y) / (t - z);
	} else if (t <= 0.0012) {
		tmp = x_m / (z * (z - y));
	} else if (t <= 5.2e+149) {
		tmp = x_m / ((y - z) * t);
	} else {
		tmp = (x_m / t) / (y - z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if t <= -1.4e-250:
		tmp = (x_m / y) / (t - z)
	elif t <= 0.0012:
		tmp = x_m / (z * (z - y))
	elif t <= 5.2e+149:
		tmp = x_m / ((y - z) * t)
	else:
		tmp = (x_m / t) / (y - z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (t <= -1.4e-250)
		tmp = Float64(Float64(x_m / y) / Float64(t - z));
	elseif (t <= 0.0012)
		tmp = Float64(x_m / Float64(z * Float64(z - y)));
	elseif (t <= 5.2e+149)
		tmp = Float64(x_m / Float64(Float64(y - z) * t));
	else
		tmp = Float64(Float64(x_m / t) / Float64(y - z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (t <= -1.4e-250)
		tmp = (x_m / y) / (t - z);
	elseif (t <= 0.0012)
		tmp = x_m / (z * (z - y));
	elseif (t <= 5.2e+149)
		tmp = x_m / ((y - z) * t);
	else
		tmp = (x_m / t) / (y - z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[t, -1.4e-250], N[(N[(x$95$m / y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 0.0012], N[(x$95$m / N[(z * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.2e+149], N[(x$95$m / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-250}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{t - z}\\

\mathbf{elif}\;t \leq 0.0012:\\
\;\;\;\;\frac{x\_m}{z \cdot \left(z - y\right)}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -1.40000000000000014e-250

    1. Initial program 86.2%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 51.9%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(t - z\right)}} \]
    4. Step-by-step derivation
      1. associate-/r*51.8%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{t - z}} \]
    5. Simplified51.8%

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

    if -1.40000000000000014e-250 < t < 0.00119999999999999989

    1. Initial program 88.4%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 78.4%

      \[\leadsto \frac{x}{\color{blue}{-1 \cdot \left(z \cdot \left(y - z\right)\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg78.4%

        \[\leadsto \frac{x}{\color{blue}{-z \cdot \left(y - z\right)}} \]
      2. distribute-rgt-neg-in78.4%

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

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(0 - \left(y - z\right)\right)}} \]
      4. sub-neg78.4%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(y + \left(-z\right)\right)}\right)} \]
      5. +-commutative78.4%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right)} \]
      6. associate--r+78.4%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)}} \]
      7. neg-sub078.4%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right)} \]
      8. remove-double-neg78.4%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{z} - y\right)} \]
    5. Simplified78.4%

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

    if 0.00119999999999999989 < t < 5.19999999999999957e149

    1. Initial program 96.2%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 83.6%

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

    if 5.19999999999999957e149 < t

    1. Initial program 70.0%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Step-by-step derivation
      1. associate-/l/97.1%

        \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    3. Simplified97.1%

      \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 91.8%

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

Alternative 8: 79.3% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq -1.15 \cdot 10^{-209}:\\ \;\;\;\;\frac{x\_m}{y \cdot \left(t - z\right)}\\ \mathbf{elif}\;t \leq 0.0039:\\ \;\;\;\;\frac{x\_m}{z \cdot \left(z - y\right)}\\ \mathbf{elif}\;t \leq 7.3 \cdot 10^{+149}:\\ \;\;\;\;\frac{x\_m}{\left(y - z\right) \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x\_m}{t}}{y - z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= t -1.15e-209)
    (/ x_m (* y (- t z)))
    (if (<= t 0.0039)
      (/ x_m (* z (- z y)))
      (if (<= t 7.3e+149) (/ x_m (* (- y z) t)) (/ (/ x_m t) (- y z)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (t <= -1.15e-209) {
		tmp = x_m / (y * (t - z));
	} else if (t <= 0.0039) {
		tmp = x_m / (z * (z - y));
	} else if (t <= 7.3e+149) {
		tmp = x_m / ((y - z) * t);
	} else {
		tmp = (x_m / t) / (y - z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-1.15d-209)) then
        tmp = x_m / (y * (t - z))
    else if (t <= 0.0039d0) then
        tmp = x_m / (z * (z - y))
    else if (t <= 7.3d+149) then
        tmp = x_m / ((y - z) * t)
    else
        tmp = (x_m / t) / (y - z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (t <= -1.15e-209) {
		tmp = x_m / (y * (t - z));
	} else if (t <= 0.0039) {
		tmp = x_m / (z * (z - y));
	} else if (t <= 7.3e+149) {
		tmp = x_m / ((y - z) * t);
	} else {
		tmp = (x_m / t) / (y - z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if t <= -1.15e-209:
		tmp = x_m / (y * (t - z))
	elif t <= 0.0039:
		tmp = x_m / (z * (z - y))
	elif t <= 7.3e+149:
		tmp = x_m / ((y - z) * t)
	else:
		tmp = (x_m / t) / (y - z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (t <= -1.15e-209)
		tmp = Float64(x_m / Float64(y * Float64(t - z)));
	elseif (t <= 0.0039)
		tmp = Float64(x_m / Float64(z * Float64(z - y)));
	elseif (t <= 7.3e+149)
		tmp = Float64(x_m / Float64(Float64(y - z) * t));
	else
		tmp = Float64(Float64(x_m / t) / Float64(y - z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (t <= -1.15e-209)
		tmp = x_m / (y * (t - z));
	elseif (t <= 0.0039)
		tmp = x_m / (z * (z - y));
	elseif (t <= 7.3e+149)
		tmp = x_m / ((y - z) * t);
	else
		tmp = (x_m / t) / (y - z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[t, -1.15e-209], N[(x$95$m / N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 0.0039], N[(x$95$m / N[(z * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.3e+149], N[(x$95$m / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.15 \cdot 10^{-209}:\\
\;\;\;\;\frac{x\_m}{y \cdot \left(t - z\right)}\\

\mathbf{elif}\;t \leq 0.0039:\\
\;\;\;\;\frac{x\_m}{z \cdot \left(z - y\right)}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -1.15e-209

    1. Initial program 87.4%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num87.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(y - z\right) \cdot \left(t - z\right)}{x}}} \]
      2. associate-/r/87.3%

        \[\leadsto \color{blue}{\frac{1}{\left(y - z\right) \cdot \left(t - z\right)} \cdot x} \]
    4. Applied egg-rr87.3%

      \[\leadsto \color{blue}{\frac{1}{\left(y - z\right) \cdot \left(t - z\right)} \cdot x} \]
    5. Step-by-step derivation
      1. associate-*l/87.4%

        \[\leadsto \color{blue}{\frac{1 \cdot x}{\left(y - z\right) \cdot \left(t - z\right)}} \]
      2. times-frac95.8%

        \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}} \]
      3. *-commutative95.8%

        \[\leadsto \color{blue}{\frac{x}{t - z} \cdot \frac{1}{y - z}} \]
      4. clear-num95.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{t - z}{x}}} \cdot \frac{1}{y - z} \]
      5. associate-*l/96.2%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{1}{y - z}}{\frac{t - z}{x}}} \]
      6. *-un-lft-identity96.2%

        \[\leadsto \frac{\color{blue}{\frac{1}{y - z}}}{\frac{t - z}{x}} \]
    6. Applied egg-rr96.2%

      \[\leadsto \color{blue}{\frac{\frac{1}{y - z}}{\frac{t - z}{x}}} \]
    7. Taylor expanded in y around inf 53.0%

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

    if -1.15e-209 < t < 0.0038999999999999998

    1. Initial program 87.2%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 77.8%

      \[\leadsto \frac{x}{\color{blue}{-1 \cdot \left(z \cdot \left(y - z\right)\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg77.8%

        \[\leadsto \frac{x}{\color{blue}{-z \cdot \left(y - z\right)}} \]
      2. distribute-rgt-neg-in77.8%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-\left(y - z\right)\right)}} \]
      3. neg-sub077.8%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(0 - \left(y - z\right)\right)}} \]
      4. sub-neg77.8%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(y + \left(-z\right)\right)}\right)} \]
      5. +-commutative77.8%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right)} \]
      6. associate--r+77.8%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)}} \]
      7. neg-sub077.8%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right)} \]
      8. remove-double-neg77.8%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{z} - y\right)} \]
    5. Simplified77.8%

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

    if 0.0038999999999999998 < t < 7.2999999999999997e149

    1. Initial program 96.2%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 83.6%

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

    if 7.2999999999999997e149 < t

    1. Initial program 70.0%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Step-by-step derivation
      1. associate-/l/97.1%

        \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    3. Simplified97.1%

      \[\leadsto \color{blue}{\frac{\frac{x}{t - z}}{y - z}} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 91.8%

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

Alternative 9: 74.3% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{x\_m}{z}}{z}\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{-43}:\\ \;\;\;\;\frac{x\_m}{z \cdot \left(z - y\right)}\\ \mathbf{elif}\;z \leq 4 \cdot 10^{+120}:\\ \;\;\;\;\frac{x\_m}{y \cdot \left(t - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{z} \cdot \frac{1}{z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= z -1.35e+154)
    (/ (/ x_m z) z)
    (if (<= z -1.5e-43)
      (/ x_m (* z (- z y)))
      (if (<= z 4e+120) (/ x_m (* y (- t z))) (* (/ x_m z) (/ 1.0 z)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (z <= -1.35e+154) {
		tmp = (x_m / z) / z;
	} else if (z <= -1.5e-43) {
		tmp = x_m / (z * (z - y));
	} else if (z <= 4e+120) {
		tmp = x_m / (y * (t - z));
	} else {
		tmp = (x_m / z) * (1.0 / z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (z <= (-1.35d+154)) then
        tmp = (x_m / z) / z
    else if (z <= (-1.5d-43)) then
        tmp = x_m / (z * (z - y))
    else if (z <= 4d+120) then
        tmp = x_m / (y * (t - z))
    else
        tmp = (x_m / z) * (1.0d0 / z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (z <= -1.35e+154) {
		tmp = (x_m / z) / z;
	} else if (z <= -1.5e-43) {
		tmp = x_m / (z * (z - y));
	} else if (z <= 4e+120) {
		tmp = x_m / (y * (t - z));
	} else {
		tmp = (x_m / z) * (1.0 / z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if z <= -1.35e+154:
		tmp = (x_m / z) / z
	elif z <= -1.5e-43:
		tmp = x_m / (z * (z - y))
	elif z <= 4e+120:
		tmp = x_m / (y * (t - z))
	else:
		tmp = (x_m / z) * (1.0 / z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (z <= -1.35e+154)
		tmp = Float64(Float64(x_m / z) / z);
	elseif (z <= -1.5e-43)
		tmp = Float64(x_m / Float64(z * Float64(z - y)));
	elseif (z <= 4e+120)
		tmp = Float64(x_m / Float64(y * Float64(t - z)));
	else
		tmp = Float64(Float64(x_m / z) * Float64(1.0 / z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (z <= -1.35e+154)
		tmp = (x_m / z) / z;
	elseif (z <= -1.5e-43)
		tmp = x_m / (z * (z - y));
	elseif (z <= 4e+120)
		tmp = x_m / (y * (t - z));
	else
		tmp = (x_m / z) * (1.0 / z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -1.35e+154], N[(N[(x$95$m / z), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, -1.5e-43], N[(x$95$m / N[(z * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4e+120], N[(x$95$m / N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{z}\\

\mathbf{elif}\;z \leq -1.5 \cdot 10^{-43}:\\
\;\;\;\;\frac{x\_m}{z \cdot \left(z - y\right)}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{1}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.35000000000000003e154

    1. Initial program 68.6%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 68.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{z \cdot \left(y - z\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg68.6%

        \[\leadsto \color{blue}{-\frac{x}{z \cdot \left(y - z\right)}} \]
      2. associate-/r*96.9%

        \[\leadsto -\color{blue}{\frac{\frac{x}{z}}{y - z}} \]
      3. distribute-neg-frac296.9%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{-\left(y - z\right)}} \]
      4. neg-sub096.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{0 - \left(y - z\right)}} \]
      5. sub-neg96.9%

        \[\leadsto \frac{\frac{x}{z}}{0 - \color{blue}{\left(y + \left(-z\right)\right)}} \]
      6. +-commutative96.9%

        \[\leadsto \frac{\frac{x}{z}}{0 - \color{blue}{\left(\left(-z\right) + y\right)}} \]
      7. associate--r+96.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(0 - \left(-z\right)\right) - y}} \]
      8. neg-sub096.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(-\left(-z\right)\right)} - y} \]
      9. remove-double-neg96.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z} - y} \]
    5. Simplified96.9%

      \[\leadsto \color{blue}{\frac{\frac{x}{z}}{z - y}} \]
    6. Taylor expanded in z around inf 92.1%

      \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z}} \]

    if -1.35000000000000003e154 < z < -1.50000000000000002e-43

    1. Initial program 92.3%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 70.4%

      \[\leadsto \frac{x}{\color{blue}{-1 \cdot \left(z \cdot \left(y - z\right)\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg70.4%

        \[\leadsto \frac{x}{\color{blue}{-z \cdot \left(y - z\right)}} \]
      2. distribute-rgt-neg-in70.4%

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

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(0 - \left(y - z\right)\right)}} \]
      4. sub-neg70.4%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(y + \left(-z\right)\right)}\right)} \]
      5. +-commutative70.4%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right)} \]
      6. associate--r+70.4%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)}} \]
      7. neg-sub070.4%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right)} \]
      8. remove-double-neg70.4%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{z} - y\right)} \]
    5. Simplified70.4%

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

    if -1.50000000000000002e-43 < z < 3.9999999999999999e120

    1. Initial program 92.1%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num91.1%

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(y - z\right) \cdot \left(t - z\right)}{x}}} \]
      2. associate-/r/91.9%

        \[\leadsto \color{blue}{\frac{1}{\left(y - z\right) \cdot \left(t - z\right)} \cdot x} \]
    4. Applied egg-rr91.9%

      \[\leadsto \color{blue}{\frac{1}{\left(y - z\right) \cdot \left(t - z\right)} \cdot x} \]
    5. Step-by-step derivation
      1. associate-*l/92.1%

        \[\leadsto \color{blue}{\frac{1 \cdot x}{\left(y - z\right) \cdot \left(t - z\right)}} \]
      2. times-frac93.4%

        \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}} \]
      3. *-commutative93.4%

        \[\leadsto \color{blue}{\frac{x}{t - z} \cdot \frac{1}{y - z}} \]
      4. clear-num93.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{t - z}{x}}} \cdot \frac{1}{y - z} \]
      5. associate-*l/93.2%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{1}{y - z}}{\frac{t - z}{x}}} \]
      6. *-un-lft-identity93.2%

        \[\leadsto \frac{\color{blue}{\frac{1}{y - z}}}{\frac{t - z}{x}} \]
    6. Applied egg-rr93.2%

      \[\leadsto \color{blue}{\frac{\frac{1}{y - z}}{\frac{t - z}{x}}} \]
    7. Taylor expanded in y around inf 76.9%

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

    if 3.9999999999999999e120 < z

    1. Initial program 69.5%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 69.3%

      \[\leadsto \frac{x}{\color{blue}{-1 \cdot \left(z \cdot \left(y - z\right)\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg69.3%

        \[\leadsto \frac{x}{\color{blue}{-z \cdot \left(y - z\right)}} \]
      2. distribute-rgt-neg-in69.3%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-\left(y - z\right)\right)}} \]
      3. neg-sub069.3%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(0 - \left(y - z\right)\right)}} \]
      4. sub-neg69.3%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(y + \left(-z\right)\right)}\right)} \]
      5. +-commutative69.3%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right)} \]
      6. associate--r+69.3%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)}} \]
      7. neg-sub069.3%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right)} \]
      8. remove-double-neg69.3%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{z} - y\right)} \]
    5. Simplified69.3%

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

      \[\leadsto \frac{x}{z \cdot \color{blue}{z}} \]
    7. Step-by-step derivation
      1. associate-/r*87.8%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{z}} \]
      2. div-inv87.9%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{1}{z}} \]
    8. Applied egg-rr87.9%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{1}{z}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 10: 66.1% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -12000000:\\ \;\;\;\;\frac{\frac{x\_m}{z}}{z}\\ \mathbf{elif}\;z \leq 2.06 \cdot 10^{+21}:\\ \;\;\;\;\frac{\frac{x\_m}{y}}{t}\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{+120}:\\ \;\;\;\;\frac{\frac{x\_m}{z}}{-t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{z} \cdot \frac{1}{z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= z -12000000.0)
    (/ (/ x_m z) z)
    (if (<= z 2.06e+21)
      (/ (/ x_m y) t)
      (if (<= z 4.3e+120) (/ (/ x_m z) (- t)) (* (/ x_m z) (/ 1.0 z)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (z <= -12000000.0) {
		tmp = (x_m / z) / z;
	} else if (z <= 2.06e+21) {
		tmp = (x_m / y) / t;
	} else if (z <= 4.3e+120) {
		tmp = (x_m / z) / -t;
	} else {
		tmp = (x_m / z) * (1.0 / z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (z <= (-12000000.0d0)) then
        tmp = (x_m / z) / z
    else if (z <= 2.06d+21) then
        tmp = (x_m / y) / t
    else if (z <= 4.3d+120) then
        tmp = (x_m / z) / -t
    else
        tmp = (x_m / z) * (1.0d0 / z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (z <= -12000000.0) {
		tmp = (x_m / z) / z;
	} else if (z <= 2.06e+21) {
		tmp = (x_m / y) / t;
	} else if (z <= 4.3e+120) {
		tmp = (x_m / z) / -t;
	} else {
		tmp = (x_m / z) * (1.0 / z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if z <= -12000000.0:
		tmp = (x_m / z) / z
	elif z <= 2.06e+21:
		tmp = (x_m / y) / t
	elif z <= 4.3e+120:
		tmp = (x_m / z) / -t
	else:
		tmp = (x_m / z) * (1.0 / z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (z <= -12000000.0)
		tmp = Float64(Float64(x_m / z) / z);
	elseif (z <= 2.06e+21)
		tmp = Float64(Float64(x_m / y) / t);
	elseif (z <= 4.3e+120)
		tmp = Float64(Float64(x_m / z) / Float64(-t));
	else
		tmp = Float64(Float64(x_m / z) * Float64(1.0 / z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (z <= -12000000.0)
		tmp = (x_m / z) / z;
	elseif (z <= 2.06e+21)
		tmp = (x_m / y) / t;
	elseif (z <= 4.3e+120)
		tmp = (x_m / z) / -t;
	else
		tmp = (x_m / z) * (1.0 / z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -12000000.0], N[(N[(x$95$m / z), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 2.06e+21], N[(N[(x$95$m / y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 4.3e+120], N[(N[(x$95$m / z), $MachinePrecision] / (-t)), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -12000000:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{z}\\

\mathbf{elif}\;z \leq 2.06 \cdot 10^{+21}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{t}\\

\mathbf{elif}\;z \leq 4.3 \cdot 10^{+120}:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{-t}\\

\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{1}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.2e7

    1. Initial program 82.3%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 71.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{z \cdot \left(y - z\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg71.9%

        \[\leadsto \color{blue}{-\frac{x}{z \cdot \left(y - z\right)}} \]
      2. associate-/r*85.4%

        \[\leadsto -\color{blue}{\frac{\frac{x}{z}}{y - z}} \]
      3. distribute-neg-frac285.4%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{-\left(y - z\right)}} \]
      4. neg-sub085.4%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{0 - \left(y - z\right)}} \]
      5. sub-neg85.4%

        \[\leadsto \frac{\frac{x}{z}}{0 - \color{blue}{\left(y + \left(-z\right)\right)}} \]
      6. +-commutative85.4%

        \[\leadsto \frac{\frac{x}{z}}{0 - \color{blue}{\left(\left(-z\right) + y\right)}} \]
      7. associate--r+85.4%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(0 - \left(-z\right)\right) - y}} \]
      8. neg-sub085.4%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(-\left(-z\right)\right)} - y} \]
      9. remove-double-neg85.4%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z} - y} \]
    5. Simplified85.4%

      \[\leadsto \color{blue}{\frac{\frac{x}{z}}{z - y}} \]
    6. Taylor expanded in z around inf 78.0%

      \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z}} \]

    if -1.2e7 < z < 2.06e21

    1. Initial program 94.6%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 77.1%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(t - z\right)}} \]
    4. Step-by-step derivation
      1. associate-/r*79.2%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{t - z}} \]
    5. Simplified79.2%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{t - z}} \]
    6. Taylor expanded in t around inf 60.3%

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

    if 2.06e21 < z < 4.3000000000000002e120

    1. Initial program 74.5%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 39.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{z \cdot \left(t - z\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg39.7%

        \[\leadsto \color{blue}{-\frac{x}{z \cdot \left(t - z\right)}} \]
      2. associate-/r*39.9%

        \[\leadsto -\color{blue}{\frac{\frac{x}{z}}{t - z}} \]
      3. distribute-neg-frac239.9%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{-\left(t - z\right)}} \]
      4. sub-neg39.9%

        \[\leadsto \frac{\frac{x}{z}}{-\color{blue}{\left(t + \left(-z\right)\right)}} \]
      5. +-commutative39.9%

        \[\leadsto \frac{\frac{x}{z}}{-\color{blue}{\left(\left(-z\right) + t\right)}} \]
      6. distribute-neg-in39.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(-\left(-z\right)\right) + \left(-t\right)}} \]
      7. remove-double-neg39.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z} + \left(-t\right)} \]
      8. unsub-neg39.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z - t}} \]
    5. Simplified39.9%

      \[\leadsto \color{blue}{\frac{\frac{x}{z}}{z - t}} \]
    6. Taylor expanded in z around 0 34.3%

      \[\leadsto \frac{\frac{x}{z}}{\color{blue}{-1 \cdot t}} \]
    7. Step-by-step derivation
      1. neg-mul-134.3%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{-t}} \]
    8. Simplified34.3%

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

    if 4.3000000000000002e120 < z

    1. Initial program 69.5%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 69.3%

      \[\leadsto \frac{x}{\color{blue}{-1 \cdot \left(z \cdot \left(y - z\right)\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg69.3%

        \[\leadsto \frac{x}{\color{blue}{-z \cdot \left(y - z\right)}} \]
      2. distribute-rgt-neg-in69.3%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-\left(y - z\right)\right)}} \]
      3. neg-sub069.3%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(0 - \left(y - z\right)\right)}} \]
      4. sub-neg69.3%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(y + \left(-z\right)\right)}\right)} \]
      5. +-commutative69.3%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right)} \]
      6. associate--r+69.3%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)}} \]
      7. neg-sub069.3%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right)} \]
      8. remove-double-neg69.3%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{z} - y\right)} \]
    5. Simplified69.3%

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

      \[\leadsto \frac{x}{z \cdot \color{blue}{z}} \]
    7. Step-by-step derivation
      1. associate-/r*87.8%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{z}} \]
      2. div-inv87.9%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{1}{z}} \]
    8. Applied egg-rr87.9%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{1}{z}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 11: 66.1% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ \begin{array}{l} t_1 := \frac{\frac{x\_m}{z}}{z}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -3700000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 3.25 \cdot 10^{+19}:\\ \;\;\;\;\frac{\frac{x\_m}{y}}{t}\\ \mathbf{elif}\;z \leq 4 \cdot 10^{+120}:\\ \;\;\;\;\frac{\frac{x\_m}{z}}{-t}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (let* ((t_1 (/ (/ x_m z) z)))
   (*
    x_s
    (if (<= z -3700000.0)
      t_1
      (if (<= z 3.25e+19)
        (/ (/ x_m y) t)
        (if (<= z 4e+120) (/ (/ x_m z) (- t)) t_1))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = (x_m / z) / z;
	double tmp;
	if (z <= -3700000.0) {
		tmp = t_1;
	} else if (z <= 3.25e+19) {
		tmp = (x_m / y) / t;
	} else if (z <= 4e+120) {
		tmp = (x_m / z) / -t;
	} else {
		tmp = t_1;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (x_m / z) / z
    if (z <= (-3700000.0d0)) then
        tmp = t_1
    else if (z <= 3.25d+19) then
        tmp = (x_m / y) / t
    else if (z <= 4d+120) then
        tmp = (x_m / z) / -t
    else
        tmp = t_1
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = (x_m / z) / z;
	double tmp;
	if (z <= -3700000.0) {
		tmp = t_1;
	} else if (z <= 3.25e+19) {
		tmp = (x_m / y) / t;
	} else if (z <= 4e+120) {
		tmp = (x_m / z) / -t;
	} else {
		tmp = t_1;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	t_1 = (x_m / z) / z
	tmp = 0
	if z <= -3700000.0:
		tmp = t_1
	elif z <= 3.25e+19:
		tmp = (x_m / y) / t
	elif z <= 4e+120:
		tmp = (x_m / z) / -t
	else:
		tmp = t_1
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	t_1 = Float64(Float64(x_m / z) / z)
	tmp = 0.0
	if (z <= -3700000.0)
		tmp = t_1;
	elseif (z <= 3.25e+19)
		tmp = Float64(Float64(x_m / y) / t);
	elseif (z <= 4e+120)
		tmp = Float64(Float64(x_m / z) / Float64(-t));
	else
		tmp = t_1;
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	t_1 = (x_m / z) / z;
	tmp = 0.0;
	if (z <= -3700000.0)
		tmp = t_1;
	elseif (z <= 3.25e+19)
		tmp = (x_m / y) / t;
	elseif (z <= 4e+120)
		tmp = (x_m / z) / -t;
	else
		tmp = t_1;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m / z), $MachinePrecision] / z), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -3700000.0], t$95$1, If[LessEqual[z, 3.25e+19], N[(N[(x$95$m / y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 4e+120], N[(N[(x$95$m / z), $MachinePrecision] / (-t)), $MachinePrecision], t$95$1]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{\frac{x\_m}{z}}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3700000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 3.25 \cdot 10^{+19}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{t}\\

\mathbf{elif}\;z \leq 4 \cdot 10^{+120}:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{-t}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.7e6 or 3.9999999999999999e120 < z

    1. Initial program 77.6%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 71.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{z \cdot \left(y - z\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg71.0%

        \[\leadsto \color{blue}{-\frac{x}{z \cdot \left(y - z\right)}} \]
      2. associate-/r*88.0%

        \[\leadsto -\color{blue}{\frac{\frac{x}{z}}{y - z}} \]
      3. distribute-neg-frac288.0%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{-\left(y - z\right)}} \]
      4. neg-sub088.0%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{0 - \left(y - z\right)}} \]
      5. sub-neg88.0%

        \[\leadsto \frac{\frac{x}{z}}{0 - \color{blue}{\left(y + \left(-z\right)\right)}} \]
      6. +-commutative88.0%

        \[\leadsto \frac{\frac{x}{z}}{0 - \color{blue}{\left(\left(-z\right) + y\right)}} \]
      7. associate--r+88.0%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(0 - \left(-z\right)\right) - y}} \]
      8. neg-sub088.0%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(-\left(-z\right)\right)} - y} \]
      9. remove-double-neg88.0%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z} - y} \]
    5. Simplified88.0%

      \[\leadsto \color{blue}{\frac{\frac{x}{z}}{z - y}} \]
    6. Taylor expanded in z around inf 81.6%

      \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z}} \]

    if -3.7e6 < z < 3.25e19

    1. Initial program 94.6%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 77.1%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(t - z\right)}} \]
    4. Step-by-step derivation
      1. associate-/r*79.2%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{t - z}} \]
    5. Simplified79.2%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{t - z}} \]
    6. Taylor expanded in t around inf 60.3%

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

    if 3.25e19 < z < 3.9999999999999999e120

    1. Initial program 74.5%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 39.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{z \cdot \left(t - z\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg39.7%

        \[\leadsto \color{blue}{-\frac{x}{z \cdot \left(t - z\right)}} \]
      2. associate-/r*39.9%

        \[\leadsto -\color{blue}{\frac{\frac{x}{z}}{t - z}} \]
      3. distribute-neg-frac239.9%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{-\left(t - z\right)}} \]
      4. sub-neg39.9%

        \[\leadsto \frac{\frac{x}{z}}{-\color{blue}{\left(t + \left(-z\right)\right)}} \]
      5. +-commutative39.9%

        \[\leadsto \frac{\frac{x}{z}}{-\color{blue}{\left(\left(-z\right) + t\right)}} \]
      6. distribute-neg-in39.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(-\left(-z\right)\right) + \left(-t\right)}} \]
      7. remove-double-neg39.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z} + \left(-t\right)} \]
      8. unsub-neg39.9%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z - t}} \]
    5. Simplified39.9%

      \[\leadsto \color{blue}{\frac{\frac{x}{z}}{z - t}} \]
    6. Taylor expanded in z around 0 34.3%

      \[\leadsto \frac{\frac{x}{z}}{\color{blue}{-1 \cdot t}} \]
    7. Step-by-step derivation
      1. neg-mul-134.3%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{-t}} \]
    8. Simplified34.3%

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

Alternative 12: 77.3% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq -1.12 \cdot 10^{-209}:\\ \;\;\;\;\frac{x\_m}{y \cdot \left(t - z\right)}\\ \mathbf{elif}\;t \leq 0.0019:\\ \;\;\;\;\frac{x\_m}{z \cdot \left(z - y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{\left(y - z\right) \cdot t}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= t -1.12e-209)
    (/ x_m (* y (- t z)))
    (if (<= t 0.0019) (/ x_m (* z (- z y))) (/ x_m (* (- y z) t))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (t <= -1.12e-209) {
		tmp = x_m / (y * (t - z));
	} else if (t <= 0.0019) {
		tmp = x_m / (z * (z - y));
	} else {
		tmp = x_m / ((y - z) * t);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-1.12d-209)) then
        tmp = x_m / (y * (t - z))
    else if (t <= 0.0019d0) then
        tmp = x_m / (z * (z - y))
    else
        tmp = x_m / ((y - z) * t)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (t <= -1.12e-209) {
		tmp = x_m / (y * (t - z));
	} else if (t <= 0.0019) {
		tmp = x_m / (z * (z - y));
	} else {
		tmp = x_m / ((y - z) * t);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if t <= -1.12e-209:
		tmp = x_m / (y * (t - z))
	elif t <= 0.0019:
		tmp = x_m / (z * (z - y))
	else:
		tmp = x_m / ((y - z) * t)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (t <= -1.12e-209)
		tmp = Float64(x_m / Float64(y * Float64(t - z)));
	elseif (t <= 0.0019)
		tmp = Float64(x_m / Float64(z * Float64(z - y)));
	else
		tmp = Float64(x_m / Float64(Float64(y - z) * t));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (t <= -1.12e-209)
		tmp = x_m / (y * (t - z));
	elseif (t <= 0.0019)
		tmp = x_m / (z * (z - y));
	else
		tmp = x_m / ((y - z) * t);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[t, -1.12e-209], N[(x$95$m / N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 0.0019], N[(x$95$m / N[(z * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.12 \cdot 10^{-209}:\\
\;\;\;\;\frac{x\_m}{y \cdot \left(t - z\right)}\\

\mathbf{elif}\;t \leq 0.0019:\\
\;\;\;\;\frac{x\_m}{z \cdot \left(z - y\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{\left(y - z\right) \cdot t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.12e-209

    1. Initial program 87.4%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num87.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(y - z\right) \cdot \left(t - z\right)}{x}}} \]
      2. associate-/r/87.3%

        \[\leadsto \color{blue}{\frac{1}{\left(y - z\right) \cdot \left(t - z\right)} \cdot x} \]
    4. Applied egg-rr87.3%

      \[\leadsto \color{blue}{\frac{1}{\left(y - z\right) \cdot \left(t - z\right)} \cdot x} \]
    5. Step-by-step derivation
      1. associate-*l/87.4%

        \[\leadsto \color{blue}{\frac{1 \cdot x}{\left(y - z\right) \cdot \left(t - z\right)}} \]
      2. times-frac95.8%

        \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}} \]
      3. *-commutative95.8%

        \[\leadsto \color{blue}{\frac{x}{t - z} \cdot \frac{1}{y - z}} \]
      4. clear-num95.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{t - z}{x}}} \cdot \frac{1}{y - z} \]
      5. associate-*l/96.2%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{1}{y - z}}{\frac{t - z}{x}}} \]
      6. *-un-lft-identity96.2%

        \[\leadsto \frac{\color{blue}{\frac{1}{y - z}}}{\frac{t - z}{x}} \]
    6. Applied egg-rr96.2%

      \[\leadsto \color{blue}{\frac{\frac{1}{y - z}}{\frac{t - z}{x}}} \]
    7. Taylor expanded in y around inf 53.0%

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

    if -1.12e-209 < t < 0.0019

    1. Initial program 87.2%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 77.8%

      \[\leadsto \frac{x}{\color{blue}{-1 \cdot \left(z \cdot \left(y - z\right)\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg77.8%

        \[\leadsto \frac{x}{\color{blue}{-z \cdot \left(y - z\right)}} \]
      2. distribute-rgt-neg-in77.8%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-\left(y - z\right)\right)}} \]
      3. neg-sub077.8%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(0 - \left(y - z\right)\right)}} \]
      4. sub-neg77.8%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(y + \left(-z\right)\right)}\right)} \]
      5. +-commutative77.8%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right)} \]
      6. associate--r+77.8%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)}} \]
      7. neg-sub077.8%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right)} \]
      8. remove-double-neg77.8%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{z} - y\right)} \]
    5. Simplified77.8%

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

    if 0.0019 < t

    1. Initial program 81.2%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 75.8%

      \[\leadsto \frac{x}{\left(y - z\right) \cdot \color{blue}{t}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 13: 72.3% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -48000000000000:\\ \;\;\;\;\frac{\frac{x\_m}{z}}{z}\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{+120}:\\ \;\;\;\;\frac{x\_m}{y \cdot \left(t - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{z} \cdot \frac{1}{z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= z -48000000000000.0)
    (/ (/ x_m z) z)
    (if (<= z 5.5e+120) (/ x_m (* y (- t z))) (* (/ x_m z) (/ 1.0 z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (z <= -48000000000000.0) {
		tmp = (x_m / z) / z;
	} else if (z <= 5.5e+120) {
		tmp = x_m / (y * (t - z));
	} else {
		tmp = (x_m / z) * (1.0 / z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (z <= (-48000000000000.0d0)) then
        tmp = (x_m / z) / z
    else if (z <= 5.5d+120) then
        tmp = x_m / (y * (t - z))
    else
        tmp = (x_m / z) * (1.0d0 / z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (z <= -48000000000000.0) {
		tmp = (x_m / z) / z;
	} else if (z <= 5.5e+120) {
		tmp = x_m / (y * (t - z));
	} else {
		tmp = (x_m / z) * (1.0 / z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if z <= -48000000000000.0:
		tmp = (x_m / z) / z
	elif z <= 5.5e+120:
		tmp = x_m / (y * (t - z))
	else:
		tmp = (x_m / z) * (1.0 / z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (z <= -48000000000000.0)
		tmp = Float64(Float64(x_m / z) / z);
	elseif (z <= 5.5e+120)
		tmp = Float64(x_m / Float64(y * Float64(t - z)));
	else
		tmp = Float64(Float64(x_m / z) * Float64(1.0 / z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (z <= -48000000000000.0)
		tmp = (x_m / z) / z;
	elseif (z <= 5.5e+120)
		tmp = x_m / (y * (t - z));
	else
		tmp = (x_m / z) * (1.0 / z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -48000000000000.0], N[(N[(x$95$m / z), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 5.5e+120], N[(x$95$m / N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -48000000000000:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{z}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{1}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.8e13

    1. Initial program 81.5%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 72.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{z \cdot \left(y - z\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg72.1%

        \[\leadsto \color{blue}{-\frac{x}{z \cdot \left(y - z\right)}} \]
      2. associate-/r*86.3%

        \[\leadsto -\color{blue}{\frac{\frac{x}{z}}{y - z}} \]
      3. distribute-neg-frac286.3%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{-\left(y - z\right)}} \]
      4. neg-sub086.3%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{0 - \left(y - z\right)}} \]
      5. sub-neg86.3%

        \[\leadsto \frac{\frac{x}{z}}{0 - \color{blue}{\left(y + \left(-z\right)\right)}} \]
      6. +-commutative86.3%

        \[\leadsto \frac{\frac{x}{z}}{0 - \color{blue}{\left(\left(-z\right) + y\right)}} \]
      7. associate--r+86.3%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(0 - \left(-z\right)\right) - y}} \]
      8. neg-sub086.3%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(-\left(-z\right)\right)} - y} \]
      9. remove-double-neg86.3%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z} - y} \]
    5. Simplified86.3%

      \[\leadsto \color{blue}{\frac{\frac{x}{z}}{z - y}} \]
    6. Taylor expanded in z around inf 80.0%

      \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z}} \]

    if -4.8e13 < z < 5.50000000000000003e120

    1. Initial program 92.1%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num91.2%

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(y - z\right) \cdot \left(t - z\right)}{x}}} \]
      2. associate-/r/92.0%

        \[\leadsto \color{blue}{\frac{1}{\left(y - z\right) \cdot \left(t - z\right)} \cdot x} \]
    4. Applied egg-rr92.0%

      \[\leadsto \color{blue}{\frac{1}{\left(y - z\right) \cdot \left(t - z\right)} \cdot x} \]
    5. Step-by-step derivation
      1. associate-*l/92.1%

        \[\leadsto \color{blue}{\frac{1 \cdot x}{\left(y - z\right) \cdot \left(t - z\right)}} \]
      2. times-frac94.0%

        \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}} \]
      3. *-commutative94.0%

        \[\leadsto \color{blue}{\frac{x}{t - z} \cdot \frac{1}{y - z}} \]
      4. clear-num93.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{t - z}{x}}} \cdot \frac{1}{y - z} \]
      5. associate-*l/93.8%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{1}{y - z}}{\frac{t - z}{x}}} \]
      6. *-un-lft-identity93.8%

        \[\leadsto \frac{\color{blue}{\frac{1}{y - z}}}{\frac{t - z}{x}} \]
    6. Applied egg-rr93.8%

      \[\leadsto \color{blue}{\frac{\frac{1}{y - z}}{\frac{t - z}{x}}} \]
    7. Taylor expanded in y around inf 73.4%

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

    if 5.50000000000000003e120 < z

    1. Initial program 69.5%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 69.3%

      \[\leadsto \frac{x}{\color{blue}{-1 \cdot \left(z \cdot \left(y - z\right)\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg69.3%

        \[\leadsto \frac{x}{\color{blue}{-z \cdot \left(y - z\right)}} \]
      2. distribute-rgt-neg-in69.3%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-\left(y - z\right)\right)}} \]
      3. neg-sub069.3%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(0 - \left(y - z\right)\right)}} \]
      4. sub-neg69.3%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(y + \left(-z\right)\right)}\right)} \]
      5. +-commutative69.3%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right)} \]
      6. associate--r+69.3%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)}} \]
      7. neg-sub069.3%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right)} \]
      8. remove-double-neg69.3%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{z} - y\right)} \]
    5. Simplified69.3%

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

      \[\leadsto \frac{x}{z \cdot \color{blue}{z}} \]
    7. Step-by-step derivation
      1. associate-/r*87.8%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{z}} \]
      2. div-inv87.9%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{1}{z}} \]
    8. Applied egg-rr87.9%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{1}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 14: 65.8% accurate, 0.6× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -3100000 \lor \neg \left(z \leq 4 \cdot 10^{+120}\right):\\ \;\;\;\;\frac{\frac{x\_m}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x\_m}{y}}{t}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (or (<= z -3100000.0) (not (<= z 4e+120)))
    (/ (/ x_m z) z)
    (/ (/ x_m y) t))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((z <= -3100000.0) || !(z <= 4e+120)) {
		tmp = (x_m / z) / z;
	} else {
		tmp = (x_m / y) / t;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((z <= (-3100000.0d0)) .or. (.not. (z <= 4d+120))) then
        tmp = (x_m / z) / z
    else
        tmp = (x_m / y) / t
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((z <= -3100000.0) || !(z <= 4e+120)) {
		tmp = (x_m / z) / z;
	} else {
		tmp = (x_m / y) / t;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if (z <= -3100000.0) or not (z <= 4e+120):
		tmp = (x_m / z) / z
	else:
		tmp = (x_m / y) / t
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if ((z <= -3100000.0) || !(z <= 4e+120))
		tmp = Float64(Float64(x_m / z) / z);
	else
		tmp = Float64(Float64(x_m / y) / t);
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if ((z <= -3100000.0) || ~((z <= 4e+120)))
		tmp = (x_m / z) / z;
	else
		tmp = (x_m / y) / t;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[z, -3100000.0], N[Not[LessEqual[z, 4e+120]], $MachinePrecision]], N[(N[(x$95$m / z), $MachinePrecision] / z), $MachinePrecision], N[(N[(x$95$m / y), $MachinePrecision] / t), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3100000 \lor \neg \left(z \leq 4 \cdot 10^{+120}\right):\\
\;\;\;\;\frac{\frac{x\_m}{z}}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.1e6 or 3.9999999999999999e120 < z

    1. Initial program 77.6%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 71.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{z \cdot \left(y - z\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg71.0%

        \[\leadsto \color{blue}{-\frac{x}{z \cdot \left(y - z\right)}} \]
      2. associate-/r*88.0%

        \[\leadsto -\color{blue}{\frac{\frac{x}{z}}{y - z}} \]
      3. distribute-neg-frac288.0%

        \[\leadsto \color{blue}{\frac{\frac{x}{z}}{-\left(y - z\right)}} \]
      4. neg-sub088.0%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{0 - \left(y - z\right)}} \]
      5. sub-neg88.0%

        \[\leadsto \frac{\frac{x}{z}}{0 - \color{blue}{\left(y + \left(-z\right)\right)}} \]
      6. +-commutative88.0%

        \[\leadsto \frac{\frac{x}{z}}{0 - \color{blue}{\left(\left(-z\right) + y\right)}} \]
      7. associate--r+88.0%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(0 - \left(-z\right)\right) - y}} \]
      8. neg-sub088.0%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{\left(-\left(-z\right)\right)} - y} \]
      9. remove-double-neg88.0%

        \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z} - y} \]
    5. Simplified88.0%

      \[\leadsto \color{blue}{\frac{\frac{x}{z}}{z - y}} \]
    6. Taylor expanded in z around inf 81.6%

      \[\leadsto \frac{\frac{x}{z}}{\color{blue}{z}} \]

    if -3.1e6 < z < 3.9999999999999999e120

    1. Initial program 92.0%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 74.2%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(t - z\right)}} \]
    4. Step-by-step derivation
      1. associate-/r*78.6%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{t - z}} \]
    5. Simplified78.6%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{t - z}} \]
    6. Taylor expanded in t around inf 57.6%

      \[\leadsto \frac{\frac{x}{y}}{\color{blue}{t}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3100000 \lor \neg \left(z \leq 4 \cdot 10^{+120}\right):\\ \;\;\;\;\frac{\frac{x}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 62.0% accurate, 0.6× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -24000000 \lor \neg \left(z \leq 4 \cdot 10^{+120}\right):\\ \;\;\;\;\frac{x\_m}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x\_m}{y}}{t}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (or (<= z -24000000.0) (not (<= z 4e+120)))
    (/ x_m (* z z))
    (/ (/ x_m y) t))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((z <= -24000000.0) || !(z <= 4e+120)) {
		tmp = x_m / (z * z);
	} else {
		tmp = (x_m / y) / t;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((z <= (-24000000.0d0)) .or. (.not. (z <= 4d+120))) then
        tmp = x_m / (z * z)
    else
        tmp = (x_m / y) / t
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((z <= -24000000.0) || !(z <= 4e+120)) {
		tmp = x_m / (z * z);
	} else {
		tmp = (x_m / y) / t;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if (z <= -24000000.0) or not (z <= 4e+120):
		tmp = x_m / (z * z)
	else:
		tmp = (x_m / y) / t
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if ((z <= -24000000.0) || !(z <= 4e+120))
		tmp = Float64(x_m / Float64(z * z));
	else
		tmp = Float64(Float64(x_m / y) / t);
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if ((z <= -24000000.0) || ~((z <= 4e+120)))
		tmp = x_m / (z * z);
	else
		tmp = (x_m / y) / t;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[z, -24000000.0], N[Not[LessEqual[z, 4e+120]], $MachinePrecision]], N[(x$95$m / N[(z * z), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / y), $MachinePrecision] / t), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -24000000 \lor \neg \left(z \leq 4 \cdot 10^{+120}\right):\\
\;\;\;\;\frac{x\_m}{z \cdot z}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{y}}{t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.4e7 or 3.9999999999999999e120 < z

    1. Initial program 77.6%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 71.0%

      \[\leadsto \frac{x}{\color{blue}{-1 \cdot \left(z \cdot \left(y - z\right)\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg71.0%

        \[\leadsto \frac{x}{\color{blue}{-z \cdot \left(y - z\right)}} \]
      2. distribute-rgt-neg-in71.0%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-\left(y - z\right)\right)}} \]
      3. neg-sub071.0%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(0 - \left(y - z\right)\right)}} \]
      4. sub-neg71.0%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(y + \left(-z\right)\right)}\right)} \]
      5. +-commutative71.0%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right)} \]
      6. associate--r+71.0%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)}} \]
      7. neg-sub071.0%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right)} \]
      8. remove-double-neg71.0%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{z} - y\right)} \]
    5. Simplified71.0%

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

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

    if -2.4e7 < z < 3.9999999999999999e120

    1. Initial program 92.0%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 74.2%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(t - z\right)}} \]
    4. Step-by-step derivation
      1. associate-/r*78.6%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{t - z}} \]
    5. Simplified78.6%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{t - z}} \]
    6. Taylor expanded in t around inf 57.6%

      \[\leadsto \frac{\frac{x}{y}}{\color{blue}{t}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -24000000 \lor \neg \left(z \leq 4 \cdot 10^{+120}\right):\\ \;\;\;\;\frac{x}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 61.6% accurate, 0.6× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -400000 \lor \neg \left(z \leq 4 \cdot 10^{+120}\right):\\ \;\;\;\;\frac{x\_m}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x\_m}{t}}{y}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (or (<= z -400000.0) (not (<= z 4e+120)))
    (/ x_m (* z z))
    (/ (/ x_m t) y))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((z <= -400000.0) || !(z <= 4e+120)) {
		tmp = x_m / (z * z);
	} else {
		tmp = (x_m / t) / y;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((z <= (-400000.0d0)) .or. (.not. (z <= 4d+120))) then
        tmp = x_m / (z * z)
    else
        tmp = (x_m / t) / y
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((z <= -400000.0) || !(z <= 4e+120)) {
		tmp = x_m / (z * z);
	} else {
		tmp = (x_m / t) / y;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if (z <= -400000.0) or not (z <= 4e+120):
		tmp = x_m / (z * z)
	else:
		tmp = (x_m / t) / y
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if ((z <= -400000.0) || !(z <= 4e+120))
		tmp = Float64(x_m / Float64(z * z));
	else
		tmp = Float64(Float64(x_m / t) / y);
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if ((z <= -400000.0) || ~((z <= 4e+120)))
		tmp = x_m / (z * z);
	else
		tmp = (x_m / t) / y;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[z, -400000.0], N[Not[LessEqual[z, 4e+120]], $MachinePrecision]], N[(x$95$m / N[(z * z), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / t), $MachinePrecision] / y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -400000 \lor \neg \left(z \leq 4 \cdot 10^{+120}\right):\\
\;\;\;\;\frac{x\_m}{z \cdot z}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{t}}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4e5 or 3.9999999999999999e120 < z

    1. Initial program 77.6%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 71.0%

      \[\leadsto \frac{x}{\color{blue}{-1 \cdot \left(z \cdot \left(y - z\right)\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg71.0%

        \[\leadsto \frac{x}{\color{blue}{-z \cdot \left(y - z\right)}} \]
      2. distribute-rgt-neg-in71.0%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-\left(y - z\right)\right)}} \]
      3. neg-sub071.0%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(0 - \left(y - z\right)\right)}} \]
      4. sub-neg71.0%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(y + \left(-z\right)\right)}\right)} \]
      5. +-commutative71.0%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right)} \]
      6. associate--r+71.0%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)}} \]
      7. neg-sub071.0%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right)} \]
      8. remove-double-neg71.0%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{z} - y\right)} \]
    5. Simplified71.0%

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

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

    if -4e5 < z < 3.9999999999999999e120

    1. Initial program 92.0%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num91.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(y - z\right) \cdot \left(t - z\right)}{x}}} \]
      2. associate-/r/91.9%

        \[\leadsto \color{blue}{\frac{1}{\left(y - z\right) \cdot \left(t - z\right)} \cdot x} \]
    4. Applied egg-rr91.9%

      \[\leadsto \color{blue}{\frac{1}{\left(y - z\right) \cdot \left(t - z\right)} \cdot x} \]
    5. Step-by-step derivation
      1. associate-*l/92.0%

        \[\leadsto \color{blue}{\frac{1 \cdot x}{\left(y - z\right) \cdot \left(t - z\right)}} \]
      2. times-frac93.9%

        \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}} \]
      3. *-commutative93.9%

        \[\leadsto \color{blue}{\frac{x}{t - z} \cdot \frac{1}{y - z}} \]
      4. clear-num93.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{t - z}{x}}} \cdot \frac{1}{y - z} \]
      5. associate-*l/93.7%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{1}{y - z}}{\frac{t - z}{x}}} \]
      6. *-un-lft-identity93.7%

        \[\leadsto \frac{\color{blue}{\frac{1}{y - z}}}{\frac{t - z}{x}} \]
    6. Applied egg-rr93.7%

      \[\leadsto \color{blue}{\frac{\frac{1}{y - z}}{\frac{t - z}{x}}} \]
    7. Taylor expanded in z around 0 52.0%

      \[\leadsto \color{blue}{\frac{x}{t \cdot y}} \]
    8. Step-by-step derivation
      1. associate-/r*54.4%

        \[\leadsto \color{blue}{\frac{\frac{x}{t}}{y}} \]
    9. Simplified54.4%

      \[\leadsto \color{blue}{\frac{\frac{x}{t}}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification60.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -400000 \lor \neg \left(z \leq 4 \cdot 10^{+120}\right):\\ \;\;\;\;\frac{x}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 59.0% accurate, 0.6× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1.7 \cdot 10^{-43} \lor \neg \left(z \leq 4 \cdot 10^{+120}\right):\\ \;\;\;\;\frac{x\_m}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{y \cdot t}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (or (<= z -1.7e-43) (not (<= z 4e+120)))
    (/ x_m (* z z))
    (/ x_m (* y t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((z <= -1.7e-43) || !(z <= 4e+120)) {
		tmp = x_m / (z * z);
	} else {
		tmp = x_m / (y * t);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((z <= (-1.7d-43)) .or. (.not. (z <= 4d+120))) then
        tmp = x_m / (z * z)
    else
        tmp = x_m / (y * t)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((z <= -1.7e-43) || !(z <= 4e+120)) {
		tmp = x_m / (z * z);
	} else {
		tmp = x_m / (y * t);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	tmp = 0
	if (z <= -1.7e-43) or not (z <= 4e+120):
		tmp = x_m / (z * z)
	else:
		tmp = x_m / (y * t)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if ((z <= -1.7e-43) || !(z <= 4e+120))
		tmp = Float64(x_m / Float64(z * z));
	else
		tmp = Float64(x_m / Float64(y * t));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if ((z <= -1.7e-43) || ~((z <= 4e+120)))
		tmp = x_m / (z * z);
	else
		tmp = x_m / (y * t);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[z, -1.7e-43], N[Not[LessEqual[z, 4e+120]], $MachinePrecision]], N[(x$95$m / N[(z * z), $MachinePrecision]), $MachinePrecision], N[(x$95$m / N[(y * t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-43} \lor \neg \left(z \leq 4 \cdot 10^{+120}\right):\\
\;\;\;\;\frac{x\_m}{z \cdot z}\\

\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y \cdot t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.7e-43 or 3.9999999999999999e120 < z

    1. Initial program 78.9%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 69.6%

      \[\leadsto \frac{x}{\color{blue}{-1 \cdot \left(z \cdot \left(y - z\right)\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg69.6%

        \[\leadsto \frac{x}{\color{blue}{-z \cdot \left(y - z\right)}} \]
      2. distribute-rgt-neg-in69.6%

        \[\leadsto \frac{x}{\color{blue}{z \cdot \left(-\left(y - z\right)\right)}} \]
      3. neg-sub069.6%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(0 - \left(y - z\right)\right)}} \]
      4. sub-neg69.6%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(y + \left(-z\right)\right)}\right)} \]
      5. +-commutative69.6%

        \[\leadsto \frac{x}{z \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right)} \]
      6. associate--r+69.6%

        \[\leadsto \frac{x}{z \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)}} \]
      7. neg-sub069.6%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right)} \]
      8. remove-double-neg69.6%

        \[\leadsto \frac{x}{z \cdot \left(\color{blue}{z} - y\right)} \]
    5. Simplified69.6%

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

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

    if -1.7e-43 < z < 3.9999999999999999e120

    1. Initial program 92.1%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 54.4%

      \[\leadsto \color{blue}{\frac{x}{t \cdot y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.7 \cdot 10^{-43} \lor \neg \left(z \leq 4 \cdot 10^{+120}\right):\\ \;\;\;\;\frac{x}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 39.2% accurate, 1.8× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ [x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\ \\ x\_s \cdot \frac{x\_m}{y \cdot t} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t) :precision binary64 (* x_s (/ x_m (* y t))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
	return x_s * (x_m / (y * t));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x_s * (x_m / (y * t))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
	return x_s * (x_m / (y * t));
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
[x_m, y, z, t] = sort([x_m, y, z, t])
def code(x_s, x_m, y, z, t):
	return x_s * (x_m / (y * t))
x\_m = abs(x)
x\_s = copysign(1.0, x)
x_m, y, z, t = sort([x_m, y, z, t])
function code(x_s, x_m, y, z, t)
	return Float64(x_s * Float64(x_m / Float64(y * t)))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp = code(x_s, x_m, y, z, t)
	tmp = x_s * (x_m / (y * t));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \frac{x\_m}{y \cdot t}
\end{array}
Derivation
  1. Initial program 85.8%

    \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in z around 0 35.1%

    \[\leadsto \color{blue}{\frac{x}{t \cdot y}} \]
  4. Final simplification35.1%

    \[\leadsto \frac{x}{y \cdot t} \]
  5. Add Preprocessing

Developer Target 1: 87.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y - z\right) \cdot \left(t - z\right)\\ \mathbf{if}\;\frac{x}{t\_1} < 0:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{t\_1}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (- y z) (- t z))))
   (if (< (/ x t_1) 0.0) (/ (/ x (- y z)) (- t z)) (* x (/ 1.0 t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = (y - z) * (t - z);
	double tmp;
	if ((x / t_1) < 0.0) {
		tmp = (x / (y - z)) / (t - z);
	} else {
		tmp = x * (1.0 / 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
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (y - z) * (t - z)
    if ((x / t_1) < 0.0d0) then
        tmp = (x / (y - z)) / (t - z)
    else
        tmp = x * (1.0d0 / t_1)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (y - z) * (t - z);
	double tmp;
	if ((x / t_1) < 0.0) {
		tmp = (x / (y - z)) / (t - z);
	} else {
		tmp = x * (1.0 / t_1);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (y - z) * (t - z)
	tmp = 0
	if (x / t_1) < 0.0:
		tmp = (x / (y - z)) / (t - z)
	else:
		tmp = x * (1.0 / t_1)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(y - z) * Float64(t - z))
	tmp = 0.0
	if (Float64(x / t_1) < 0.0)
		tmp = Float64(Float64(x / Float64(y - z)) / Float64(t - z));
	else
		tmp = Float64(x * Float64(1.0 / t_1));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (y - z) * (t - z);
	tmp = 0.0;
	if ((x / t_1) < 0.0)
		tmp = (x / (y - z)) / (t - z);
	else
		tmp = x * (1.0 / t_1);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[Less[N[(x / t$95$1), $MachinePrecision], 0.0], N[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \left(t - z\right)\\
\mathbf{if}\;\frac{x}{t\_1} < 0:\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{t\_1}\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024172 
(FPCore (x y z t)
  :name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, B"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< (/ x (* (- y z) (- t z))) 0) (/ (/ x (- y z)) (- t z)) (* x (/ 1 (* (- y z) (- t z))))))

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