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

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

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

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

    \[\leadsto \frac{x - y}{z - y} \]
  4. Add Preprocessing

Alternative 2: 64.7% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+170}:\\
\;\;\;\;\frac{y}{y - z}\\

\mathbf{elif}\;z \leq -2.65 \cdot 10^{+23} \lor \neg \left(z \leq 2.15 \cdot 10^{+111}\right):\\
\;\;\;\;\frac{x}{z}\\

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{-1}{\frac{-1}{-x}}} - \frac{y}{-1}}{y - z} \]
      12. associate-/r/99.9%

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

        \[\leadsto \frac{\color{blue}{1} \cdot \left(-x\right) - \frac{y}{-1}}{y - z} \]
      14. *-lft-identity99.9%

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

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

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

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{\frac{-1}{-y}}}}{y - z} \]
      18. associate-/r/99.9%

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{-1} \cdot \left(-y\right)}}{y - z} \]
      19. metadata-eval99.9%

        \[\leadsto \frac{\left(-x\right) - \color{blue}{1} \cdot \left(-y\right)}{y - z} \]
      20. *-lft-identity99.9%

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

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

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

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

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

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

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

    if -1.40000000000000008e170 < z < -2.6500000000000001e23 or 2.14999999999999997e111 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x - y}{-1}}{y - z}} \]
      8. div-sub100.0%

        \[\leadsto \frac{\color{blue}{\frac{x}{-1} - \frac{y}{-1}}}{y - z} \]
      9. remove-double-neg100.0%

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

        \[\leadsto \frac{\frac{\color{blue}{-1 \cdot \left(-x\right)}}{-1} - \frac{y}{-1}}{y - z} \]
      11. associate-/l*99.7%

        \[\leadsto \frac{\color{blue}{\frac{-1}{\frac{-1}{-x}}} - \frac{y}{-1}}{y - z} \]
      12. associate-/r/100.0%

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

        \[\leadsto \frac{\color{blue}{1} \cdot \left(-x\right) - \frac{y}{-1}}{y - z} \]
      14. *-lft-identity100.0%

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

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

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

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{\frac{-1}{-y}}}}{y - z} \]
      18. associate-/r/100.0%

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

        \[\leadsto \frac{\left(-x\right) - \color{blue}{1} \cdot \left(-y\right)}{y - z} \]
      20. *-lft-identity100.0%

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

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

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

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

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

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

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

    if -2.6500000000000001e23 < z < 2.14999999999999997e111

    1. Initial program 100.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x - y}{-1}}{y - z}} \]
      8. div-sub100.0%

        \[\leadsto \frac{\color{blue}{\frac{x}{-1} - \frac{y}{-1}}}{y - z} \]
      9. remove-double-neg100.0%

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

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

        \[\leadsto \frac{\color{blue}{\frac{-1}{\frac{-1}{-x}}} - \frac{y}{-1}}{y - z} \]
      12. associate-/r/100.0%

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

        \[\leadsto \frac{\color{blue}{1} \cdot \left(-x\right) - \frac{y}{-1}}{y - z} \]
      14. *-lft-identity100.0%

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

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

        \[\leadsto \frac{\left(-x\right) - \frac{\color{blue}{-1 \cdot \left(-y\right)}}{-1}}{y - z} \]
      17. associate-/l*99.8%

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{\frac{-1}{-y}}}}{y - z} \]
      18. associate-/r/100.0%

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

        \[\leadsto \frac{\left(-x\right) - \color{blue}{1} \cdot \left(-y\right)}{y - z} \]
      20. *-lft-identity100.0%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.4 \cdot 10^{+170}:\\ \;\;\;\;\frac{y}{y - z}\\ \mathbf{elif}\;z \leq -2.65 \cdot 10^{+23} \lor \neg \left(z \leq 2.15 \cdot 10^{+111}\right):\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 77.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.32 \cdot 10^{+51} \lor \neg \left(x \leq 1.8 \cdot 10^{+31}\right):\\ \;\;\;\;\frac{-x}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{y - z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -1.32e+51) (not (<= x 1.8e+31)))
   (/ (- x) (- y z))
   (/ y (- y z))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.32e+51) || !(x <= 1.8e+31)) {
		tmp = -x / (y - z);
	} else {
		tmp = y / (y - z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((x <= (-1.32d+51)) .or. (.not. (x <= 1.8d+31))) then
        tmp = -x / (y - z)
    else
        tmp = y / (y - z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.32e+51) || !(x <= 1.8e+31)) {
		tmp = -x / (y - z);
	} else {
		tmp = y / (y - z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= -1.32e+51) or not (x <= 1.8e+31):
		tmp = -x / (y - z)
	else:
		tmp = y / (y - z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= -1.32e+51) || !(x <= 1.8e+31))
		tmp = Float64(Float64(-x) / Float64(y - z));
	else
		tmp = Float64(y / Float64(y - z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -1.32e+51) || ~((x <= 1.8e+31)))
		tmp = -x / (y - z);
	else
		tmp = y / (y - z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.32e+51], N[Not[LessEqual[x, 1.8e+31]], $MachinePrecision]], N[((-x) / N[(y - z), $MachinePrecision]), $MachinePrecision], N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.32 \cdot 10^{+51} \lor \neg \left(x \leq 1.8 \cdot 10^{+31}\right):\\
\;\;\;\;\frac{-x}{y - z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.32e51 or 1.79999999999999998e31 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x - y}{-1}}{y - z}} \]
      8. div-sub100.0%

        \[\leadsto \frac{\color{blue}{\frac{x}{-1} - \frac{y}{-1}}}{y - z} \]
      9. remove-double-neg100.0%

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

        \[\leadsto \frac{\frac{\color{blue}{-1 \cdot \left(-x\right)}}{-1} - \frac{y}{-1}}{y - z} \]
      11. associate-/l*99.8%

        \[\leadsto \frac{\color{blue}{\frac{-1}{\frac{-1}{-x}}} - \frac{y}{-1}}{y - z} \]
      12. associate-/r/100.0%

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

        \[\leadsto \frac{\color{blue}{1} \cdot \left(-x\right) - \frac{y}{-1}}{y - z} \]
      14. *-lft-identity100.0%

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

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

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

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{\frac{-1}{-y}}}}{y - z} \]
      18. associate-/r/100.0%

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

        \[\leadsto \frac{\left(-x\right) - \color{blue}{1} \cdot \left(-y\right)}{y - z} \]
      20. *-lft-identity100.0%

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

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

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

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

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

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

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

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

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

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

    if -1.32e51 < x < 1.79999999999999998e31

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{-1}{\frac{-1}{-x}}} - \frac{y}{-1}}{y - z} \]
      12. associate-/r/99.9%

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

        \[\leadsto \frac{\color{blue}{1} \cdot \left(-x\right) - \frac{y}{-1}}{y - z} \]
      14. *-lft-identity99.9%

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

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

        \[\leadsto \frac{\left(-x\right) - \frac{\color{blue}{-1 \cdot \left(-y\right)}}{-1}}{y - z} \]
      17. associate-/l*99.8%

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{\frac{-1}{-y}}}}{y - z} \]
      18. associate-/r/99.9%

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{-1} \cdot \left(-y\right)}}{y - z} \]
      19. metadata-eval99.9%

        \[\leadsto \frac{\left(-x\right) - \color{blue}{1} \cdot \left(-y\right)}{y - z} \]
      20. *-lft-identity99.9%

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

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

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

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

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

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

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

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

Alternative 4: 64.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+21} \lor \neg \left(z \leq 4.3 \cdot 10^{+111}\right):\\
\;\;\;\;\frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3e21 or 4.29999999999999993e111 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x - y}{-1}}{y - z}} \]
      8. div-sub100.0%

        \[\leadsto \frac{\color{blue}{\frac{x}{-1} - \frac{y}{-1}}}{y - z} \]
      9. remove-double-neg100.0%

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

        \[\leadsto \frac{\frac{\color{blue}{-1 \cdot \left(-x\right)}}{-1} - \frac{y}{-1}}{y - z} \]
      11. associate-/l*99.8%

        \[\leadsto \frac{\color{blue}{\frac{-1}{\frac{-1}{-x}}} - \frac{y}{-1}}{y - z} \]
      12. associate-/r/100.0%

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

        \[\leadsto \frac{\color{blue}{1} \cdot \left(-x\right) - \frac{y}{-1}}{y - z} \]
      14. *-lft-identity100.0%

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

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

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

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{\frac{-1}{-y}}}}{y - z} \]
      18. associate-/r/100.0%

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

        \[\leadsto \frac{\left(-x\right) - \color{blue}{1} \cdot \left(-y\right)}{y - z} \]
      20. *-lft-identity100.0%

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

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

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

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

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

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

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

    if -3e21 < z < 4.29999999999999993e111

    1. Initial program 100.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x - y}{-1}}{y - z}} \]
      8. div-sub100.0%

        \[\leadsto \frac{\color{blue}{\frac{x}{-1} - \frac{y}{-1}}}{y - z} \]
      9. remove-double-neg100.0%

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

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

        \[\leadsto \frac{\color{blue}{\frac{-1}{\frac{-1}{-x}}} - \frac{y}{-1}}{y - z} \]
      12. associate-/r/100.0%

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

        \[\leadsto \frac{\color{blue}{1} \cdot \left(-x\right) - \frac{y}{-1}}{y - z} \]
      14. *-lft-identity100.0%

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

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

        \[\leadsto \frac{\left(-x\right) - \frac{\color{blue}{-1 \cdot \left(-y\right)}}{-1}}{y - z} \]
      17. associate-/l*99.8%

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{\frac{-1}{-y}}}}{y - z} \]
      18. associate-/r/100.0%

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

        \[\leadsto \frac{\left(-x\right) - \color{blue}{1} \cdot \left(-y\right)}{y - z} \]
      20. *-lft-identity100.0%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3 \cdot 10^{+21} \lor \neg \left(z \leq 4.3 \cdot 10^{+111}\right):\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 74.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{-22} \lor \neg \left(z \leq 2.8 \cdot 10^{+102}\right):\\
\;\;\;\;\frac{x - y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.5e-22 or 2.80000000000000018e102 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x - y}{-1}}{y - z}} \]
      8. div-sub100.0%

        \[\leadsto \frac{\color{blue}{\frac{x}{-1} - \frac{y}{-1}}}{y - z} \]
      9. remove-double-neg100.0%

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

        \[\leadsto \frac{\frac{\color{blue}{-1 \cdot \left(-x\right)}}{-1} - \frac{y}{-1}}{y - z} \]
      11. associate-/l*99.8%

        \[\leadsto \frac{\color{blue}{\frac{-1}{\frac{-1}{-x}}} - \frac{y}{-1}}{y - z} \]
      12. associate-/r/100.0%

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

        \[\leadsto \frac{\color{blue}{1} \cdot \left(-x\right) - \frac{y}{-1}}{y - z} \]
      14. *-lft-identity100.0%

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

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

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

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{\frac{-1}{-y}}}}{y - z} \]
      18. associate-/r/100.0%

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

        \[\leadsto \frac{\left(-x\right) - \color{blue}{1} \cdot \left(-y\right)}{y - z} \]
      20. *-lft-identity100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.5e-22 < z < 2.80000000000000018e102

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{-1}{\frac{-1}{-x}}} - \frac{y}{-1}}{y - z} \]
      12. associate-/r/99.9%

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

        \[\leadsto \frac{\color{blue}{1} \cdot \left(-x\right) - \frac{y}{-1}}{y - z} \]
      14. *-lft-identity99.9%

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

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

        \[\leadsto \frac{\left(-x\right) - \frac{\color{blue}{-1 \cdot \left(-y\right)}}{-1}}{y - z} \]
      17. associate-/l*99.8%

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{\frac{-1}{-y}}}}{y - z} \]
      18. associate-/r/99.9%

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{-1} \cdot \left(-y\right)}}{y - z} \]
      19. metadata-eval99.9%

        \[\leadsto \frac{\left(-x\right) - \color{blue}{1} \cdot \left(-y\right)}{y - z} \]
      20. *-lft-identity99.9%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.5 \cdot 10^{-22} \lor \neg \left(z \leq 2.8 \cdot 10^{+102}\right):\\ \;\;\;\;\frac{x - y}{z}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 61.2% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.88000000000000012e-20 or 9.00000000000000023e-6 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x - y}{-1}}{y - z}} \]
      8. div-sub100.0%

        \[\leadsto \frac{\color{blue}{\frac{x}{-1} - \frac{y}{-1}}}{y - z} \]
      9. remove-double-neg100.0%

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

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

        \[\leadsto \frac{\color{blue}{\frac{-1}{\frac{-1}{-x}}} - \frac{y}{-1}}{y - z} \]
      12. associate-/r/100.0%

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

        \[\leadsto \frac{\color{blue}{1} \cdot \left(-x\right) - \frac{y}{-1}}{y - z} \]
      14. *-lft-identity100.0%

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

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

        \[\leadsto \frac{\left(-x\right) - \frac{\color{blue}{-1 \cdot \left(-y\right)}}{-1}}{y - z} \]
      17. associate-/l*99.8%

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{\frac{-1}{-y}}}}{y - z} \]
      18. associate-/r/100.0%

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

        \[\leadsto \frac{\left(-x\right) - \color{blue}{1} \cdot \left(-y\right)}{y - z} \]
      20. *-lft-identity100.0%

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

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

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

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

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

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

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

    if -1.88000000000000012e-20 < y < 9.00000000000000023e-6

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{-1 \cdot \left(-x\right)}}{-1} - \frac{y}{-1}}{y - z} \]
      11. associate-/l*99.7%

        \[\leadsto \frac{\color{blue}{\frac{-1}{\frac{-1}{-x}}} - \frac{y}{-1}}{y - z} \]
      12. associate-/r/99.9%

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

        \[\leadsto \frac{\color{blue}{1} \cdot \left(-x\right) - \frac{y}{-1}}{y - z} \]
      14. *-lft-identity99.9%

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

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

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

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{\frac{-1}{-y}}}}{y - z} \]
      18. associate-/r/99.9%

        \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{-1} \cdot \left(-y\right)}}{y - z} \]
      19. metadata-eval99.9%

        \[\leadsto \frac{\left(-x\right) - \color{blue}{1} \cdot \left(-y\right)}{y - z} \]
      20. *-lft-identity99.9%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.88 \cdot 10^{-20}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-6}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 35.0% 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{x - y}{\color{blue}{z + \left(-y\right)}} \]
    2. remove-double-neg100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{x - y}{-1}}{y - z}} \]
    8. div-sub100.0%

      \[\leadsto \frac{\color{blue}{\frac{x}{-1} - \frac{y}{-1}}}{y - z} \]
    9. remove-double-neg100.0%

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

      \[\leadsto \frac{\frac{\color{blue}{-1 \cdot \left(-x\right)}}{-1} - \frac{y}{-1}}{y - z} \]
    11. associate-/l*99.8%

      \[\leadsto \frac{\color{blue}{\frac{-1}{\frac{-1}{-x}}} - \frac{y}{-1}}{y - z} \]
    12. associate-/r/100.0%

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

      \[\leadsto \frac{\color{blue}{1} \cdot \left(-x\right) - \frac{y}{-1}}{y - z} \]
    14. *-lft-identity100.0%

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

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

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

      \[\leadsto \frac{\left(-x\right) - \color{blue}{\frac{-1}{\frac{-1}{-y}}}}{y - z} \]
    18. associate-/r/100.0%

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

      \[\leadsto \frac{\left(-x\right) - \color{blue}{1} \cdot \left(-y\right)}{y - z} \]
    20. *-lft-identity100.0%

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

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

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

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

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

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

    \[\leadsto \color{blue}{1} \]
  6. Final simplification33.2%

    \[\leadsto 1 \]
  7. Add Preprocessing

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 2024034 
(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)))