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

Percentage Accurate: 100.0% → 100.0%
Time: 8.0s
Alternatives: 12
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 12 alternatives:

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

Initial Program: 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, 0.6× speedup?

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

\\
\frac{y}{y - z} - \frac{x}{y - z}
\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. Step-by-step derivation
    1. div-sub100.0%

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

    \[\leadsto \color{blue}{\frac{y}{y - z} - \frac{x}{y - z}} \]
  6. Final simplification100.0%

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

Alternative 2: 75.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{+102}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;y \leq -1.22 \cdot 10^{-55}:\\ \;\;\;\;\frac{x - y}{z}\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{+57}:\\ \;\;\;\;\frac{-x}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -4.5e+102)
   (- 1.0 (/ x y))
   (if (<= y -1.22e-55)
     (/ (- x y) z)
     (if (<= y 1.25e+57) (/ (- x) (- y z)) (/ (- y x) y)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -4.5e+102) {
		tmp = 1.0 - (x / y);
	} else if (y <= -1.22e-55) {
		tmp = (x - y) / z;
	} else if (y <= 1.25e+57) {
		tmp = -x / (y - z);
	} 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) :: tmp
    if (y <= (-4.5d+102)) then
        tmp = 1.0d0 - (x / y)
    else if (y <= (-1.22d-55)) then
        tmp = (x - y) / z
    else if (y <= 1.25d+57) then
        tmp = -x / (y - z)
    else
        tmp = (y - x) / y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -4.5e+102) {
		tmp = 1.0 - (x / y);
	} else if (y <= -1.22e-55) {
		tmp = (x - y) / z;
	} else if (y <= 1.25e+57) {
		tmp = -x / (y - z);
	} else {
		tmp = (y - x) / y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -4.5e+102:
		tmp = 1.0 - (x / y)
	elif y <= -1.22e-55:
		tmp = (x - y) / z
	elif y <= 1.25e+57:
		tmp = -x / (y - z)
	else:
		tmp = (y - x) / y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -4.5e+102)
		tmp = Float64(1.0 - Float64(x / y));
	elseif (y <= -1.22e-55)
		tmp = Float64(Float64(x - y) / z);
	elseif (y <= 1.25e+57)
		tmp = Float64(Float64(-x) / Float64(y - z));
	else
		tmp = Float64(Float64(y - x) / y);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -4.5e+102)
		tmp = 1.0 - (x / y);
	elseif (y <= -1.22e-55)
		tmp = (x - y) / z;
	elseif (y <= 1.25e+57)
		tmp = -x / (y - z);
	else
		tmp = (y - x) / y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -4.5e+102], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.22e-55], N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 1.25e+57], N[((-x) / N[(y - z), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+102}:\\
\;\;\;\;1 - \frac{x}{y}\\

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

\mathbf{elif}\;y \leq 1.25 \cdot 10^{+57}:\\
\;\;\;\;\frac{-x}{y - z}\\

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


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

    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 82.8%

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

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

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

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

    if -4.50000000000000021e102 < y < -1.22e-55

    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. Step-by-step derivation
      1. div-sub100.0%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-y}}{z} \]
    8. Simplified77.7%

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

      \[\leadsto \color{blue}{\frac{-1 \cdot y - -1 \cdot x}{z}} \]
    10. Step-by-step derivation
      1. cancel-sign-sub-inv68.0%

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

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

        \[\leadsto \frac{-1 \cdot y + \color{blue}{x}}{z} \]
      4. +-commutative68.0%

        \[\leadsto \frac{\color{blue}{x + -1 \cdot y}}{z} \]
      5. mul-1-neg68.0%

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

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

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

    if -1.22e-55 < y < 1.24999999999999993e57

    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 88.7%

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

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

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

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

    if 1.24999999999999993e57 < 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 77.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{+102}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;y \leq -1.22 \cdot 10^{-55}:\\ \;\;\;\;\frac{x - y}{z}\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{+57}:\\ \;\;\;\;\frac{-x}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - x}{y}\\ \end{array} \]

Alternative 3: 75.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{+102}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;y \leq -9.6 \cdot 10^{-58}:\\ \;\;\;\;\frac{x}{z} - \frac{y}{z}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+55}:\\ \;\;\;\;\frac{-x}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -4.8e+102)
   (- 1.0 (/ x y))
   (if (<= y -9.6e-58)
     (- (/ x z) (/ y z))
     (if (<= y 4.2e+55) (/ (- x) (- y z)) (/ (- y x) y)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -4.8e+102) {
		tmp = 1.0 - (x / y);
	} else if (y <= -9.6e-58) {
		tmp = (x / z) - (y / z);
	} else if (y <= 4.2e+55) {
		tmp = -x / (y - z);
	} 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) :: tmp
    if (y <= (-4.8d+102)) then
        tmp = 1.0d0 - (x / y)
    else if (y <= (-9.6d-58)) then
        tmp = (x / z) - (y / z)
    else if (y <= 4.2d+55) then
        tmp = -x / (y - z)
    else
        tmp = (y - x) / y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -4.8e+102) {
		tmp = 1.0 - (x / y);
	} else if (y <= -9.6e-58) {
		tmp = (x / z) - (y / z);
	} else if (y <= 4.2e+55) {
		tmp = -x / (y - z);
	} else {
		tmp = (y - x) / y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -4.8e+102:
		tmp = 1.0 - (x / y)
	elif y <= -9.6e-58:
		tmp = (x / z) - (y / z)
	elif y <= 4.2e+55:
		tmp = -x / (y - z)
	else:
		tmp = (y - x) / y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -4.8e+102)
		tmp = Float64(1.0 - Float64(x / y));
	elseif (y <= -9.6e-58)
		tmp = Float64(Float64(x / z) - Float64(y / z));
	elseif (y <= 4.2e+55)
		tmp = Float64(Float64(-x) / Float64(y - z));
	else
		tmp = Float64(Float64(y - x) / y);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -4.8e+102)
		tmp = 1.0 - (x / y);
	elseif (y <= -9.6e-58)
		tmp = (x / z) - (y / z);
	elseif (y <= 4.2e+55)
		tmp = -x / (y - z);
	else
		tmp = (y - x) / y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -4.8e+102], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -9.6e-58], N[(N[(x / z), $MachinePrecision] - N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e+55], N[((-x) / N[(y - z), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{+102}:\\
\;\;\;\;1 - \frac{x}{y}\\

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

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

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


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

    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 82.8%

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

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

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

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

    if -4.79999999999999989e102 < y < -9.6000000000000002e-58

    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. Step-by-step derivation
      1. div-sub100.0%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-y}}{z} \]
    8. Simplified77.7%

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

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

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

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

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

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

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

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

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

    if -9.6000000000000002e-58 < y < 4.2000000000000001e55

    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 88.7%

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

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

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

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

    if 4.2000000000000001e55 < 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 77.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{+102}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;y \leq -9.6 \cdot 10^{-58}:\\ \;\;\;\;\frac{x}{z} - \frac{y}{z}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+55}:\\ \;\;\;\;\frac{-x}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - x}{y}\\ \end{array} \]

Alternative 4: 60.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7.2 \cdot 10^{+104}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -6.5 \cdot 10^{-29}:\\ \;\;\;\;\frac{-x}{y}\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{+55}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -7.2e+104)
   1.0
   (if (<= y -6.5e-29) (/ (- x) y) (if (<= y 4.6e+55) (/ x z) 1.0))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -7.2e+104) {
		tmp = 1.0;
	} else if (y <= -6.5e-29) {
		tmp = -x / y;
	} else if (y <= 4.6e+55) {
		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 <= (-7.2d+104)) then
        tmp = 1.0d0
    else if (y <= (-6.5d-29)) then
        tmp = -x / y
    else if (y <= 4.6d+55) 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 <= -7.2e+104) {
		tmp = 1.0;
	} else if (y <= -6.5e-29) {
		tmp = -x / y;
	} else if (y <= 4.6e+55) {
		tmp = x / z;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -7.2e+104:
		tmp = 1.0
	elif y <= -6.5e-29:
		tmp = -x / y
	elif y <= 4.6e+55:
		tmp = x / z
	else:
		tmp = 1.0
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -7.2e+104)
		tmp = 1.0;
	elseif (y <= -6.5e-29)
		tmp = Float64(Float64(-x) / y);
	elseif (y <= 4.6e+55)
		tmp = Float64(x / z);
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -7.2e+104)
		tmp = 1.0;
	elseif (y <= -6.5e-29)
		tmp = -x / y;
	elseif (y <= 4.6e+55)
		tmp = x / z;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -7.2e+104], 1.0, If[LessEqual[y, -6.5e-29], N[((-x) / y), $MachinePrecision], If[LessEqual[y, 4.6e+55], N[(x / z), $MachinePrecision], 1.0]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+104}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq -6.5 \cdot 10^{-29}:\\
\;\;\;\;\frac{-x}{y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -7.20000000000000001e104 or 4.59999999999999975e55 < 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 63.4%

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

    if -7.20000000000000001e104 < y < -6.5e-29

    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 49.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{y}} \]
      2. mul-1-neg36.5%

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

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

    if -6.5e-29 < y < 4.59999999999999975e55

    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 72.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.2 \cdot 10^{+104}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -6.5 \cdot 10^{-29}:\\ \;\;\;\;\frac{-x}{y}\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{+55}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 5: 60.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{+102}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -9.8 \cdot 10^{-26}:\\ \;\;\;\;\frac{-y}{z}\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+55}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -4.5e+102)
   1.0
   (if (<= y -9.8e-26) (/ (- y) z) (if (<= y 3.2e+55) (/ x z) 1.0))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -4.5e+102) {
		tmp = 1.0;
	} else if (y <= -9.8e-26) {
		tmp = -y / z;
	} else if (y <= 3.2e+55) {
		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 <= (-4.5d+102)) then
        tmp = 1.0d0
    else if (y <= (-9.8d-26)) then
        tmp = -y / z
    else if (y <= 3.2d+55) 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 <= -4.5e+102) {
		tmp = 1.0;
	} else if (y <= -9.8e-26) {
		tmp = -y / z;
	} else if (y <= 3.2e+55) {
		tmp = x / z;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -4.5e+102:
		tmp = 1.0
	elif y <= -9.8e-26:
		tmp = -y / z
	elif y <= 3.2e+55:
		tmp = x / z
	else:
		tmp = 1.0
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -4.5e+102)
		tmp = 1.0;
	elseif (y <= -9.8e-26)
		tmp = Float64(Float64(-y) / z);
	elseif (y <= 3.2e+55)
		tmp = Float64(x / z);
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -4.5e+102)
		tmp = 1.0;
	elseif (y <= -9.8e-26)
		tmp = -y / z;
	elseif (y <= 3.2e+55)
		tmp = x / z;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -4.5e+102], 1.0, If[LessEqual[y, -9.8e-26], N[((-y) / z), $MachinePrecision], If[LessEqual[y, 3.2e+55], N[(x / z), $MachinePrecision], 1.0]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+102}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq -9.8 \cdot 10^{-26}:\\
\;\;\;\;\frac{-y}{z}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.50000000000000021e102 or 3.2000000000000003e55 < 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 62.7%

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

    if -4.50000000000000021e102 < y < -9.7999999999999998e-26

    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 54.3%

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

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

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

        \[\leadsto \frac{\color{blue}{-y}}{z} \]
    7. Simplified45.8%

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

    if -9.7999999999999998e-26 < y < 3.2000000000000003e55

    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 72.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{+102}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -9.8 \cdot 10^{-26}:\\ \;\;\;\;\frac{-y}{z}\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+55}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 6: 68.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7.6 \cdot 10^{-29} \lor \neg \left(y \leq 3.2 \cdot 10^{+55}\right):\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -7.6e-29) (not (<= y 3.2e+55))) (- 1.0 (/ x y)) (/ x z)))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -7.6e-29) || !(y <= 3.2e+55)) {
		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 <= (-7.6d-29)) .or. (.not. (y <= 3.2d+55))) 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 <= -7.6e-29) || !(y <= 3.2e+55)) {
		tmp = 1.0 - (x / y);
	} else {
		tmp = x / z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -7.6e-29) or not (y <= 3.2e+55):
		tmp = 1.0 - (x / y)
	else:
		tmp = x / z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -7.6e-29) || !(y <= 3.2e+55))
		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 <= -7.6e-29) || ~((y <= 3.2e+55)))
		tmp = 1.0 - (x / y);
	else
		tmp = x / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -7.6e-29], N[Not[LessEqual[y, 3.2e+55]], $MachinePrecision]], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{-29} \lor \neg \left(y \leq 3.2 \cdot 10^{+55}\right):\\
\;\;\;\;1 - \frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.59999999999999951e-29 or 3.2000000000000003e55 < 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.5%

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

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

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

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

    if -7.59999999999999951e-29 < y < 3.2000000000000003e55

    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 72.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.6 \cdot 10^{-29} \lor \neg \left(y \leq 3.2 \cdot 10^{+55}\right):\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z}\\ \end{array} \]

Alternative 7: 74.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{+102} \lor \neg \left(y \leq 3 \cdot 10^{+55}\right):\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -4.5e+102) (not (<= y 3e+55))) (- 1.0 (/ x y)) (/ (- x y) z)))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -4.5e+102) || !(y <= 3e+55)) {
		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 <= (-4.5d+102)) .or. (.not. (y <= 3d+55))) 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 <= -4.5e+102) || !(y <= 3e+55)) {
		tmp = 1.0 - (x / y);
	} else {
		tmp = (x - y) / z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -4.5e+102) or not (y <= 3e+55):
		tmp = 1.0 - (x / y)
	else:
		tmp = (x - y) / z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -4.5e+102) || !(y <= 3e+55))
		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 <= -4.5e+102) || ~((y <= 3e+55)))
		tmp = 1.0 - (x / y);
	else
		tmp = (x - y) / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.5e+102], N[Not[LessEqual[y, 3e+55]], $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 -4.5 \cdot 10^{+102} \lor \neg \left(y \leq 3 \cdot 10^{+55}\right):\\
\;\;\;\;1 - \frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.50000000000000021e102 or 3.00000000000000017e55 < 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 79.8%

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

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

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

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

    if -4.50000000000000021e102 < y < 3.00000000000000017e55

    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. Step-by-step derivation
      1. div-sub100.0%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-y}}{z} \]
    8. Simplified88.3%

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

      \[\leadsto \color{blue}{\frac{-1 \cdot y - -1 \cdot x}{z}} \]
    10. Step-by-step derivation
      1. cancel-sign-sub-inv79.0%

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

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

        \[\leadsto \frac{-1 \cdot y + \color{blue}{x}}{z} \]
      4. +-commutative79.0%

        \[\leadsto \frac{\color{blue}{x + -1 \cdot y}}{z} \]
      5. mul-1-neg79.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{+102} \lor \neg \left(y \leq 3 \cdot 10^{+55}\right):\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - y}{z}\\ \end{array} \]

Alternative 8: 69.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7.2 \cdot 10^{-34}:\\ \;\;\;\;\frac{y}{y - z}\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+55}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -7.2e-34) (/ y (- y z)) (if (<= y 3e+55) (/ x z) (- 1.0 (/ x y)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -7.2e-34) {
		tmp = y / (y - z);
	} else if (y <= 3e+55) {
		tmp = x / z;
	} else {
		tmp = 1.0 - (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) :: tmp
    if (y <= (-7.2d-34)) then
        tmp = y / (y - z)
    else if (y <= 3d+55) then
        tmp = x / z
    else
        tmp = 1.0d0 - (x / y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -7.2e-34) {
		tmp = y / (y - z);
	} else if (y <= 3e+55) {
		tmp = x / z;
	} else {
		tmp = 1.0 - (x / y);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -7.2e-34:
		tmp = y / (y - z)
	elif y <= 3e+55:
		tmp = x / z
	else:
		tmp = 1.0 - (x / y)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -7.2e-34)
		tmp = Float64(y / Float64(y - z));
	elseif (y <= 3e+55)
		tmp = Float64(x / z);
	else
		tmp = Float64(1.0 - Float64(x / y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -7.2e-34)
		tmp = y / (y - z);
	elseif (y <= 3e+55)
		tmp = x / z;
	else
		tmp = 1.0 - (x / y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -7.2e-34], N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e+55], N[(x / z), $MachinePrecision], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-34}:\\
\;\;\;\;\frac{y}{y - z}\\

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

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


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

    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 x around 0 68.7%

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

    if -7.20000000000000016e-34 < y < 3.00000000000000017e55

    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 73.1%

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

    if 3.00000000000000017e55 < 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 77.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.2 \cdot 10^{-34}:\\ \;\;\;\;\frac{y}{y - z}\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+55}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{y}\\ \end{array} \]

Alternative 9: 74.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{+102}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;y \leq 9 \cdot 10^{+55}:\\ \;\;\;\;\frac{x - y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - x}{y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -5.2e+102)
   (- 1.0 (/ x y))
   (if (<= y 9e+55) (/ (- x y) z) (/ (- y x) y))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -5.2e+102) {
		tmp = 1.0 - (x / y);
	} else if (y <= 9e+55) {
		tmp = (x - y) / z;
	} 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) :: tmp
    if (y <= (-5.2d+102)) then
        tmp = 1.0d0 - (x / y)
    else if (y <= 9d+55) then
        tmp = (x - y) / z
    else
        tmp = (y - x) / y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -5.2e+102) {
		tmp = 1.0 - (x / y);
	} else if (y <= 9e+55) {
		tmp = (x - y) / z;
	} else {
		tmp = (y - x) / y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -5.2e+102:
		tmp = 1.0 - (x / y)
	elif y <= 9e+55:
		tmp = (x - y) / z
	else:
		tmp = (y - x) / y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -5.2e+102)
		tmp = Float64(1.0 - Float64(x / y));
	elseif (y <= 9e+55)
		tmp = Float64(Float64(x - y) / z);
	else
		tmp = Float64(Float64(y - x) / y);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -5.2e+102)
		tmp = 1.0 - (x / y);
	elseif (y <= 9e+55)
		tmp = (x - y) / z;
	else
		tmp = (y - x) / y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -5.2e+102], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+55], N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision], N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+102}:\\
\;\;\;\;1 - \frac{x}{y}\\

\mathbf{elif}\;y \leq 9 \cdot 10^{+55}:\\
\;\;\;\;\frac{x - y}{z}\\

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


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

    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 82.8%

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

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

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

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

    if -5.20000000000000013e102 < y < 8.99999999999999996e55

    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. Step-by-step derivation
      1. div-sub100.0%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-y}}{z} \]
    8. Simplified88.3%

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

      \[\leadsto \color{blue}{\frac{-1 \cdot y - -1 \cdot x}{z}} \]
    10. Step-by-step derivation
      1. cancel-sign-sub-inv79.0%

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

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

        \[\leadsto \frac{-1 \cdot y + \color{blue}{x}}{z} \]
      4. +-commutative79.0%

        \[\leadsto \frac{\color{blue}{x + -1 \cdot y}}{z} \]
      5. mul-1-neg79.0%

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

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

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

    if 8.99999999999999996e55 < 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 77.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{+102}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{elif}\;y \leq 9 \cdot 10^{+55}:\\ \;\;\;\;\frac{x - y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - x}{y}\\ \end{array} \]

Alternative 10: 59.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{+104}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 5.3 \cdot 10^{+56}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -1.5e+104) 1.0 (if (<= y 5.3e+56) (/ x z) 1.0)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -1.5e+104) {
		tmp = 1.0;
	} else if (y <= 5.3e+56) {
		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 <= (-1.5d+104)) then
        tmp = 1.0d0
    else if (y <= 5.3d+56) 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 <= -1.5e+104) {
		tmp = 1.0;
	} else if (y <= 5.3e+56) {
		tmp = x / z;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -1.5e+104:
		tmp = 1.0
	elif y <= 5.3e+56:
		tmp = x / z
	else:
		tmp = 1.0
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -1.5e+104)
		tmp = 1.0;
	elseif (y <= 5.3e+56)
		tmp = Float64(x / z);
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -1.5e+104)
		tmp = 1.0;
	elseif (y <= 5.3e+56)
		tmp = x / z;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -1.5e+104], 1.0, If[LessEqual[y, 5.3e+56], N[(x / z), $MachinePrecision], 1.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+104}:\\
\;\;\;\;1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.49999999999999984e104 or 5.3000000000000002e56 < 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 63.4%

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

    if -1.49999999999999984e104 < y < 5.3000000000000002e56

    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 64.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{+104}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 5.3 \cdot 10^{+56}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 11: 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 12: 34.9% 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 27.7%

    \[\leadsto \color{blue}{1} \]
  5. Final simplification27.7%

    \[\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 2023200 
(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)))