Linear.Projection:infinitePerspective from linear-1.19.1.3, A

Percentage Accurate: 89.2% → 97.1%
Time: 10.2s
Alternatives: 12
Speedup: 1.2×

Specification

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

\\
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\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 12 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: 89.2% accurate, 1.0× speedup?

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

\\
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\end{array}

Alternative 1: 97.1% accurate, 0.7× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;x\_m \cdot 2 \leq 4 \cdot 10^{+14}:\\ \;\;\;\;\frac{\frac{x\_m}{z \cdot 0.5}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x\_m}{y - t}}{z \cdot 0.5}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= (* x_m 2.0) 4e+14)
    (/ (/ x_m (* z 0.5)) (- y t))
    (/ (/ x_m (- y t)) (* z 0.5)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((x_m * 2.0) <= 4e+14) {
		tmp = (x_m / (z * 0.5)) / (y - t);
	} else {
		tmp = (x_m / (y - t)) / (z * 0.5);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 ((x_m * 2.0d0) <= 4d+14) then
        tmp = (x_m / (z * 0.5d0)) / (y - t)
    else
        tmp = (x_m / (y - t)) / (z * 0.5d0)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((x_m * 2.0) <= 4e+14) {
		tmp = (x_m / (z * 0.5)) / (y - t);
	} else {
		tmp = (x_m / (y - t)) / (z * 0.5);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	tmp = 0
	if (x_m * 2.0) <= 4e+14:
		tmp = (x_m / (z * 0.5)) / (y - t)
	else:
		tmp = (x_m / (y - t)) / (z * 0.5)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (Float64(x_m * 2.0) <= 4e+14)
		tmp = Float64(Float64(x_m / Float64(z * 0.5)) / Float64(y - t));
	else
		tmp = Float64(Float64(x_m / Float64(y - t)) / Float64(z * 0.5));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if ((x_m * 2.0) <= 4e+14)
		tmp = (x_m / (z * 0.5)) / (y - t);
	else
		tmp = (x_m / (y - t)) / (z * 0.5);
	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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[N[(x$95$m * 2.0), $MachinePrecision], 4e+14], N[(N[(x$95$m / N[(z * 0.5), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(y - t), $MachinePrecision]), $MachinePrecision] / N[(z * 0.5), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot 2 \leq 4 \cdot 10^{+14}:\\
\;\;\;\;\frac{\frac{x\_m}{z \cdot 0.5}}{y - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x #s(literal 2 binary64)) < 4e14

    1. Initial program 91.9%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--94.0%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-sqr-sqrt34.8%

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot 2} \cdot \sqrt{x \cdot 2}}}{z \cdot \left(y - t\right)} \]
      2. *-commutative34.8%

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

        \[\leadsto \color{blue}{\frac{\sqrt{x \cdot 2}}{y - t} \cdot \frac{\sqrt{x \cdot 2}}{z}} \]
    6. Applied egg-rr34.3%

      \[\leadsto \color{blue}{\frac{\sqrt{x \cdot 2}}{y - t} \cdot \frac{\sqrt{x \cdot 2}}{z}} \]
    7. Step-by-step derivation
      1. frac-times34.8%

        \[\leadsto \color{blue}{\frac{\sqrt{x \cdot 2} \cdot \sqrt{x \cdot 2}}{\left(y - t\right) \cdot z}} \]
      2. add-sqr-sqrt94.0%

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

        \[\leadsto \color{blue}{\frac{x}{y - t} \cdot \frac{2}{z}} \]
      4. *-commutative91.6%

        \[\leadsto \color{blue}{\frac{2}{z} \cdot \frac{x}{y - t}} \]
      5. clear-num91.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{2}}} \cdot \frac{x}{y - t} \]
      6. frac-times94.0%

        \[\leadsto \color{blue}{\frac{1 \cdot x}{\frac{z}{2} \cdot \left(y - t\right)}} \]
      7. *-un-lft-identity94.0%

        \[\leadsto \frac{\color{blue}{x}}{\frac{z}{2} \cdot \left(y - t\right)} \]
      8. div-inv94.0%

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

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

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

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

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

    if 4e14 < (*.f64 x #s(literal 2 binary64))

    1. Initial program 85.9%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--87.6%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-sqr-sqrt87.1%

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot 2} \cdot \sqrt{x \cdot 2}}}{z \cdot \left(y - t\right)} \]
      2. *-commutative87.1%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{x \cdot 2}}{y - t} \cdot \frac{\sqrt{x \cdot 2}}{z}} \]
    7. Step-by-step derivation
      1. frac-times87.1%

        \[\leadsto \color{blue}{\frac{\sqrt{x \cdot 2} \cdot \sqrt{x \cdot 2}}{\left(y - t\right) \cdot z}} \]
      2. add-sqr-sqrt87.6%

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

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

        \[\leadsto \frac{x}{y - t} \cdot \color{blue}{\frac{1}{\frac{z}{2}}} \]
      5. un-div-inv96.7%

        \[\leadsto \color{blue}{\frac{\frac{x}{y - t}}{\frac{z}{2}}} \]
      6. div-inv96.7%

        \[\leadsto \frac{\frac{x}{y - t}}{\color{blue}{z \cdot \frac{1}{2}}} \]
      7. metadata-eval96.7%

        \[\leadsto \frac{\frac{x}{y - t}}{z \cdot \color{blue}{0.5}} \]
    8. Applied egg-rr96.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot 2 \leq 4 \cdot 10^{+14}:\\ \;\;\;\;\frac{\frac{x}{z \cdot 0.5}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - t}}{z \cdot 0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 73.7% accurate, 0.3× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_1 := -2 \cdot \frac{\frac{x\_m}{z}}{t}\\ t_2 := x\_m \cdot \frac{2}{z \cdot y}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{-51}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -8.6 \cdot 10^{-75}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{-95}:\\ \;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-223}:\\ \;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\ \mathbf{elif}\;y \leq 1450000000:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
 :precision binary64
 (let* ((t_1 (* -2.0 (/ (/ x_m z) t))) (t_2 (* x_m (/ 2.0 (* z y)))))
   (*
    x_s
    (if (<= y -5.2e-51)
      t_2
      (if (<= y -8.6e-75)
        t_1
        (if (<= y -1.4e-95)
          (* (/ 2.0 z) (/ x_m y))
          (if (<= y -1e-223)
            (* -2.0 (/ x_m (* z t)))
            (if (<= y 1450000000.0) t_1 t_2))))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = -2.0 * ((x_m / z) / t);
	double t_2 = x_m * (2.0 / (z * y));
	double tmp;
	if (y <= -5.2e-51) {
		tmp = t_2;
	} else if (y <= -8.6e-75) {
		tmp = t_1;
	} else if (y <= -1.4e-95) {
		tmp = (2.0 / z) * (x_m / y);
	} else if (y <= -1e-223) {
		tmp = -2.0 * (x_m / (z * t));
	} else if (y <= 1450000000.0) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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) :: t_2
    real(8) :: tmp
    t_1 = (-2.0d0) * ((x_m / z) / t)
    t_2 = x_m * (2.0d0 / (z * y))
    if (y <= (-5.2d-51)) then
        tmp = t_2
    else if (y <= (-8.6d-75)) then
        tmp = t_1
    else if (y <= (-1.4d-95)) then
        tmp = (2.0d0 / z) * (x_m / y)
    else if (y <= (-1d-223)) then
        tmp = (-2.0d0) * (x_m / (z * t))
    else if (y <= 1450000000.0d0) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = -2.0 * ((x_m / z) / t);
	double t_2 = x_m * (2.0 / (z * y));
	double tmp;
	if (y <= -5.2e-51) {
		tmp = t_2;
	} else if (y <= -8.6e-75) {
		tmp = t_1;
	} else if (y <= -1.4e-95) {
		tmp = (2.0 / z) * (x_m / y);
	} else if (y <= -1e-223) {
		tmp = -2.0 * (x_m / (z * t));
	} else if (y <= 1450000000.0) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	t_1 = -2.0 * ((x_m / z) / t)
	t_2 = x_m * (2.0 / (z * y))
	tmp = 0
	if y <= -5.2e-51:
		tmp = t_2
	elif y <= -8.6e-75:
		tmp = t_1
	elif y <= -1.4e-95:
		tmp = (2.0 / z) * (x_m / y)
	elif y <= -1e-223:
		tmp = -2.0 * (x_m / (z * t))
	elif y <= 1450000000.0:
		tmp = t_1
	else:
		tmp = t_2
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	t_1 = Float64(-2.0 * Float64(Float64(x_m / z) / t))
	t_2 = Float64(x_m * Float64(2.0 / Float64(z * y)))
	tmp = 0.0
	if (y <= -5.2e-51)
		tmp = t_2;
	elseif (y <= -8.6e-75)
		tmp = t_1;
	elseif (y <= -1.4e-95)
		tmp = Float64(Float64(2.0 / z) * Float64(x_m / y));
	elseif (y <= -1e-223)
		tmp = Float64(-2.0 * Float64(x_m / Float64(z * t)));
	elseif (y <= 1450000000.0)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z, t)
	t_1 = -2.0 * ((x_m / z) / t);
	t_2 = x_m * (2.0 / (z * y));
	tmp = 0.0;
	if (y <= -5.2e-51)
		tmp = t_2;
	elseif (y <= -8.6e-75)
		tmp = t_1;
	elseif (y <= -1.4e-95)
		tmp = (2.0 / z) * (x_m / y);
	elseif (y <= -1e-223)
		tmp = -2.0 * (x_m / (z * t));
	elseif (y <= 1450000000.0)
		tmp = t_1;
	else
		tmp = t_2;
	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]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x$95$m * N[(2.0 / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -5.2e-51], t$95$2, If[LessEqual[y, -8.6e-75], t$95$1, If[LessEqual[y, -1.4e-95], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1e-223], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1450000000.0], t$95$1, t$95$2]]]]]), $MachinePrecision]]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
\begin{array}{l}
t_1 := -2 \cdot \frac{\frac{x\_m}{z}}{t}\\
t_2 := x\_m \cdot \frac{2}{z \cdot y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-51}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y \leq -8.6 \cdot 10^{-75}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -1.4 \cdot 10^{-95}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\

\mathbf{elif}\;y \leq -1 \cdot 10^{-223}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\

\mathbf{elif}\;y \leq 1450000000:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -5.2e-51 or 1.45e9 < y

    1. Initial program 92.0%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--94.7%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 84.3%

      \[\leadsto \frac{x \cdot 2}{\color{blue}{y \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative84.3%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot y}} \]
    7. Simplified84.3%

      \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot y}} \]
    8. Step-by-step derivation
      1. associate-/l*84.2%

        \[\leadsto \color{blue}{x \cdot \frac{2}{z \cdot y}} \]
      2. *-commutative84.2%

        \[\leadsto x \cdot \frac{2}{\color{blue}{y \cdot z}} \]
    9. Applied egg-rr84.2%

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

    if -5.2e-51 < y < -8.5999999999999998e-75 or -9.9999999999999997e-224 < y < 1.45e9

    1. Initial program 89.0%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--90.3%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 81.7%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative81.7%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified81.7%

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z}}{t}} \]
      2. div-inv85.4%

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

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z} \cdot 1}{t}} \]
      2. *-rgt-identity85.5%

        \[\leadsto -2 \cdot \frac{\color{blue}{\frac{x}{z}}}{t} \]
    11. Simplified85.5%

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

    if -8.5999999999999998e-75 < y < -1.4e-95

    1. Initial program 75.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--75.9%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative75.9%

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

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

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

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

    if -1.4e-95 < y < -9.9999999999999997e-224

    1. Initial program 91.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--91.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 82.7%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative82.7%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified82.7%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{z \cdot t}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification84.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{-51}:\\ \;\;\;\;x \cdot \frac{2}{z \cdot y}\\ \mathbf{elif}\;y \leq -8.6 \cdot 10^{-75}:\\ \;\;\;\;-2 \cdot \frac{\frac{x}{z}}{t}\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{-95}:\\ \;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-223}:\\ \;\;\;\;-2 \cdot \frac{x}{z \cdot t}\\ \mathbf{elif}\;y \leq 1450000000:\\ \;\;\;\;-2 \cdot \frac{\frac{x}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{2}{z \cdot y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 73.7% accurate, 0.3× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_1 := x\_m \cdot \frac{2}{z \cdot y}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-51}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -5.8 \cdot 10^{-75}:\\ \;\;\;\;\frac{-2}{t \cdot \frac{z}{x\_m}}\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{-95}:\\ \;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{-220}:\\ \;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\ \mathbf{elif}\;y \leq 3700000000:\\ \;\;\;\;-2 \cdot \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)
(FPCore (x_s x_m y z t)
 :precision binary64
 (let* ((t_1 (* x_m (/ 2.0 (* z y)))))
   (*
    x_s
    (if (<= y -5e-51)
      t_1
      (if (<= y -5.8e-75)
        (/ -2.0 (* t (/ z x_m)))
        (if (<= y -1.45e-95)
          (* (/ 2.0 z) (/ x_m y))
          (if (<= y -1.7e-220)
            (* -2.0 (/ x_m (* z t)))
            (if (<= y 3700000000.0) (* -2.0 (/ (/ x_m z) t)) t_1))))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = x_m * (2.0 / (z * y));
	double tmp;
	if (y <= -5e-51) {
		tmp = t_1;
	} else if (y <= -5.8e-75) {
		tmp = -2.0 / (t * (z / x_m));
	} else if (y <= -1.45e-95) {
		tmp = (2.0 / z) * (x_m / y);
	} else if (y <= -1.7e-220) {
		tmp = -2.0 * (x_m / (z * t));
	} else if (y <= 3700000000.0) {
		tmp = -2.0 * ((x_m / z) / t);
	} else {
		tmp = t_1;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 * (2.0d0 / (z * y))
    if (y <= (-5d-51)) then
        tmp = t_1
    else if (y <= (-5.8d-75)) then
        tmp = (-2.0d0) / (t * (z / x_m))
    else if (y <= (-1.45d-95)) then
        tmp = (2.0d0 / z) * (x_m / y)
    else if (y <= (-1.7d-220)) then
        tmp = (-2.0d0) * (x_m / (z * t))
    else if (y <= 3700000000.0d0) then
        tmp = (-2.0d0) * ((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);
public static double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = x_m * (2.0 / (z * y));
	double tmp;
	if (y <= -5e-51) {
		tmp = t_1;
	} else if (y <= -5.8e-75) {
		tmp = -2.0 / (t * (z / x_m));
	} else if (y <= -1.45e-95) {
		tmp = (2.0 / z) * (x_m / y);
	} else if (y <= -1.7e-220) {
		tmp = -2.0 * (x_m / (z * t));
	} else if (y <= 3700000000.0) {
		tmp = -2.0 * ((x_m / z) / t);
	} else {
		tmp = t_1;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	t_1 = x_m * (2.0 / (z * y))
	tmp = 0
	if y <= -5e-51:
		tmp = t_1
	elif y <= -5.8e-75:
		tmp = -2.0 / (t * (z / x_m))
	elif y <= -1.45e-95:
		tmp = (2.0 / z) * (x_m / y)
	elif y <= -1.7e-220:
		tmp = -2.0 * (x_m / (z * t))
	elif y <= 3700000000.0:
		tmp = -2.0 * ((x_m / z) / t)
	else:
		tmp = t_1
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	t_1 = Float64(x_m * Float64(2.0 / Float64(z * y)))
	tmp = 0.0
	if (y <= -5e-51)
		tmp = t_1;
	elseif (y <= -5.8e-75)
		tmp = Float64(-2.0 / Float64(t * Float64(z / x_m)));
	elseif (y <= -1.45e-95)
		tmp = Float64(Float64(2.0 / z) * Float64(x_m / y));
	elseif (y <= -1.7e-220)
		tmp = Float64(-2.0 * Float64(x_m / Float64(z * t)));
	elseif (y <= 3700000000.0)
		tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t));
	else
		tmp = t_1;
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z, t)
	t_1 = x_m * (2.0 / (z * y));
	tmp = 0.0;
	if (y <= -5e-51)
		tmp = t_1;
	elseif (y <= -5.8e-75)
		tmp = -2.0 / (t * (z / x_m));
	elseif (y <= -1.45e-95)
		tmp = (2.0 / z) * (x_m / y);
	elseif (y <= -1.7e-220)
		tmp = -2.0 * (x_m / (z * t));
	elseif (y <= 3700000000.0)
		tmp = -2.0 * ((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]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(x$95$m * N[(2.0 / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -5e-51], t$95$1, If[LessEqual[y, -5.8e-75], N[(-2.0 / N[(t * N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.45e-95], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.7e-220], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3700000000.0], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
\begin{array}{l}
t_1 := x\_m \cdot \frac{2}{z \cdot y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-51}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -5.8 \cdot 10^{-75}:\\
\;\;\;\;\frac{-2}{t \cdot \frac{z}{x\_m}}\\

\mathbf{elif}\;y \leq -1.45 \cdot 10^{-95}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\

\mathbf{elif}\;y \leq -1.7 \cdot 10^{-220}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\

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

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -5.00000000000000004e-51 or 3.7e9 < y

    1. Initial program 92.0%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--94.7%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 84.3%

      \[\leadsto \frac{x \cdot 2}{\color{blue}{y \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative84.3%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot y}} \]
    7. Simplified84.3%

      \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot y}} \]
    8. Step-by-step derivation
      1. associate-/l*84.2%

        \[\leadsto \color{blue}{x \cdot \frac{2}{z \cdot y}} \]
      2. *-commutative84.2%

        \[\leadsto x \cdot \frac{2}{\color{blue}{y \cdot z}} \]
    9. Applied egg-rr84.2%

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

    if -5.00000000000000004e-51 < y < -5.8000000000000003e-75

    1. Initial program 78.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--78.5%

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

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

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative67.7%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified67.7%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{z \cdot t}} \]
    8. Step-by-step derivation
      1. clear-num67.8%

        \[\leadsto -2 \cdot \color{blue}{\frac{1}{\frac{z \cdot t}{x}}} \]
      2. un-div-inv67.8%

        \[\leadsto \color{blue}{\frac{-2}{\frac{z \cdot t}{x}}} \]
      3. *-commutative67.8%

        \[\leadsto \frac{-2}{\frac{\color{blue}{t \cdot z}}{x}} \]
    9. Applied egg-rr67.8%

      \[\leadsto \color{blue}{\frac{-2}{\frac{t \cdot z}{x}}} \]
    10. Step-by-step derivation
      1. associate-/l*78.3%

        \[\leadsto \frac{-2}{\color{blue}{t \cdot \frac{z}{x}}} \]
    11. Simplified78.3%

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

    if -5.8000000000000003e-75 < y < -1.45000000000000001e-95

    1. Initial program 75.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--75.9%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative75.9%

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

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

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

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

    if -1.45000000000000001e-95 < y < -1.69999999999999997e-220

    1. Initial program 91.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--91.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 82.7%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative82.7%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified82.7%

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

    if -1.69999999999999997e-220 < y < 3.7e9

    1. Initial program 90.4%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--91.8%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 83.5%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative83.5%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified83.5%

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z}}{t}} \]
      2. div-inv86.4%

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

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z} \cdot 1}{t}} \]
      2. *-rgt-identity86.5%

        \[\leadsto -2 \cdot \frac{\color{blue}{\frac{x}{z}}}{t} \]
    11. Simplified86.5%

      \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z}}{t}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification84.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-51}:\\ \;\;\;\;x \cdot \frac{2}{z \cdot y}\\ \mathbf{elif}\;y \leq -5.8 \cdot 10^{-75}:\\ \;\;\;\;\frac{-2}{t \cdot \frac{z}{x}}\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{-95}:\\ \;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{-220}:\\ \;\;\;\;-2 \cdot \frac{x}{z \cdot t}\\ \mathbf{elif}\;y \leq 3700000000:\\ \;\;\;\;-2 \cdot \frac{\frac{x}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{2}{z \cdot y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 73.7% accurate, 0.3× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_1 := \frac{x\_m \cdot 2}{z \cdot y}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -2.4 \cdot 10^{-52}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -1.8 \cdot 10^{-74}:\\ \;\;\;\;\frac{-2}{t \cdot \frac{z}{x\_m}}\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{-95}:\\ \;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\ \mathbf{elif}\;y \leq -1.16 \cdot 10^{-220}:\\ \;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\ \mathbf{elif}\;y \leq 2200000000:\\ \;\;\;\;-2 \cdot \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)
(FPCore (x_s x_m y z t)
 :precision binary64
 (let* ((t_1 (/ (* x_m 2.0) (* z y))))
   (*
    x_s
    (if (<= y -2.4e-52)
      t_1
      (if (<= y -1.8e-74)
        (/ -2.0 (* t (/ z x_m)))
        (if (<= y -1.45e-95)
          (* (/ 2.0 z) (/ x_m y))
          (if (<= y -1.16e-220)
            (* -2.0 (/ x_m (* z t)))
            (if (<= y 2200000000.0) (* -2.0 (/ (/ x_m z) t)) t_1))))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = (x_m * 2.0) / (z * y);
	double tmp;
	if (y <= -2.4e-52) {
		tmp = t_1;
	} else if (y <= -1.8e-74) {
		tmp = -2.0 / (t * (z / x_m));
	} else if (y <= -1.45e-95) {
		tmp = (2.0 / z) * (x_m / y);
	} else if (y <= -1.16e-220) {
		tmp = -2.0 * (x_m / (z * t));
	} else if (y <= 2200000000.0) {
		tmp = -2.0 * ((x_m / z) / t);
	} else {
		tmp = t_1;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 * 2.0d0) / (z * y)
    if (y <= (-2.4d-52)) then
        tmp = t_1
    else if (y <= (-1.8d-74)) then
        tmp = (-2.0d0) / (t * (z / x_m))
    else if (y <= (-1.45d-95)) then
        tmp = (2.0d0 / z) * (x_m / y)
    else if (y <= (-1.16d-220)) then
        tmp = (-2.0d0) * (x_m / (z * t))
    else if (y <= 2200000000.0d0) then
        tmp = (-2.0d0) * ((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);
public static double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = (x_m * 2.0) / (z * y);
	double tmp;
	if (y <= -2.4e-52) {
		tmp = t_1;
	} else if (y <= -1.8e-74) {
		tmp = -2.0 / (t * (z / x_m));
	} else if (y <= -1.45e-95) {
		tmp = (2.0 / z) * (x_m / y);
	} else if (y <= -1.16e-220) {
		tmp = -2.0 * (x_m / (z * t));
	} else if (y <= 2200000000.0) {
		tmp = -2.0 * ((x_m / z) / t);
	} else {
		tmp = t_1;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	t_1 = (x_m * 2.0) / (z * y)
	tmp = 0
	if y <= -2.4e-52:
		tmp = t_1
	elif y <= -1.8e-74:
		tmp = -2.0 / (t * (z / x_m))
	elif y <= -1.45e-95:
		tmp = (2.0 / z) * (x_m / y)
	elif y <= -1.16e-220:
		tmp = -2.0 * (x_m / (z * t))
	elif y <= 2200000000.0:
		tmp = -2.0 * ((x_m / z) / t)
	else:
		tmp = t_1
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	t_1 = Float64(Float64(x_m * 2.0) / Float64(z * y))
	tmp = 0.0
	if (y <= -2.4e-52)
		tmp = t_1;
	elseif (y <= -1.8e-74)
		tmp = Float64(-2.0 / Float64(t * Float64(z / x_m)));
	elseif (y <= -1.45e-95)
		tmp = Float64(Float64(2.0 / z) * Float64(x_m / y));
	elseif (y <= -1.16e-220)
		tmp = Float64(-2.0 * Float64(x_m / Float64(z * t)));
	elseif (y <= 2200000000.0)
		tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t));
	else
		tmp = t_1;
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z, t)
	t_1 = (x_m * 2.0) / (z * y);
	tmp = 0.0;
	if (y <= -2.4e-52)
		tmp = t_1;
	elseif (y <= -1.8e-74)
		tmp = -2.0 / (t * (z / x_m));
	elseif (y <= -1.45e-95)
		tmp = (2.0 / z) * (x_m / y);
	elseif (y <= -1.16e-220)
		tmp = -2.0 * (x_m / (z * t));
	elseif (y <= 2200000000.0)
		tmp = -2.0 * ((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]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -2.4e-52], t$95$1, If[LessEqual[y, -1.8e-74], N[(-2.0 / N[(t * N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.45e-95], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.16e-220], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2200000000.0], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
\begin{array}{l}
t_1 := \frac{x\_m \cdot 2}{z \cdot y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{-52}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -1.8 \cdot 10^{-74}:\\
\;\;\;\;\frac{-2}{t \cdot \frac{z}{x\_m}}\\

\mathbf{elif}\;y \leq -1.45 \cdot 10^{-95}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\

\mathbf{elif}\;y \leq -1.16 \cdot 10^{-220}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\

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

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -2.4000000000000002e-52 or 2.2e9 < y

    1. Initial program 92.0%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--94.7%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 84.3%

      \[\leadsto \frac{x \cdot 2}{\color{blue}{y \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative84.3%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot y}} \]
    7. Simplified84.3%

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

    if -2.4000000000000002e-52 < y < -1.8000000000000001e-74

    1. Initial program 78.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--78.5%

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

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

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative67.7%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified67.7%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{z \cdot t}} \]
    8. Step-by-step derivation
      1. clear-num67.8%

        \[\leadsto -2 \cdot \color{blue}{\frac{1}{\frac{z \cdot t}{x}}} \]
      2. un-div-inv67.8%

        \[\leadsto \color{blue}{\frac{-2}{\frac{z \cdot t}{x}}} \]
      3. *-commutative67.8%

        \[\leadsto \frac{-2}{\frac{\color{blue}{t \cdot z}}{x}} \]
    9. Applied egg-rr67.8%

      \[\leadsto \color{blue}{\frac{-2}{\frac{t \cdot z}{x}}} \]
    10. Step-by-step derivation
      1. associate-/l*78.3%

        \[\leadsto \frac{-2}{\color{blue}{t \cdot \frac{z}{x}}} \]
    11. Simplified78.3%

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

    if -1.8000000000000001e-74 < y < -1.45000000000000001e-95

    1. Initial program 75.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--75.9%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative75.9%

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

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

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

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

    if -1.45000000000000001e-95 < y < -1.15999999999999998e-220

    1. Initial program 91.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--91.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 82.7%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative82.7%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified82.7%

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

    if -1.15999999999999998e-220 < y < 2.2e9

    1. Initial program 90.4%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--91.8%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 83.5%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative83.5%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified83.5%

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z}}{t}} \]
      2. div-inv86.4%

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

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z} \cdot 1}{t}} \]
      2. *-rgt-identity86.5%

        \[\leadsto -2 \cdot \frac{\color{blue}{\frac{x}{z}}}{t} \]
    11. Simplified86.5%

      \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z}}{t}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification84.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.4 \cdot 10^{-52}:\\ \;\;\;\;\frac{x \cdot 2}{z \cdot y}\\ \mathbf{elif}\;y \leq -1.8 \cdot 10^{-74}:\\ \;\;\;\;\frac{-2}{t \cdot \frac{z}{x}}\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{-95}:\\ \;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq -1.16 \cdot 10^{-220}:\\ \;\;\;\;-2 \cdot \frac{x}{z \cdot t}\\ \mathbf{elif}\;y \leq 2200000000:\\ \;\;\;\;-2 \cdot \frac{\frac{x}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot 2}{z \cdot y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 73.9% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_1 := \frac{x\_m \cdot 2}{z \cdot y}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -3.15 \cdot 10^{-52}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -2.6 \cdot 10^{-74}:\\ \;\;\;\;\frac{x\_m}{t} \cdot \frac{2}{-z}\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{-95}:\\ \;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\ \mathbf{elif}\;y \leq 1450000000:\\ \;\;\;\;-2 \cdot \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)
(FPCore (x_s x_m y z t)
 :precision binary64
 (let* ((t_1 (/ (* x_m 2.0) (* z y))))
   (*
    x_s
    (if (<= y -3.15e-52)
      t_1
      (if (<= y -2.6e-74)
        (* (/ x_m t) (/ 2.0 (- z)))
        (if (<= y -1.45e-95)
          (* (/ 2.0 z) (/ x_m y))
          (if (<= y 1450000000.0) (* -2.0 (/ (/ x_m z) t)) t_1)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = (x_m * 2.0) / (z * y);
	double tmp;
	if (y <= -3.15e-52) {
		tmp = t_1;
	} else if (y <= -2.6e-74) {
		tmp = (x_m / t) * (2.0 / -z);
	} else if (y <= -1.45e-95) {
		tmp = (2.0 / z) * (x_m / y);
	} else if (y <= 1450000000.0) {
		tmp = -2.0 * ((x_m / z) / t);
	} else {
		tmp = t_1;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 * 2.0d0) / (z * y)
    if (y <= (-3.15d-52)) then
        tmp = t_1
    else if (y <= (-2.6d-74)) then
        tmp = (x_m / t) * (2.0d0 / -z)
    else if (y <= (-1.45d-95)) then
        tmp = (2.0d0 / z) * (x_m / y)
    else if (y <= 1450000000.0d0) then
        tmp = (-2.0d0) * ((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);
public static double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = (x_m * 2.0) / (z * y);
	double tmp;
	if (y <= -3.15e-52) {
		tmp = t_1;
	} else if (y <= -2.6e-74) {
		tmp = (x_m / t) * (2.0 / -z);
	} else if (y <= -1.45e-95) {
		tmp = (2.0 / z) * (x_m / y);
	} else if (y <= 1450000000.0) {
		tmp = -2.0 * ((x_m / z) / t);
	} else {
		tmp = t_1;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	t_1 = (x_m * 2.0) / (z * y)
	tmp = 0
	if y <= -3.15e-52:
		tmp = t_1
	elif y <= -2.6e-74:
		tmp = (x_m / t) * (2.0 / -z)
	elif y <= -1.45e-95:
		tmp = (2.0 / z) * (x_m / y)
	elif y <= 1450000000.0:
		tmp = -2.0 * ((x_m / z) / t)
	else:
		tmp = t_1
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	t_1 = Float64(Float64(x_m * 2.0) / Float64(z * y))
	tmp = 0.0
	if (y <= -3.15e-52)
		tmp = t_1;
	elseif (y <= -2.6e-74)
		tmp = Float64(Float64(x_m / t) * Float64(2.0 / Float64(-z)));
	elseif (y <= -1.45e-95)
		tmp = Float64(Float64(2.0 / z) * Float64(x_m / y));
	elseif (y <= 1450000000.0)
		tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t));
	else
		tmp = t_1;
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z, t)
	t_1 = (x_m * 2.0) / (z * y);
	tmp = 0.0;
	if (y <= -3.15e-52)
		tmp = t_1;
	elseif (y <= -2.6e-74)
		tmp = (x_m / t) * (2.0 / -z);
	elseif (y <= -1.45e-95)
		tmp = (2.0 / z) * (x_m / y);
	elseif (y <= 1450000000.0)
		tmp = -2.0 * ((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]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -3.15e-52], t$95$1, If[LessEqual[y, -2.6e-74], N[(N[(x$95$m / t), $MachinePrecision] * N[(2.0 / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.45e-95], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1450000000.0], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
\begin{array}{l}
t_1 := \frac{x\_m \cdot 2}{z \cdot y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -3.15 \cdot 10^{-52}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -2.6 \cdot 10^{-74}:\\
\;\;\;\;\frac{x\_m}{t} \cdot \frac{2}{-z}\\

\mathbf{elif}\;y \leq -1.45 \cdot 10^{-95}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\

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

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -3.1500000000000002e-52 or 1.45e9 < y

    1. Initial program 92.0%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--94.7%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 84.3%

      \[\leadsto \frac{x \cdot 2}{\color{blue}{y \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative84.3%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot y}} \]
    7. Simplified84.3%

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

    if -3.1500000000000002e-52 < y < -2.6000000000000001e-74

    1. Initial program 78.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--78.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative78.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{t}} \cdot \frac{2}{z} \]
      2. neg-mul-188.8%

        \[\leadsto \frac{\color{blue}{-x}}{t} \cdot \frac{2}{z} \]
    9. Simplified88.8%

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

    if -2.6000000000000001e-74 < y < -1.45000000000000001e-95

    1. Initial program 75.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--75.9%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative75.9%

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

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

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

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

    if -1.45000000000000001e-95 < y < 1.45e9

    1. Initial program 90.6%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--91.7%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 83.3%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative83.3%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified83.3%

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z}}{t}} \]
      2. div-inv84.8%

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

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z} \cdot 1}{t}} \]
      2. *-rgt-identity85.0%

        \[\leadsto -2 \cdot \frac{\color{blue}{\frac{x}{z}}}{t} \]
    11. Simplified85.0%

      \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z}}{t}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification84.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.15 \cdot 10^{-52}:\\ \;\;\;\;\frac{x \cdot 2}{z \cdot y}\\ \mathbf{elif}\;y \leq -2.6 \cdot 10^{-74}:\\ \;\;\;\;\frac{x}{t} \cdot \frac{2}{-z}\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{-95}:\\ \;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq 1450000000:\\ \;\;\;\;-2 \cdot \frac{\frac{x}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot 2}{z \cdot y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 73.9% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_1 := \frac{x\_m \cdot 2}{z \cdot y}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -5.1 \cdot 10^{-51}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -1.2 \cdot 10^{-73}:\\ \;\;\;\;\frac{\frac{-x\_m}{t}}{z \cdot 0.5}\\ \mathbf{elif}\;y \leq -1.35 \cdot 10^{-95}:\\ \;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\ \mathbf{elif}\;y \leq 2400000000:\\ \;\;\;\;-2 \cdot \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)
(FPCore (x_s x_m y z t)
 :precision binary64
 (let* ((t_1 (/ (* x_m 2.0) (* z y))))
   (*
    x_s
    (if (<= y -5.1e-51)
      t_1
      (if (<= y -1.2e-73)
        (/ (/ (- x_m) t) (* z 0.5))
        (if (<= y -1.35e-95)
          (* (/ 2.0 z) (/ x_m y))
          (if (<= y 2400000000.0) (* -2.0 (/ (/ x_m z) t)) t_1)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = (x_m * 2.0) / (z * y);
	double tmp;
	if (y <= -5.1e-51) {
		tmp = t_1;
	} else if (y <= -1.2e-73) {
		tmp = (-x_m / t) / (z * 0.5);
	} else if (y <= -1.35e-95) {
		tmp = (2.0 / z) * (x_m / y);
	} else if (y <= 2400000000.0) {
		tmp = -2.0 * ((x_m / z) / t);
	} else {
		tmp = t_1;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 * 2.0d0) / (z * y)
    if (y <= (-5.1d-51)) then
        tmp = t_1
    else if (y <= (-1.2d-73)) then
        tmp = (-x_m / t) / (z * 0.5d0)
    else if (y <= (-1.35d-95)) then
        tmp = (2.0d0 / z) * (x_m / y)
    else if (y <= 2400000000.0d0) then
        tmp = (-2.0d0) * ((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);
public static double code(double x_s, double x_m, double y, double z, double t) {
	double t_1 = (x_m * 2.0) / (z * y);
	double tmp;
	if (y <= -5.1e-51) {
		tmp = t_1;
	} else if (y <= -1.2e-73) {
		tmp = (-x_m / t) / (z * 0.5);
	} else if (y <= -1.35e-95) {
		tmp = (2.0 / z) * (x_m / y);
	} else if (y <= 2400000000.0) {
		tmp = -2.0 * ((x_m / z) / t);
	} else {
		tmp = t_1;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	t_1 = (x_m * 2.0) / (z * y)
	tmp = 0
	if y <= -5.1e-51:
		tmp = t_1
	elif y <= -1.2e-73:
		tmp = (-x_m / t) / (z * 0.5)
	elif y <= -1.35e-95:
		tmp = (2.0 / z) * (x_m / y)
	elif y <= 2400000000.0:
		tmp = -2.0 * ((x_m / z) / t)
	else:
		tmp = t_1
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	t_1 = Float64(Float64(x_m * 2.0) / Float64(z * y))
	tmp = 0.0
	if (y <= -5.1e-51)
		tmp = t_1;
	elseif (y <= -1.2e-73)
		tmp = Float64(Float64(Float64(-x_m) / t) / Float64(z * 0.5));
	elseif (y <= -1.35e-95)
		tmp = Float64(Float64(2.0 / z) * Float64(x_m / y));
	elseif (y <= 2400000000.0)
		tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t));
	else
		tmp = t_1;
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z, t)
	t_1 = (x_m * 2.0) / (z * y);
	tmp = 0.0;
	if (y <= -5.1e-51)
		tmp = t_1;
	elseif (y <= -1.2e-73)
		tmp = (-x_m / t) / (z * 0.5);
	elseif (y <= -1.35e-95)
		tmp = (2.0 / z) * (x_m / y);
	elseif (y <= 2400000000.0)
		tmp = -2.0 * ((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]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m * 2.0), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -5.1e-51], t$95$1, If[LessEqual[y, -1.2e-73], N[(N[((-x$95$m) / t), $MachinePrecision] / N[(z * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.35e-95], N[(N[(2.0 / z), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2400000000.0], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
\begin{array}{l}
t_1 := \frac{x\_m \cdot 2}{z \cdot y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -5.1 \cdot 10^{-51}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -1.2 \cdot 10^{-73}:\\
\;\;\;\;\frac{\frac{-x\_m}{t}}{z \cdot 0.5}\\

\mathbf{elif}\;y \leq -1.35 \cdot 10^{-95}:\\
\;\;\;\;\frac{2}{z} \cdot \frac{x\_m}{y}\\

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

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -5.0999999999999997e-51 or 2.4e9 < y

    1. Initial program 92.0%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--94.7%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 84.3%

      \[\leadsto \frac{x \cdot 2}{\color{blue}{y \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative84.3%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot y}} \]
    7. Simplified84.3%

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

    if -5.0999999999999997e-51 < y < -1.20000000000000003e-73

    1. Initial program 78.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--78.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-sqr-sqrt44.1%

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot 2} \cdot \sqrt{x \cdot 2}}}{z \cdot \left(y - t\right)} \]
      2. *-commutative44.1%

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

        \[\leadsto \color{blue}{\frac{\sqrt{x \cdot 2}}{y - t} \cdot \frac{\sqrt{x \cdot 2}}{z}} \]
    6. Applied egg-rr44.3%

      \[\leadsto \color{blue}{\frac{\sqrt{x \cdot 2}}{y - t} \cdot \frac{\sqrt{x \cdot 2}}{z}} \]
    7. Step-by-step derivation
      1. frac-times44.1%

        \[\leadsto \color{blue}{\frac{\sqrt{x \cdot 2} \cdot \sqrt{x \cdot 2}}{\left(y - t\right) \cdot z}} \]
      2. add-sqr-sqrt78.5%

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

        \[\leadsto \color{blue}{\frac{x}{y - t} \cdot \frac{2}{z}} \]
      4. clear-num99.7%

        \[\leadsto \frac{x}{y - t} \cdot \color{blue}{\frac{1}{\frac{z}{2}}} \]
      5. un-div-inv99.7%

        \[\leadsto \color{blue}{\frac{\frac{x}{y - t}}{\frac{z}{2}}} \]
      6. div-inv99.7%

        \[\leadsto \frac{\frac{x}{y - t}}{\color{blue}{z \cdot \frac{1}{2}}} \]
      7. metadata-eval99.7%

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

      \[\leadsto \color{blue}{\frac{\frac{x}{y - t}}{z \cdot 0.5}} \]
    9. Taylor expanded in y around 0 88.9%

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{t}} \cdot \frac{2}{z} \]
      2. neg-mul-188.8%

        \[\leadsto \frac{\color{blue}{-x}}{t} \cdot \frac{2}{z} \]
    11. Simplified88.9%

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

    if -1.20000000000000003e-73 < y < -1.35e-95

    1. Initial program 75.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--75.9%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative75.9%

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

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

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

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

    if -1.35e-95 < y < 2.4e9

    1. Initial program 90.6%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--91.7%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 83.3%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative83.3%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified83.3%

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z}}{t}} \]
      2. div-inv84.8%

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

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z} \cdot 1}{t}} \]
      2. *-rgt-identity85.0%

        \[\leadsto -2 \cdot \frac{\color{blue}{\frac{x}{z}}}{t} \]
    11. Simplified85.0%

      \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z}}{t}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification84.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.1 \cdot 10^{-51}:\\ \;\;\;\;\frac{x \cdot 2}{z \cdot y}\\ \mathbf{elif}\;y \leq -1.2 \cdot 10^{-73}:\\ \;\;\;\;\frac{\frac{-x}{t}}{z \cdot 0.5}\\ \mathbf{elif}\;y \leq -1.35 \cdot 10^{-95}:\\ \;\;\;\;\frac{2}{z} \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq 2400000000:\\ \;\;\;\;-2 \cdot \frac{\frac{x}{z}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot 2}{z \cdot y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 74.4% accurate, 0.6× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -4.7 \cdot 10^{-51} \lor \neg \left(y \leq 1900000000\right):\\ \;\;\;\;x\_m \cdot \frac{2}{z \cdot y}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (or (<= y -4.7e-51) (not (<= y 1900000000.0)))
    (* x_m (/ 2.0 (* z y)))
    (* -2.0 (/ (/ x_m z) t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((y <= -4.7e-51) || !(y <= 1900000000.0)) {
		tmp = x_m * (2.0 / (z * y));
	} else {
		tmp = -2.0 * ((x_m / z) / t);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 <= (-4.7d-51)) .or. (.not. (y <= 1900000000.0d0))) then
        tmp = x_m * (2.0d0 / (z * y))
    else
        tmp = (-2.0d0) * ((x_m / z) / t)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((y <= -4.7e-51) || !(y <= 1900000000.0)) {
		tmp = x_m * (2.0 / (z * y));
	} else {
		tmp = -2.0 * ((x_m / z) / t);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	tmp = 0
	if (y <= -4.7e-51) or not (y <= 1900000000.0):
		tmp = x_m * (2.0 / (z * y))
	else:
		tmp = -2.0 * ((x_m / z) / t)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if ((y <= -4.7e-51) || !(y <= 1900000000.0))
		tmp = Float64(x_m * Float64(2.0 / Float64(z * y)));
	else
		tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if ((y <= -4.7e-51) || ~((y <= 1900000000.0)))
		tmp = x_m * (2.0 / (z * y));
	else
		tmp = -2.0 * ((x_m / 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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[y, -4.7e-51], N[Not[LessEqual[y, 1900000000.0]], $MachinePrecision]], N[(x$95$m * N[(2.0 / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -4.7 \cdot 10^{-51} \lor \neg \left(y \leq 1900000000\right):\\
\;\;\;\;x\_m \cdot \frac{2}{z \cdot y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.6999999999999997e-51 or 1.9e9 < y

    1. Initial program 92.0%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--94.7%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 84.3%

      \[\leadsto \frac{x \cdot 2}{\color{blue}{y \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative84.3%

        \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot y}} \]
    7. Simplified84.3%

      \[\leadsto \frac{x \cdot 2}{\color{blue}{z \cdot y}} \]
    8. Step-by-step derivation
      1. associate-/l*84.2%

        \[\leadsto \color{blue}{x \cdot \frac{2}{z \cdot y}} \]
      2. *-commutative84.2%

        \[\leadsto x \cdot \frac{2}{\color{blue}{y \cdot z}} \]
    9. Applied egg-rr84.2%

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

    if -4.6999999999999997e-51 < y < 1.9e9

    1. Initial program 88.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--89.5%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 78.0%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative78.0%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified78.0%

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

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

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

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z} \cdot 1}{t}} \]
      2. *-rgt-identity81.0%

        \[\leadsto -2 \cdot \frac{\color{blue}{\frac{x}{z}}}{t} \]
    11. Simplified81.0%

      \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z}}{t}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification82.8%

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

Alternative 8: 96.9% accurate, 0.7× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;x\_m \cdot 2 \leq 5 \cdot 10^{-41}:\\ \;\;\;\;2 \cdot \frac{\frac{x\_m}{z}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{y - t} \cdot \frac{2}{z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= (* x_m 2.0) 5e-41)
    (* 2.0 (/ (/ x_m z) (- y t)))
    (* (/ x_m (- y t)) (/ 2.0 z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((x_m * 2.0) <= 5e-41) {
		tmp = 2.0 * ((x_m / z) / (y - t));
	} else {
		tmp = (x_m / (y - t)) * (2.0 / z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 ((x_m * 2.0d0) <= 5d-41) then
        tmp = 2.0d0 * ((x_m / z) / (y - t))
    else
        tmp = (x_m / (y - t)) * (2.0d0 / z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((x_m * 2.0) <= 5e-41) {
		tmp = 2.0 * ((x_m / z) / (y - t));
	} else {
		tmp = (x_m / (y - t)) * (2.0 / z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	tmp = 0
	if (x_m * 2.0) <= 5e-41:
		tmp = 2.0 * ((x_m / z) / (y - t))
	else:
		tmp = (x_m / (y - t)) * (2.0 / z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (Float64(x_m * 2.0) <= 5e-41)
		tmp = Float64(2.0 * Float64(Float64(x_m / z) / Float64(y - t)));
	else
		tmp = Float64(Float64(x_m / Float64(y - t)) * Float64(2.0 / z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if ((x_m * 2.0) <= 5e-41)
		tmp = 2.0 * ((x_m / z) / (y - t));
	else
		tmp = (x_m / (y - t)) * (2.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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[N[(x$95$m * 2.0), $MachinePrecision], 5e-41], N[(2.0 * N[(N[(x$95$m / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot 2 \leq 5 \cdot 10^{-41}:\\
\;\;\;\;2 \cdot \frac{\frac{x\_m}{z}}{y - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x #s(literal 2 binary64)) < 4.9999999999999996e-41

    1. Initial program 91.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--93.7%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 93.7%

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

        \[\leadsto 2 \cdot \color{blue}{\frac{\frac{x}{z}}{y - t}} \]
    7. Simplified92.9%

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

    if 4.9999999999999996e-41 < (*.f64 x #s(literal 2 binary64))

    1. Initial program 87.7%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--89.2%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative89.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot 2 \leq 5 \cdot 10^{-41}:\\ \;\;\;\;2 \cdot \frac{\frac{x}{z}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y - t} \cdot \frac{2}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 96.9% accurate, 0.7× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;x\_m \cdot 2 \leq 5 \cdot 10^{-41}:\\ \;\;\;\;\frac{\frac{x\_m}{z \cdot 0.5}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{y - t} \cdot \frac{2}{z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
 :precision binary64
 (*
  x_s
  (if (<= (* x_m 2.0) 5e-41)
    (/ (/ x_m (* z 0.5)) (- y t))
    (* (/ x_m (- y t)) (/ 2.0 z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((x_m * 2.0) <= 5e-41) {
		tmp = (x_m / (z * 0.5)) / (y - t);
	} else {
		tmp = (x_m / (y - t)) * (2.0 / z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 ((x_m * 2.0d0) <= 5d-41) then
        tmp = (x_m / (z * 0.5d0)) / (y - t)
    else
        tmp = (x_m / (y - t)) * (2.0d0 / z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if ((x_m * 2.0) <= 5e-41) {
		tmp = (x_m / (z * 0.5)) / (y - t);
	} else {
		tmp = (x_m / (y - t)) * (2.0 / z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	tmp = 0
	if (x_m * 2.0) <= 5e-41:
		tmp = (x_m / (z * 0.5)) / (y - t)
	else:
		tmp = (x_m / (y - t)) * (2.0 / z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (Float64(x_m * 2.0) <= 5e-41)
		tmp = Float64(Float64(x_m / Float64(z * 0.5)) / Float64(y - t));
	else
		tmp = Float64(Float64(x_m / Float64(y - t)) * Float64(2.0 / z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if ((x_m * 2.0) <= 5e-41)
		tmp = (x_m / (z * 0.5)) / (y - t);
	else
		tmp = (x_m / (y - t)) * (2.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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[N[(x$95$m * 2.0), $MachinePrecision], 5e-41], N[(N[(x$95$m / N[(z * 0.5), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \cdot 2 \leq 5 \cdot 10^{-41}:\\
\;\;\;\;\frac{\frac{x\_m}{z \cdot 0.5}}{y - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x #s(literal 2 binary64)) < 4.9999999999999996e-41

    1. Initial program 91.5%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--93.7%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-sqr-sqrt31.7%

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot 2} \cdot \sqrt{x \cdot 2}}}{z \cdot \left(y - t\right)} \]
      2. *-commutative31.7%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{x \cdot 2}}{y - t} \cdot \frac{\sqrt{x \cdot 2}}{z}} \]
    7. Step-by-step derivation
      1. frac-times31.7%

        \[\leadsto \color{blue}{\frac{\sqrt{x \cdot 2} \cdot \sqrt{x \cdot 2}}{\left(y - t\right) \cdot z}} \]
      2. add-sqr-sqrt93.7%

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

        \[\leadsto \color{blue}{\frac{x}{y - t} \cdot \frac{2}{z}} \]
      4. *-commutative91.2%

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

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{2}}} \cdot \frac{x}{y - t} \]
      6. frac-times93.7%

        \[\leadsto \color{blue}{\frac{1 \cdot x}{\frac{z}{2} \cdot \left(y - t\right)}} \]
      7. *-un-lft-identity93.7%

        \[\leadsto \frac{\color{blue}{x}}{\frac{z}{2} \cdot \left(y - t\right)} \]
      8. div-inv93.7%

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x}{z \cdot 0.5}}{y - t}} \]
    10. Simplified93.0%

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

    if 4.9999999999999996e-41 < (*.f64 x #s(literal 2 binary64))

    1. Initial program 87.7%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--89.2%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative89.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot 2 \leq 5 \cdot 10^{-41}:\\ \;\;\;\;\frac{\frac{x}{z \cdot 0.5}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y - t} \cdot \frac{2}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 55.8% accurate, 0.9× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq 2.5 \cdot 10^{-24}:\\ \;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{\frac{x\_m}{z}}{t}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
 :precision binary64
 (* x_s (if (<= z 2.5e-24) (* -2.0 (/ x_m (* z t))) (* -2.0 (/ (/ x_m z) t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (z <= 2.5e-24) {
		tmp = -2.0 * (x_m / (z * t));
	} else {
		tmp = -2.0 * ((x_m / z) / t);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 <= 2.5d-24) then
        tmp = (-2.0d0) * (x_m / (z * t))
    else
        tmp = (-2.0d0) * ((x_m / z) / t)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
	double tmp;
	if (z <= 2.5e-24) {
		tmp = -2.0 * (x_m / (z * t));
	} else {
		tmp = -2.0 * ((x_m / z) / t);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	tmp = 0
	if z <= 2.5e-24:
		tmp = -2.0 * (x_m / (z * t))
	else:
		tmp = -2.0 * ((x_m / z) / t)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	tmp = 0.0
	if (z <= 2.5e-24)
		tmp = Float64(-2.0 * Float64(x_m / Float64(z * t)));
	else
		tmp = Float64(-2.0 * Float64(Float64(x_m / z) / t));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z, t)
	tmp = 0.0;
	if (z <= 2.5e-24)
		tmp = -2.0 * (x_m / (z * t));
	else
		tmp = -2.0 * ((x_m / 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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, 2.5e-24], N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x$95$m / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 2.5 \cdot 10^{-24}:\\
\;\;\;\;-2 \cdot \frac{x\_m}{z \cdot t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.4999999999999999e-24

    1. Initial program 91.2%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--92.3%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 47.9%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative47.9%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified47.9%

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

    if 2.4999999999999999e-24 < z

    1. Initial program 88.0%

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
    2. Step-by-step derivation
      1. distribute-rgt-out--93.2%

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

      \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 46.2%

      \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
    6. Step-by-step derivation
      1. *-commutative46.2%

        \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
    7. Simplified46.2%

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z}}{t}} \]
      2. div-inv64.1%

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

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z} \cdot 1}{t}} \]
      2. *-rgt-identity64.2%

        \[\leadsto -2 \cdot \frac{\color{blue}{\frac{x}{z}}}{t} \]
    11. Simplified64.2%

      \[\leadsto -2 \cdot \color{blue}{\frac{\frac{x}{z}}{t}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification51.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 2.5 \cdot 10^{-24}:\\ \;\;\;\;-2 \cdot \frac{x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{\frac{x}{z}}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 92.5% accurate, 1.2× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \left(2 \cdot \frac{\frac{x\_m}{z}}{y - t}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
 :precision binary64
 (* x_s (* 2.0 (/ (/ x_m z) (- y t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	return x_s * (2.0 * ((x_m / z) / (y - t)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 * (2.0d0 * ((x_m / z) / (y - t)))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
	return x_s * (2.0 * ((x_m / z) / (y - t)));
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	return x_s * (2.0 * ((x_m / z) / (y - t)))
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	return Float64(x_s * Float64(2.0 * Float64(Float64(x_m / z) / Float64(y - t))))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp = code(x_s, x_m, y, z, t)
	tmp = x_s * (2.0 * ((x_m / z) / (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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(2.0 * N[(N[(x$95$m / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \left(2 \cdot \frac{\frac{x\_m}{z}}{y - t}\right)
\end{array}
Derivation
  1. Initial program 90.5%

    \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
  2. Step-by-step derivation
    1. distribute-rgt-out--92.5%

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

    \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 92.5%

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

      \[\leadsto 2 \cdot \color{blue}{\frac{\frac{x}{z}}{y - t}} \]
  7. Simplified92.2%

    \[\leadsto \color{blue}{2 \cdot \frac{\frac{x}{z}}{y - t}} \]
  8. Final simplification92.2%

    \[\leadsto 2 \cdot \frac{\frac{x}{z}}{y - t} \]
  9. Add Preprocessing

Alternative 12: 53.3% accurate, 1.6× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \left(-2 \cdot \frac{x\_m}{z \cdot t}\right) \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t) :precision binary64 (* x_s (* -2.0 (/ x_m (* z t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
	return x_s * (-2.0 * (x_m / (z * t)));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 * ((-2.0d0) * (x_m / (z * t)))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
	return x_s * (-2.0 * (x_m / (z * t)));
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z, t):
	return x_s * (-2.0 * (x_m / (z * t)))
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z, t)
	return Float64(x_s * Float64(-2.0 * Float64(x_m / Float64(z * t))))
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp = code(x_s, x_m, y, z, t)
	tmp = x_s * (-2.0 * (x_m / (z * 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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(-2.0 * N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \left(-2 \cdot \frac{x\_m}{z \cdot t}\right)
\end{array}
Derivation
  1. Initial program 90.5%

    \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
  2. Step-by-step derivation
    1. distribute-rgt-out--92.5%

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

    \[\leadsto \color{blue}{\frac{x \cdot 2}{z \cdot \left(y - t\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in y around 0 47.6%

    \[\leadsto \color{blue}{-2 \cdot \frac{x}{t \cdot z}} \]
  6. Step-by-step derivation
    1. *-commutative47.6%

      \[\leadsto -2 \cdot \frac{x}{\color{blue}{z \cdot t}} \]
  7. Simplified47.6%

    \[\leadsto \color{blue}{-2 \cdot \frac{x}{z \cdot t}} \]
  8. Final simplification47.6%

    \[\leadsto -2 \cdot \frac{x}{z \cdot t} \]
  9. Add Preprocessing

Developer target: 96.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{\left(y - t\right) \cdot z} \cdot 2\\ t_2 := \frac{x \cdot 2}{y \cdot z - t \cdot z}\\ \mathbf{if}\;t\_2 < -2.559141628295061 \cdot 10^{-13}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 < 1.045027827330126 \cdot 10^{-269}:\\ \;\;\;\;\frac{\frac{x}{z} \cdot 2}{y - t}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (/ x (* (- y t) z)) 2.0))
        (t_2 (/ (* x 2.0) (- (* y z) (* t z)))))
   (if (< t_2 -2.559141628295061e-13)
     t_1
     (if (< t_2 1.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / ((y - t) * z)) * 2.0;
	double t_2 = (x * 2.0) / ((y * z) - (t * z));
	double tmp;
	if (t_2 < -2.559141628295061e-13) {
		tmp = t_1;
	} else if (t_2 < 1.045027827330126e-269) {
		tmp = ((x / z) * 2.0) / (y - t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (x / ((y - t) * z)) * 2.0d0
    t_2 = (x * 2.0d0) / ((y * z) - (t * z))
    if (t_2 < (-2.559141628295061d-13)) then
        tmp = t_1
    else if (t_2 < 1.045027827330126d-269) then
        tmp = ((x / z) * 2.0d0) / (y - t)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (x / ((y - t) * z)) * 2.0;
	double t_2 = (x * 2.0) / ((y * z) - (t * z));
	double tmp;
	if (t_2 < -2.559141628295061e-13) {
		tmp = t_1;
	} else if (t_2 < 1.045027827330126e-269) {
		tmp = ((x / z) * 2.0) / (y - t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / ((y - t) * z)) * 2.0
	t_2 = (x * 2.0) / ((y * z) - (t * z))
	tmp = 0
	if t_2 < -2.559141628295061e-13:
		tmp = t_1
	elif t_2 < 1.045027827330126e-269:
		tmp = ((x / z) * 2.0) / (y - t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / Float64(Float64(y - t) * z)) * 2.0)
	t_2 = Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z)))
	tmp = 0.0
	if (t_2 < -2.559141628295061e-13)
		tmp = t_1;
	elseif (t_2 < 1.045027827330126e-269)
		tmp = Float64(Float64(Float64(x / z) * 2.0) / Float64(y - t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x / ((y - t) * z)) * 2.0;
	t_2 = (x * 2.0) / ((y * z) - (t * z));
	tmp = 0.0;
	if (t_2 < -2.559141628295061e-13)
		tmp = t_1;
	elseif (t_2 < 1.045027827330126e-269)
		tmp = ((x / z) * 2.0) / (y - t);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / N[(N[(y - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -2.559141628295061e-13], t$95$1, If[Less[t$95$2, 1.045027827330126e-269], N[(N[(N[(x / z), $MachinePrecision] * 2.0), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{x}{\left(y - t\right) \cdot z} \cdot 2\\
t_2 := \frac{x \cdot 2}{y \cdot z - t \cdot z}\\
\mathbf{if}\;t\_2 < -2.559141628295061 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 < 1.045027827330126 \cdot 10^{-269}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot 2}{y - t}\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024078 
(FPCore (x y z t)
  :name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
  :precision binary64

  :alt
  (if (< (/ (* x 2.0) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2.0) (if (< (/ (* x 2.0) (- (* y z) (* t z))) 1.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) (* (/ x (* (- y t) z)) 2.0)))

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