Graphics.Rasterific.Shading:$sgradientColorAt from Rasterific-0.6.1

Percentage Accurate: 100.0% → 100.0%
Time: 5.7s
Alternatives: 10
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{x - y}{z - y} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (- x y) (- z y)))
double code(double x, double y, double z) {
	return (x - y) / (z - y);
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x - y) / (z - y)
end function
public static double code(double x, double y, double z) {
	return (x - y) / (z - y);
}
def code(x, y, z):
	return (x - y) / (z - y)
function code(x, y, z)
	return Float64(Float64(x - y) / Float64(z - y))
end
function tmp = code(x, y, z)
	tmp = (x - y) / (z - y);
end
code[x_, y_, z_] := N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x - y}{z - y}
\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 10 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: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x - y}{z - y} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (- x y) (- z y)))
double code(double x, double y, double z) {
	return (x - y) / (z - y);
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x - y) / (z - y)
end function
public static double code(double x, double y, double z) {
	return (x - y) / (z - y);
}
def code(x, y, z):
	return (x - y) / (z - y)
function code(x, y, z)
	return Float64(Float64(x - y) / Float64(z - y))
end
function tmp = code(x, y, z)
	tmp = (x - y) / (z - y);
end
code[x_, y_, z_] := N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x - y}{z - y}
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x - y}{z - y} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (- x y) (- z y)))
double code(double x, double y, double z) {
	return (x - y) / (z - y);
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x - y) / (z - y)
end function
public static double code(double x, double y, double z) {
	return (x - y) / (z - y);
}
def code(x, y, z):
	return (x - y) / (z - y)
function code(x, y, z)
	return Float64(Float64(x - y) / Float64(z - y))
end
function tmp = code(x, y, z)
	tmp = (x - y) / (z - y);
end
code[x_, y_, z_] := N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x - y}{z - y}
\end{array}
Derivation
  1. Initial program 100.0%

    \[\frac{x - y}{z - y} \]
  2. Final simplification100.0%

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

Alternative 2: 66.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \frac{x}{y}\\ \mathbf{if}\;y \leq -1.1 \cdot 10^{+47}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -64000000:\\ \;\;\;\;-\frac{y}{z}\\ \mathbf{elif}\;y \leq -1.02 \cdot 10^{-60} \lor \neg \left(y \leq 1.2 \cdot 10^{-200} \lor \neg \left(y \leq 1.15 \cdot 10^{-107}\right) \land y \leq 2.9 \cdot 10^{-74}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- 1.0 (/ x y))))
   (if (<= y -1.1e+47)
     t_0
     (if (<= y -64000000.0)
       (- (/ y z))
       (if (or (<= y -1.02e-60)
               (not
                (or (<= y 1.2e-200)
                    (and (not (<= y 1.15e-107)) (<= y 2.9e-74)))))
         t_0
         (/ x z))))))
double code(double x, double y, double z) {
	double t_0 = 1.0 - (x / y);
	double tmp;
	if (y <= -1.1e+47) {
		tmp = t_0;
	} else if (y <= -64000000.0) {
		tmp = -(y / z);
	} else if ((y <= -1.02e-60) || !((y <= 1.2e-200) || (!(y <= 1.15e-107) && (y <= 2.9e-74)))) {
		tmp = t_0;
	} else {
		tmp = x / z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 - (x / y)
    if (y <= (-1.1d+47)) then
        tmp = t_0
    else if (y <= (-64000000.0d0)) then
        tmp = -(y / z)
    else if ((y <= (-1.02d-60)) .or. (.not. (y <= 1.2d-200) .or. (.not. (y <= 1.15d-107)) .and. (y <= 2.9d-74))) then
        tmp = t_0
    else
        tmp = x / z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 1.0 - (x / y);
	double tmp;
	if (y <= -1.1e+47) {
		tmp = t_0;
	} else if (y <= -64000000.0) {
		tmp = -(y / z);
	} else if ((y <= -1.02e-60) || !((y <= 1.2e-200) || (!(y <= 1.15e-107) && (y <= 2.9e-74)))) {
		tmp = t_0;
	} else {
		tmp = x / z;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 - (x / y)
	tmp = 0
	if y <= -1.1e+47:
		tmp = t_0
	elif y <= -64000000.0:
		tmp = -(y / z)
	elif (y <= -1.02e-60) or not ((y <= 1.2e-200) or (not (y <= 1.15e-107) and (y <= 2.9e-74))):
		tmp = t_0
	else:
		tmp = x / z
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 - Float64(x / y))
	tmp = 0.0
	if (y <= -1.1e+47)
		tmp = t_0;
	elseif (y <= -64000000.0)
		tmp = Float64(-Float64(y / z));
	elseif ((y <= -1.02e-60) || !((y <= 1.2e-200) || (!(y <= 1.15e-107) && (y <= 2.9e-74))))
		tmp = t_0;
	else
		tmp = Float64(x / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 - (x / y);
	tmp = 0.0;
	if (y <= -1.1e+47)
		tmp = t_0;
	elseif (y <= -64000000.0)
		tmp = -(y / z);
	elseif ((y <= -1.02e-60) || ~(((y <= 1.2e-200) || (~((y <= 1.15e-107)) && (y <= 2.9e-74)))))
		tmp = t_0;
	else
		tmp = x / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.1e+47], t$95$0, If[LessEqual[y, -64000000.0], (-N[(y / z), $MachinePrecision]), If[Or[LessEqual[y, -1.02e-60], N[Not[Or[LessEqual[y, 1.2e-200], And[N[Not[LessEqual[y, 1.15e-107]], $MachinePrecision], LessEqual[y, 2.9e-74]]]], $MachinePrecision]], t$95$0, N[(x / z), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -1.1 \cdot 10^{+47}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq -64000000:\\
\;\;\;\;-\frac{y}{z}\\

\mathbf{elif}\;y \leq -1.02 \cdot 10^{-60} \lor \neg \left(y \leq 1.2 \cdot 10^{-200} \lor \neg \left(y \leq 1.15 \cdot 10^{-107}\right) \land y \leq 2.9 \cdot 10^{-74}\right):\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.1e47 or -6.4e7 < y < -1.01999999999999994e-60 or 1.20000000000000001e-200 < y < 1.15000000000000002e-107 or 2.9e-74 < y

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in z around 0 72.3%

      \[\leadsto \color{blue}{\frac{y - x}{y}} \]
    5. Step-by-step derivation
      1. div-sub72.3%

        \[\leadsto \color{blue}{\frac{y}{y} - \frac{x}{y}} \]
      2. *-inverses72.3%

        \[\leadsto \color{blue}{1} - \frac{x}{y} \]
    6. Simplified72.3%

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

    if -1.1e47 < y < -6.4e7

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in x around 0 81.0%

      \[\leadsto \color{blue}{\frac{y}{y - z}} \]
    5. Taylor expanded in y around 0 71.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{y}{z}} \]
    6. Step-by-step derivation
      1. associate-*r/71.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot y}{z}} \]
      2. neg-mul-171.1%

        \[\leadsto \frac{\color{blue}{-y}}{z} \]
    7. Simplified71.1%

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

    if -1.01999999999999994e-60 < y < 1.20000000000000001e-200 or 1.15000000000000002e-107 < y < 2.9e-74

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

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

      \[\leadsto \color{blue}{\frac{x}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification75.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.1 \cdot 10^{+47}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;y \leq -64000000:\\ \;\;\;\;-\frac{y}{z}\\ \mathbf{elif}\;y \leq -1.02 \cdot 10^{-60} \lor \neg \left(y \leq 1.2 \cdot 10^{-200} \lor \neg \left(y \leq 1.15 \cdot 10^{-107}\right) \land y \leq 2.9 \cdot 10^{-74}\right):\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z}\\ \end{array} \]

Alternative 3: 57.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -\frac{x}{y}\\ \mathbf{if}\;y \leq -7.6 \cdot 10^{+128}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -2.3 \cdot 10^{+51}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{-13}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -1.16 \cdot 10^{-56}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 82:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{+167}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (/ x y))))
   (if (<= y -7.6e+128)
     1.0
     (if (<= y -2.3e+51)
       t_0
       (if (<= y -3.6e-13)
         1.0
         (if (<= y -1.16e-56)
           t_0
           (if (<= y 82.0) (/ x z) (if (<= y 7.5e+167) t_0 1.0))))))))
double code(double x, double y, double z) {
	double t_0 = -(x / y);
	double tmp;
	if (y <= -7.6e+128) {
		tmp = 1.0;
	} else if (y <= -2.3e+51) {
		tmp = t_0;
	} else if (y <= -3.6e-13) {
		tmp = 1.0;
	} else if (y <= -1.16e-56) {
		tmp = t_0;
	} else if (y <= 82.0) {
		tmp = x / z;
	} else if (y <= 7.5e+167) {
		tmp = t_0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -(x / y)
    if (y <= (-7.6d+128)) then
        tmp = 1.0d0
    else if (y <= (-2.3d+51)) then
        tmp = t_0
    else if (y <= (-3.6d-13)) then
        tmp = 1.0d0
    else if (y <= (-1.16d-56)) then
        tmp = t_0
    else if (y <= 82.0d0) then
        tmp = x / z
    else if (y <= 7.5d+167) then
        tmp = t_0
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -(x / y);
	double tmp;
	if (y <= -7.6e+128) {
		tmp = 1.0;
	} else if (y <= -2.3e+51) {
		tmp = t_0;
	} else if (y <= -3.6e-13) {
		tmp = 1.0;
	} else if (y <= -1.16e-56) {
		tmp = t_0;
	} else if (y <= 82.0) {
		tmp = x / z;
	} else if (y <= 7.5e+167) {
		tmp = t_0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -(x / y)
	tmp = 0
	if y <= -7.6e+128:
		tmp = 1.0
	elif y <= -2.3e+51:
		tmp = t_0
	elif y <= -3.6e-13:
		tmp = 1.0
	elif y <= -1.16e-56:
		tmp = t_0
	elif y <= 82.0:
		tmp = x / z
	elif y <= 7.5e+167:
		tmp = t_0
	else:
		tmp = 1.0
	return tmp
function code(x, y, z)
	t_0 = Float64(-Float64(x / y))
	tmp = 0.0
	if (y <= -7.6e+128)
		tmp = 1.0;
	elseif (y <= -2.3e+51)
		tmp = t_0;
	elseif (y <= -3.6e-13)
		tmp = 1.0;
	elseif (y <= -1.16e-56)
		tmp = t_0;
	elseif (y <= 82.0)
		tmp = Float64(x / z);
	elseif (y <= 7.5e+167)
		tmp = t_0;
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -(x / y);
	tmp = 0.0;
	if (y <= -7.6e+128)
		tmp = 1.0;
	elseif (y <= -2.3e+51)
		tmp = t_0;
	elseif (y <= -3.6e-13)
		tmp = 1.0;
	elseif (y <= -1.16e-56)
		tmp = t_0;
	elseif (y <= 82.0)
		tmp = x / z;
	elseif (y <= 7.5e+167)
		tmp = t_0;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = (-N[(x / y), $MachinePrecision])}, If[LessEqual[y, -7.6e+128], 1.0, If[LessEqual[y, -2.3e+51], t$95$0, If[LessEqual[y, -3.6e-13], 1.0, If[LessEqual[y, -1.16e-56], t$95$0, If[LessEqual[y, 82.0], N[(x / z), $MachinePrecision], If[LessEqual[y, 7.5e+167], t$95$0, 1.0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -\frac{x}{y}\\
\mathbf{if}\;y \leq -7.6 \cdot 10^{+128}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq -2.3 \cdot 10^{+51}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq -3.6 \cdot 10^{-13}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq -1.16 \cdot 10^{-56}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 82:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;y \leq 7.5 \cdot 10^{+167}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -7.5999999999999998e128 or -2.30000000000000005e51 < y < -3.5999999999999998e-13 or 7.4999999999999995e167 < y

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

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

      \[\leadsto \color{blue}{1} \]

    if -7.5999999999999998e128 < y < -2.30000000000000005e51 or -3.5999999999999998e-13 < y < -1.1600000000000001e-56 or 82 < y < 7.4999999999999995e167

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in z around 0 70.0%

      \[\leadsto \color{blue}{\frac{y - x}{y}} \]
    5. Step-by-step derivation
      1. div-sub70.0%

        \[\leadsto \color{blue}{\frac{y}{y} - \frac{x}{y}} \]
      2. *-inverses70.0%

        \[\leadsto \color{blue}{1} - \frac{x}{y} \]
    6. Simplified70.0%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{y}} \]
    8. Step-by-step derivation
      1. mul-1-neg52.3%

        \[\leadsto \color{blue}{-\frac{x}{y}} \]
      2. distribute-frac-neg52.3%

        \[\leadsto \color{blue}{\frac{-x}{y}} \]
    9. Simplified52.3%

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

    if -1.1600000000000001e-56 < y < 82

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in y around 0 70.0%

      \[\leadsto \color{blue}{\frac{x}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification64.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.6 \cdot 10^{+128}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -2.3 \cdot 10^{+51}:\\ \;\;\;\;-\frac{x}{y}\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{-13}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -1.16 \cdot 10^{-56}:\\ \;\;\;\;-\frac{x}{y}\\ \mathbf{elif}\;y \leq 82:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{+167}:\\ \;\;\;\;-\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 4: 57.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -\frac{x}{y}\\ \mathbf{if}\;y \leq -7.6 \cdot 10^{+128}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -2.25 \cdot 10^{+50}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -0.235:\\ \;\;\;\;-\frac{y}{z}\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{-56}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 5:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{+167}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (/ x y))))
   (if (<= y -7.6e+128)
     1.0
     (if (<= y -2.25e+50)
       t_0
       (if (<= y -0.235)
         (- (/ y z))
         (if (<= y -1.1e-56)
           t_0
           (if (<= y 5.0) (/ x z) (if (<= y 7.5e+167) t_0 1.0))))))))
double code(double x, double y, double z) {
	double t_0 = -(x / y);
	double tmp;
	if (y <= -7.6e+128) {
		tmp = 1.0;
	} else if (y <= -2.25e+50) {
		tmp = t_0;
	} else if (y <= -0.235) {
		tmp = -(y / z);
	} else if (y <= -1.1e-56) {
		tmp = t_0;
	} else if (y <= 5.0) {
		tmp = x / z;
	} else if (y <= 7.5e+167) {
		tmp = t_0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -(x / y)
    if (y <= (-7.6d+128)) then
        tmp = 1.0d0
    else if (y <= (-2.25d+50)) then
        tmp = t_0
    else if (y <= (-0.235d0)) then
        tmp = -(y / z)
    else if (y <= (-1.1d-56)) then
        tmp = t_0
    else if (y <= 5.0d0) then
        tmp = x / z
    else if (y <= 7.5d+167) then
        tmp = t_0
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -(x / y);
	double tmp;
	if (y <= -7.6e+128) {
		tmp = 1.0;
	} else if (y <= -2.25e+50) {
		tmp = t_0;
	} else if (y <= -0.235) {
		tmp = -(y / z);
	} else if (y <= -1.1e-56) {
		tmp = t_0;
	} else if (y <= 5.0) {
		tmp = x / z;
	} else if (y <= 7.5e+167) {
		tmp = t_0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -(x / y)
	tmp = 0
	if y <= -7.6e+128:
		tmp = 1.0
	elif y <= -2.25e+50:
		tmp = t_0
	elif y <= -0.235:
		tmp = -(y / z)
	elif y <= -1.1e-56:
		tmp = t_0
	elif y <= 5.0:
		tmp = x / z
	elif y <= 7.5e+167:
		tmp = t_0
	else:
		tmp = 1.0
	return tmp
function code(x, y, z)
	t_0 = Float64(-Float64(x / y))
	tmp = 0.0
	if (y <= -7.6e+128)
		tmp = 1.0;
	elseif (y <= -2.25e+50)
		tmp = t_0;
	elseif (y <= -0.235)
		tmp = Float64(-Float64(y / z));
	elseif (y <= -1.1e-56)
		tmp = t_0;
	elseif (y <= 5.0)
		tmp = Float64(x / z);
	elseif (y <= 7.5e+167)
		tmp = t_0;
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -(x / y);
	tmp = 0.0;
	if (y <= -7.6e+128)
		tmp = 1.0;
	elseif (y <= -2.25e+50)
		tmp = t_0;
	elseif (y <= -0.235)
		tmp = -(y / z);
	elseif (y <= -1.1e-56)
		tmp = t_0;
	elseif (y <= 5.0)
		tmp = x / z;
	elseif (y <= 7.5e+167)
		tmp = t_0;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = (-N[(x / y), $MachinePrecision])}, If[LessEqual[y, -7.6e+128], 1.0, If[LessEqual[y, -2.25e+50], t$95$0, If[LessEqual[y, -0.235], (-N[(y / z), $MachinePrecision]), If[LessEqual[y, -1.1e-56], t$95$0, If[LessEqual[y, 5.0], N[(x / z), $MachinePrecision], If[LessEqual[y, 7.5e+167], t$95$0, 1.0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -\frac{x}{y}\\
\mathbf{if}\;y \leq -7.6 \cdot 10^{+128}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq -2.25 \cdot 10^{+50}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq -0.235:\\
\;\;\;\;-\frac{y}{z}\\

\mathbf{elif}\;y \leq -1.1 \cdot 10^{-56}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 5:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;y \leq 7.5 \cdot 10^{+167}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -7.5999999999999998e128 or 7.4999999999999995e167 < y

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

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

      \[\leadsto \color{blue}{1} \]

    if -7.5999999999999998e128 < y < -2.25000000000000007e50 or -0.23499999999999999 < y < -1.10000000000000002e-56 or 5 < y < 7.4999999999999995e167

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in z around 0 71.6%

      \[\leadsto \color{blue}{\frac{y - x}{y}} \]
    5. Step-by-step derivation
      1. div-sub71.6%

        \[\leadsto \color{blue}{\frac{y}{y} - \frac{x}{y}} \]
      2. *-inverses71.6%

        \[\leadsto \color{blue}{1} - \frac{x}{y} \]
    6. Simplified71.6%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{y}} \]
    8. Step-by-step derivation
      1. mul-1-neg49.8%

        \[\leadsto \color{blue}{-\frac{x}{y}} \]
      2. distribute-frac-neg49.8%

        \[\leadsto \color{blue}{\frac{-x}{y}} \]
    9. Simplified49.8%

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

    if -2.25000000000000007e50 < y < -0.23499999999999999

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in x around 0 79.7%

      \[\leadsto \color{blue}{\frac{y}{y - z}} \]
    5. Taylor expanded in y around 0 58.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{y}{z}} \]
    6. Step-by-step derivation
      1. associate-*r/58.6%

        \[\leadsto \color{blue}{\frac{-1 \cdot y}{z}} \]
      2. neg-mul-158.6%

        \[\leadsto \frac{\color{blue}{-y}}{z} \]
    7. Simplified58.6%

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

    if -1.10000000000000002e-56 < y < 5

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in y around 0 70.0%

      \[\leadsto \color{blue}{\frac{x}{z}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification65.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.6 \cdot 10^{+128}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -2.25 \cdot 10^{+50}:\\ \;\;\;\;-\frac{x}{y}\\ \mathbf{elif}\;y \leq -0.235:\\ \;\;\;\;-\frac{y}{z}\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{-56}:\\ \;\;\;\;-\frac{x}{y}\\ \mathbf{elif}\;y \leq 5:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{+167}:\\ \;\;\;\;-\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 5: 67.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.00175:\\ \;\;\;\;\frac{y}{y - z}\\ \mathbf{elif}\;y \leq -2.9 \cdot 10^{-60} \lor \neg \left(y \leq 1.2 \cdot 10^{-200}\right) \land \left(y \leq 7.2 \cdot 10^{-108} \lor \neg \left(y \leq 2.2 \cdot 10^{-74}\right)\right):\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -0.00175)
   (/ y (- y z))
   (if (or (<= y -2.9e-60)
           (and (not (<= y 1.2e-200))
                (or (<= y 7.2e-108) (not (<= y 2.2e-74)))))
     (- 1.0 (/ x y))
     (/ x z))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -0.00175) {
		tmp = y / (y - z);
	} else if ((y <= -2.9e-60) || (!(y <= 1.2e-200) && ((y <= 7.2e-108) || !(y <= 2.2e-74)))) {
		tmp = 1.0 - (x / y);
	} else {
		tmp = x / z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-0.00175d0)) then
        tmp = y / (y - z)
    else if ((y <= (-2.9d-60)) .or. (.not. (y <= 1.2d-200)) .and. (y <= 7.2d-108) .or. (.not. (y <= 2.2d-74))) then
        tmp = 1.0d0 - (x / y)
    else
        tmp = x / z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -0.00175) {
		tmp = y / (y - z);
	} else if ((y <= -2.9e-60) || (!(y <= 1.2e-200) && ((y <= 7.2e-108) || !(y <= 2.2e-74)))) {
		tmp = 1.0 - (x / y);
	} else {
		tmp = x / z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -0.00175:
		tmp = y / (y - z)
	elif (y <= -2.9e-60) or (not (y <= 1.2e-200) and ((y <= 7.2e-108) or not (y <= 2.2e-74))):
		tmp = 1.0 - (x / y)
	else:
		tmp = x / z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -0.00175)
		tmp = Float64(y / Float64(y - z));
	elseif ((y <= -2.9e-60) || (!(y <= 1.2e-200) && ((y <= 7.2e-108) || !(y <= 2.2e-74))))
		tmp = Float64(1.0 - Float64(x / y));
	else
		tmp = Float64(x / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -0.00175)
		tmp = y / (y - z);
	elseif ((y <= -2.9e-60) || (~((y <= 1.2e-200)) && ((y <= 7.2e-108) || ~((y <= 2.2e-74)))))
		tmp = 1.0 - (x / y);
	else
		tmp = x / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -0.00175], N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -2.9e-60], And[N[Not[LessEqual[y, 1.2e-200]], $MachinePrecision], Or[LessEqual[y, 7.2e-108], N[Not[LessEqual[y, 2.2e-74]], $MachinePrecision]]]], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00175:\\
\;\;\;\;\frac{y}{y - z}\\

\mathbf{elif}\;y \leq -2.9 \cdot 10^{-60} \lor \neg \left(y \leq 1.2 \cdot 10^{-200}\right) \land \left(y \leq 7.2 \cdot 10^{-108} \lor \neg \left(y \leq 2.2 \cdot 10^{-74}\right)\right):\\
\;\;\;\;1 - \frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -0.00175000000000000004

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in x around 0 77.3%

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

    if -0.00175000000000000004 < y < -2.8999999999999999e-60 or 1.20000000000000001e-200 < y < 7.2000000000000001e-108 or 2.2000000000000001e-74 < y

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in z around 0 69.6%

      \[\leadsto \color{blue}{\frac{y - x}{y}} \]
    5. Step-by-step derivation
      1. div-sub69.6%

        \[\leadsto \color{blue}{\frac{y}{y} - \frac{x}{y}} \]
      2. *-inverses69.6%

        \[\leadsto \color{blue}{1} - \frac{x}{y} \]
    6. Simplified69.6%

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

    if -2.8999999999999999e-60 < y < 1.20000000000000001e-200 or 7.2000000000000001e-108 < y < 2.2000000000000001e-74

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

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

      \[\leadsto \color{blue}{\frac{x}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification75.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.00175:\\ \;\;\;\;\frac{y}{y - z}\\ \mathbf{elif}\;y \leq -2.9 \cdot 10^{-60} \lor \neg \left(y \leq 1.2 \cdot 10^{-200}\right) \land \left(y \leq 7.2 \cdot 10^{-108} \lor \neg \left(y \leq 2.2 \cdot 10^{-74}\right)\right):\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z}\\ \end{array} \]

Alternative 6: 74.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.00112:\\ \;\;\;\;\frac{y}{y - z}\\ \mathbf{elif}\;y \leq -2.25 \cdot 10^{-58} \lor \neg \left(y \leq 9 \cdot 10^{-144}\right) \land \left(y \leq 7.2 \cdot 10^{-108} \lor \neg \left(y \leq 1.15 \cdot 10^{+27}\right)\right):\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -0.00112)
   (/ y (- y z))
   (if (or (<= y -2.25e-58)
           (and (not (<= y 9e-144))
                (or (<= y 7.2e-108) (not (<= y 1.15e+27)))))
     (- 1.0 (/ x y))
     (/ (- x y) z))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -0.00112) {
		tmp = y / (y - z);
	} else if ((y <= -2.25e-58) || (!(y <= 9e-144) && ((y <= 7.2e-108) || !(y <= 1.15e+27)))) {
		tmp = 1.0 - (x / y);
	} else {
		tmp = (x - y) / z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-0.00112d0)) then
        tmp = y / (y - z)
    else if ((y <= (-2.25d-58)) .or. (.not. (y <= 9d-144)) .and. (y <= 7.2d-108) .or. (.not. (y <= 1.15d+27))) then
        tmp = 1.0d0 - (x / y)
    else
        tmp = (x - y) / z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -0.00112) {
		tmp = y / (y - z);
	} else if ((y <= -2.25e-58) || (!(y <= 9e-144) && ((y <= 7.2e-108) || !(y <= 1.15e+27)))) {
		tmp = 1.0 - (x / y);
	} else {
		tmp = (x - y) / z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -0.00112:
		tmp = y / (y - z)
	elif (y <= -2.25e-58) or (not (y <= 9e-144) and ((y <= 7.2e-108) or not (y <= 1.15e+27))):
		tmp = 1.0 - (x / y)
	else:
		tmp = (x - y) / z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -0.00112)
		tmp = Float64(y / Float64(y - z));
	elseif ((y <= -2.25e-58) || (!(y <= 9e-144) && ((y <= 7.2e-108) || !(y <= 1.15e+27))))
		tmp = Float64(1.0 - Float64(x / y));
	else
		tmp = Float64(Float64(x - y) / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -0.00112)
		tmp = y / (y - z);
	elseif ((y <= -2.25e-58) || (~((y <= 9e-144)) && ((y <= 7.2e-108) || ~((y <= 1.15e+27)))))
		tmp = 1.0 - (x / y);
	else
		tmp = (x - y) / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -0.00112], N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -2.25e-58], And[N[Not[LessEqual[y, 9e-144]], $MachinePrecision], Or[LessEqual[y, 7.2e-108], N[Not[LessEqual[y, 1.15e+27]], $MachinePrecision]]]], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00112:\\
\;\;\;\;\frac{y}{y - z}\\

\mathbf{elif}\;y \leq -2.25 \cdot 10^{-58} \lor \neg \left(y \leq 9 \cdot 10^{-144}\right) \land \left(y \leq 7.2 \cdot 10^{-108} \lor \neg \left(y \leq 1.15 \cdot 10^{+27}\right)\right):\\
\;\;\;\;1 - \frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -0.0011199999999999999

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in x around 0 77.3%

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

    if -0.0011199999999999999 < y < -2.2500000000000001e-58 or 8.9999999999999996e-144 < y < 7.2000000000000001e-108 or 1.15e27 < y

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in z around 0 78.9%

      \[\leadsto \color{blue}{\frac{y - x}{y}} \]
    5. Step-by-step derivation
      1. div-sub78.9%

        \[\leadsto \color{blue}{\frac{y}{y} - \frac{x}{y}} \]
      2. *-inverses78.9%

        \[\leadsto \color{blue}{1} - \frac{x}{y} \]
    6. Simplified78.9%

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

    if -2.2500000000000001e-58 < y < 8.9999999999999996e-144 or 7.2000000000000001e-108 < y < 1.15e27

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(y - x\right)}{z}} \]
      2. neg-mul-181.1%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-y\right) + x}{z}} \]
    7. Taylor expanded in y around 0 81.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{y}{z} + \frac{x}{z}} \]
    8. Step-by-step derivation
      1. +-commutative81.1%

        \[\leadsto \color{blue}{\frac{x}{z} + -1 \cdot \frac{y}{z}} \]
      2. mul-1-neg81.1%

        \[\leadsto \frac{x}{z} + \color{blue}{\left(-\frac{y}{z}\right)} \]
      3. sub-neg81.1%

        \[\leadsto \color{blue}{\frac{x}{z} - \frac{y}{z}} \]
      4. div-sub81.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.00112:\\ \;\;\;\;\frac{y}{y - z}\\ \mathbf{elif}\;y \leq -2.25 \cdot 10^{-58} \lor \neg \left(y \leq 9 \cdot 10^{-144}\right) \land \left(y \leq 7.2 \cdot 10^{-108} \lor \neg \left(y \leq 1.15 \cdot 10^{+27}\right)\right):\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - y}{z}\\ \end{array} \]

Alternative 7: 74.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x - y}{z}\\ t_1 := 1 - \frac{x}{y}\\ \mathbf{if}\;y \leq -0.74:\\ \;\;\;\;\frac{y}{y - z}\\ \mathbf{elif}\;y \leq -4.6 \cdot 10^{-60}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-144}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{-108}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 10^{+27}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{y - x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (- x y) z)) (t_1 (- 1.0 (/ x y))))
   (if (<= y -0.74)
     (/ y (- y z))
     (if (<= y -4.6e-60)
       t_1
       (if (<= y 9e-144)
         t_0
         (if (<= y 7.6e-108) t_1 (if (<= y 1e+27) t_0 (/ (- y x) y))))))))
double code(double x, double y, double z) {
	double t_0 = (x - y) / z;
	double t_1 = 1.0 - (x / y);
	double tmp;
	if (y <= -0.74) {
		tmp = y / (y - z);
	} else if (y <= -4.6e-60) {
		tmp = t_1;
	} else if (y <= 9e-144) {
		tmp = t_0;
	} else if (y <= 7.6e-108) {
		tmp = t_1;
	} else if (y <= 1e+27) {
		tmp = t_0;
	} else {
		tmp = (y - x) / y;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (x - y) / z
    t_1 = 1.0d0 - (x / y)
    if (y <= (-0.74d0)) then
        tmp = y / (y - z)
    else if (y <= (-4.6d-60)) then
        tmp = t_1
    else if (y <= 9d-144) then
        tmp = t_0
    else if (y <= 7.6d-108) then
        tmp = t_1
    else if (y <= 1d+27) then
        tmp = t_0
    else
        tmp = (y - x) / y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x - y) / z;
	double t_1 = 1.0 - (x / y);
	double tmp;
	if (y <= -0.74) {
		tmp = y / (y - z);
	} else if (y <= -4.6e-60) {
		tmp = t_1;
	} else if (y <= 9e-144) {
		tmp = t_0;
	} else if (y <= 7.6e-108) {
		tmp = t_1;
	} else if (y <= 1e+27) {
		tmp = t_0;
	} else {
		tmp = (y - x) / y;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x - y) / z
	t_1 = 1.0 - (x / y)
	tmp = 0
	if y <= -0.74:
		tmp = y / (y - z)
	elif y <= -4.6e-60:
		tmp = t_1
	elif y <= 9e-144:
		tmp = t_0
	elif y <= 7.6e-108:
		tmp = t_1
	elif y <= 1e+27:
		tmp = t_0
	else:
		tmp = (y - x) / y
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x - y) / z)
	t_1 = Float64(1.0 - Float64(x / y))
	tmp = 0.0
	if (y <= -0.74)
		tmp = Float64(y / Float64(y - z));
	elseif (y <= -4.6e-60)
		tmp = t_1;
	elseif (y <= 9e-144)
		tmp = t_0;
	elseif (y <= 7.6e-108)
		tmp = t_1;
	elseif (y <= 1e+27)
		tmp = t_0;
	else
		tmp = Float64(Float64(y - x) / y);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x - y) / z;
	t_1 = 1.0 - (x / y);
	tmp = 0.0;
	if (y <= -0.74)
		tmp = y / (y - z);
	elseif (y <= -4.6e-60)
		tmp = t_1;
	elseif (y <= 9e-144)
		tmp = t_0;
	elseif (y <= 7.6e-108)
		tmp = t_1;
	elseif (y <= 1e+27)
		tmp = t_0;
	else
		tmp = (y - x) / y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.74], N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4.6e-60], t$95$1, If[LessEqual[y, 9e-144], t$95$0, If[LessEqual[y, 7.6e-108], t$95$1, If[LessEqual[y, 1e+27], t$95$0, N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x - y}{z}\\
t_1 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -0.74:\\
\;\;\;\;\frac{y}{y - z}\\

\mathbf{elif}\;y \leq -4.6 \cdot 10^{-60}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 9 \cdot 10^{-144}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 7.6 \cdot 10^{-108}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 10^{+27}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in x around 0 77.3%

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

    if -0.73999999999999999 < y < -4.6000000000000003e-60 or 8.9999999999999996e-144 < y < 7.59999999999999947e-108

    1. Initial program 99.9%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(y - x\right)}}{z - y} \]
      7. sub-neg99.9%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{z + \left(-y\right)}} \]
      8. +-commutative99.9%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub099.9%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-99.9%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg99.9%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-199.9%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval99.9%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity99.9%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in z around 0 80.3%

      \[\leadsto \color{blue}{\frac{y - x}{y}} \]
    5. Step-by-step derivation
      1. div-sub80.4%

        \[\leadsto \color{blue}{\frac{y}{y} - \frac{x}{y}} \]
      2. *-inverses80.4%

        \[\leadsto \color{blue}{1} - \frac{x}{y} \]
    6. Simplified80.4%

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

    if -4.6000000000000003e-60 < y < 8.9999999999999996e-144 or 7.59999999999999947e-108 < y < 1e27

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(y - x\right)}{z}} \]
      2. neg-mul-181.1%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-y\right) + x}{z}} \]
    7. Taylor expanded in y around 0 81.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{y}{z} + \frac{x}{z}} \]
    8. Step-by-step derivation
      1. +-commutative81.1%

        \[\leadsto \color{blue}{\frac{x}{z} + -1 \cdot \frac{y}{z}} \]
      2. mul-1-neg81.1%

        \[\leadsto \frac{x}{z} + \color{blue}{\left(-\frac{y}{z}\right)} \]
      3. sub-neg81.1%

        \[\leadsto \color{blue}{\frac{x}{z} - \frac{y}{z}} \]
      4. div-sub81.1%

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

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

    if 1e27 < y

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in z around 0 78.1%

      \[\leadsto \color{blue}{\frac{y - x}{y}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification79.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.74:\\ \;\;\;\;\frac{y}{y - z}\\ \mathbf{elif}\;y \leq -4.6 \cdot 10^{-60}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-144}:\\ \;\;\;\;\frac{x - y}{z}\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{-108}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;y \leq 10^{+27}:\\ \;\;\;\;\frac{x - y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - x}{y}\\ \end{array} \]

Alternative 8: 75.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x}{y - z}\\ \mathbf{if}\;x \leq -5.6 \cdot 10^{-6}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -4.2 \cdot 10^{-96}:\\ \;\;\;\;\frac{x - y}{z}\\ \mathbf{elif}\;x \leq -1.76 \cdot 10^{-124} \lor \neg \left(x \leq 7 \cdot 10^{-82}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{y - z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (- x) (- y z))))
   (if (<= x -5.6e-6)
     t_0
     (if (<= x -4.2e-96)
       (/ (- x y) z)
       (if (or (<= x -1.76e-124) (not (<= x 7e-82))) t_0 (/ y (- y z)))))))
double code(double x, double y, double z) {
	double t_0 = -x / (y - z);
	double tmp;
	if (x <= -5.6e-6) {
		tmp = t_0;
	} else if (x <= -4.2e-96) {
		tmp = (x - y) / z;
	} else if ((x <= -1.76e-124) || !(x <= 7e-82)) {
		tmp = t_0;
	} else {
		tmp = y / (y - z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -x / (y - z)
    if (x <= (-5.6d-6)) then
        tmp = t_0
    else if (x <= (-4.2d-96)) then
        tmp = (x - y) / z
    else if ((x <= (-1.76d-124)) .or. (.not. (x <= 7d-82))) then
        tmp = t_0
    else
        tmp = y / (y - z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = -x / (y - z);
	double tmp;
	if (x <= -5.6e-6) {
		tmp = t_0;
	} else if (x <= -4.2e-96) {
		tmp = (x - y) / z;
	} else if ((x <= -1.76e-124) || !(x <= 7e-82)) {
		tmp = t_0;
	} else {
		tmp = y / (y - z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = -x / (y - z)
	tmp = 0
	if x <= -5.6e-6:
		tmp = t_0
	elif x <= -4.2e-96:
		tmp = (x - y) / z
	elif (x <= -1.76e-124) or not (x <= 7e-82):
		tmp = t_0
	else:
		tmp = y / (y - z)
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(-x) / Float64(y - z))
	tmp = 0.0
	if (x <= -5.6e-6)
		tmp = t_0;
	elseif (x <= -4.2e-96)
		tmp = Float64(Float64(x - y) / z);
	elseif ((x <= -1.76e-124) || !(x <= 7e-82))
		tmp = t_0;
	else
		tmp = Float64(y / Float64(y - z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = -x / (y - z);
	tmp = 0.0;
	if (x <= -5.6e-6)
		tmp = t_0;
	elseif (x <= -4.2e-96)
		tmp = (x - y) / z;
	elseif ((x <= -1.76e-124) || ~((x <= 7e-82)))
		tmp = t_0;
	else
		tmp = y / (y - z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[((-x) / N[(y - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.6e-6], t$95$0, If[LessEqual[x, -4.2e-96], N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision], If[Or[LessEqual[x, -1.76e-124], N[Not[LessEqual[x, 7e-82]], $MachinePrecision]], t$95$0, N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-x}{y - z}\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{-6}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq -4.2 \cdot 10^{-96}:\\
\;\;\;\;\frac{x - y}{z}\\

\mathbf{elif}\;x \leq -1.76 \cdot 10^{-124} \lor \neg \left(x \leq 7 \cdot 10^{-82}\right):\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -5.59999999999999975e-6 or -4.20000000000000002e-96 < x < -1.75999999999999996e-124 or 6.9999999999999997e-82 < x

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{y - z}} \]
    5. Step-by-step derivation
      1. neg-mul-179.7%

        \[\leadsto \color{blue}{-\frac{x}{y - z}} \]
      2. distribute-neg-frac79.7%

        \[\leadsto \color{blue}{\frac{-x}{y - z}} \]
    6. Simplified79.7%

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

    if -5.59999999999999975e-6 < x < -4.20000000000000002e-96

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(y - x\right)}{z}} \]
      2. neg-mul-190.8%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-y\right) + x}{z}} \]
    7. Taylor expanded in y around 0 90.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{y}{z} + \frac{x}{z}} \]
    8. Step-by-step derivation
      1. +-commutative90.8%

        \[\leadsto \color{blue}{\frac{x}{z} + -1 \cdot \frac{y}{z}} \]
      2. mul-1-neg90.8%

        \[\leadsto \frac{x}{z} + \color{blue}{\left(-\frac{y}{z}\right)} \]
      3. sub-neg90.8%

        \[\leadsto \color{blue}{\frac{x}{z} - \frac{y}{z}} \]
      4. div-sub90.8%

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

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

    if -1.75999999999999996e-124 < x < 6.9999999999999997e-82

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in x around 0 89.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.6 \cdot 10^{-6}:\\ \;\;\;\;\frac{-x}{y - z}\\ \mathbf{elif}\;x \leq -4.2 \cdot 10^{-96}:\\ \;\;\;\;\frac{x - y}{z}\\ \mathbf{elif}\;x \leq -1.76 \cdot 10^{-124} \lor \neg \left(x \leq 7 \cdot 10^{-82}\right):\\ \;\;\;\;\frac{-x}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{y - z}\\ \end{array} \]

Alternative 9: 61.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{-54}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+16}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -2.5e-54) 1.0 (if (<= y 1.1e+16) (/ x z) 1.0)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -2.5e-54) {
		tmp = 1.0;
	} else if (y <= 1.1e+16) {
		tmp = x / z;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-2.5d-54)) then
        tmp = 1.0d0
    else if (y <= 1.1d+16) then
        tmp = x / z
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -2.5e-54) {
		tmp = 1.0;
	} else if (y <= 1.1e+16) {
		tmp = x / z;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -2.5e-54:
		tmp = 1.0
	elif y <= 1.1e+16:
		tmp = x / z
	else:
		tmp = 1.0
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -2.5e-54)
		tmp = 1.0;
	elseif (y <= 1.1e+16)
		tmp = Float64(x / z);
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -2.5e-54)
		tmp = 1.0;
	elseif (y <= 1.1e+16)
		tmp = x / z;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -2.5e-54], 1.0, If[LessEqual[y, 1.1e+16], N[(x / z), $MachinePrecision], 1.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{-54}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq 1.1 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.50000000000000008e-54 or 1.1e16 < y

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

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

      \[\leadsto \color{blue}{1} \]

    if -2.50000000000000008e-54 < y < 1.1e16

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
      9. neg-sub0100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
      10. associate-+l-100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
      11. sub0-neg100.0%

        \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
      12. neg-mul-1100.0%

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

        \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
      14. metadata-eval100.0%

        \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
      15. *-lft-identity100.0%

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

      \[\leadsto \color{blue}{\frac{y - x}{y - z}} \]
    4. Taylor expanded in y around 0 68.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{-54}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+16}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 10: 35.1% accurate, 7.0× speedup?

\[\begin{array}{l} \\ 1 \end{array} \]
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
	return 1.0;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = 1.0d0
end function
public static double code(double x, double y, double z) {
	return 1.0;
}
def code(x, y, z):
	return 1.0
function code(x, y, z)
	return 1.0
end
function tmp = code(x, y, z)
	tmp = 1.0;
end
code[x_, y_, z_] := 1.0
\begin{array}{l}

\\
1
\end{array}
Derivation
  1. Initial program 100.0%

    \[\frac{x - y}{z - y} \]
  2. Step-by-step derivation
    1. sub-neg100.0%

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(-y\right) + z}} \]
    9. neg-sub0100.0%

      \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{\left(0 - y\right)} + z} \]
    10. associate-+l-100.0%

      \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{0 - \left(y - z\right)}} \]
    11. sub0-neg100.0%

      \[\leadsto \frac{-1 \cdot \left(y - x\right)}{\color{blue}{-\left(y - z\right)}} \]
    12. neg-mul-1100.0%

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

      \[\leadsto \color{blue}{\frac{-1}{-1} \cdot \frac{y - x}{y - z}} \]
    14. metadata-eval100.0%

      \[\leadsto \color{blue}{1} \cdot \frac{y - x}{y - z} \]
    15. *-lft-identity100.0%

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

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

    \[\leadsto \color{blue}{1} \]
  5. Final simplification26.4%

    \[\leadsto 1 \]

Developer target: 100.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \frac{x}{z - y} - \frac{y}{z - y} \end{array} \]
(FPCore (x y z) :precision binary64 (- (/ x (- z y)) (/ y (- z y))))
double code(double x, double y, double z) {
	return (x / (z - y)) - (y / (z - y));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x / (z - y)) - (y / (z - y))
end function
public static double code(double x, double y, double z) {
	return (x / (z - y)) - (y / (z - y));
}
def code(x, y, z):
	return (x / (z - y)) - (y / (z - y))
function code(x, y, z)
	return Float64(Float64(x / Float64(z - y)) - Float64(y / Float64(z - y)))
end
function tmp = code(x, y, z)
	tmp = (x / (z - y)) - (y / (z - y));
end
code[x_, y_, z_] := N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] - N[(y / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x}{z - y} - \frac{y}{z - y}
\end{array}

Reproduce

?
herbie shell --seed 2023240 
(FPCore (x y z)
  :name "Graphics.Rasterific.Shading:$sgradientColorAt from Rasterific-0.6.1"
  :precision binary64

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

  (/ (- x y) (- z y)))