Numeric.LinearAlgebra.Util:formatSparse from hmatrix-0.16.1.5

Percentage Accurate: 100.0% → 100.0%
Time: 6.9s
Alternatives: 6
Speedup: 1.1×

Specification

?
\[\begin{array}{l} \\ \frac{\left|x - y\right|}{\left|y\right|} \end{array} \]
(FPCore (x y) :precision binary64 (/ (fabs (- x y)) (fabs y)))
double code(double x, double y) {
	return fabs((x - y)) / fabs(y);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = abs((x - y)) / abs(y)
end function
public static double code(double x, double y) {
	return Math.abs((x - y)) / Math.abs(y);
}
def code(x, y):
	return math.fabs((x - y)) / math.fabs(y)
function code(x, y)
	return Float64(abs(Float64(x - y)) / abs(y))
end
function tmp = code(x, y)
	tmp = abs((x - y)) / abs(y);
end
code[x_, y_] := N[(N[Abs[N[(x - y), $MachinePrecision]], $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left|x - y\right|}{\left|y\right|}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 6 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{\left|x - y\right|}{\left|y\right|} \end{array} \]
(FPCore (x y) :precision binary64 (/ (fabs (- x y)) (fabs y)))
double code(double x, double y) {
	return fabs((x - y)) / fabs(y);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = abs((x - y)) / abs(y)
end function
public static double code(double x, double y) {
	return Math.abs((x - y)) / Math.abs(y);
}
def code(x, y):
	return math.fabs((x - y)) / math.fabs(y)
function code(x, y)
	return Float64(abs(Float64(x - y)) / abs(y))
end
function tmp = code(x, y)
	tmp = abs((x - y)) / abs(y);
end
code[x_, y_] := N[(N[Abs[N[(x - y), $MachinePrecision]], $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left|x - y\right|}{\left|y\right|}
\end{array}

Alternative 1: 100.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \left|\frac{x}{y} - 1\right| \end{array} \]
(FPCore (x y) :precision binary64 (fabs (- (/ x y) 1.0)))
double code(double x, double y) {
	return fabs(((x / y) - 1.0));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = abs(((x / y) - 1.0d0))
end function
public static double code(double x, double y) {
	return Math.abs(((x / y) - 1.0));
}
def code(x, y):
	return math.fabs(((x / y) - 1.0))
function code(x, y)
	return abs(Float64(Float64(x / y) - 1.0))
end
function tmp = code(x, y)
	tmp = abs(((x / y) - 1.0));
end
code[x_, y_] := N[Abs[N[(N[(x / y), $MachinePrecision] - 1.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

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

    \[\frac{\left|x - y\right|}{\left|y\right|} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left|x - y\right|}{\left|y\right|}} \]
    2. lift-fabs.f64N/A

      \[\leadsto \frac{\color{blue}{\left|x - y\right|}}{\left|y\right|} \]
    3. neg-fabsN/A

      \[\leadsto \frac{\color{blue}{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}}{\left|y\right|} \]
    4. lift-fabs.f64N/A

      \[\leadsto \frac{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}{\color{blue}{\left|y\right|}} \]
    5. div-fabsN/A

      \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
    6. lower-fabs.f64N/A

      \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
    7. lower-/.f64N/A

      \[\leadsto \left|\color{blue}{\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}}\right| \]
    8. lift--.f64N/A

      \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x - y\right)}\right)}{y}\right| \]
    9. sub-negN/A

      \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x + \left(\mathsf{neg}\left(y\right)\right)\right)}\right)}{y}\right| \]
    10. +-commutativeN/A

      \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) + x\right)}\right)}{y}\right| \]
    11. distribute-neg-inN/A

      \[\leadsto \left|\frac{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{y}\right| \]
    12. remove-double-negN/A

      \[\leadsto \left|\frac{\color{blue}{y} + \left(\mathsf{neg}\left(x\right)\right)}{y}\right| \]
    13. sub-negN/A

      \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
    14. lower--.f64100.0

      \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
  4. Applied rewrites100.0%

    \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
  5. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \left|\color{blue}{\frac{y - x}{y}}\right| \]
    2. lift--.f64N/A

      \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
    3. div-subN/A

      \[\leadsto \left|\color{blue}{\frac{y}{y} - \frac{x}{y}}\right| \]
    4. *-inversesN/A

      \[\leadsto \left|\color{blue}{1} - \frac{x}{y}\right| \]
    5. lower--.f64N/A

      \[\leadsto \left|\color{blue}{1 - \frac{x}{y}}\right| \]
    6. lower-/.f64100.0

      \[\leadsto \left|1 - \color{blue}{\frac{x}{y}}\right| \]
  6. Applied rewrites100.0%

    \[\leadsto \left|\color{blue}{1 - \frac{x}{y}}\right| \]
  7. Final simplification100.0%

    \[\leadsto \left|\frac{x}{y} - 1\right| \]
  8. Add Preprocessing

Alternative 2: 99.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\left|y - x\right|}{\left|y\right|} \leq 40000000:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{-x}{y}\right|\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= (/ (fabs (- y x)) (fabs y)) 40000000.0)
   (- 1.0 (/ x y))
   (fabs (/ (- x) y))))
double code(double x, double y) {
	double tmp;
	if ((fabs((y - x)) / fabs(y)) <= 40000000.0) {
		tmp = 1.0 - (x / y);
	} else {
		tmp = fabs((-x / y));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((abs((y - x)) / abs(y)) <= 40000000.0d0) then
        tmp = 1.0d0 - (x / y)
    else
        tmp = abs((-x / y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((Math.abs((y - x)) / Math.abs(y)) <= 40000000.0) {
		tmp = 1.0 - (x / y);
	} else {
		tmp = Math.abs((-x / y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (math.fabs((y - x)) / math.fabs(y)) <= 40000000.0:
		tmp = 1.0 - (x / y)
	else:
		tmp = math.fabs((-x / y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (Float64(abs(Float64(y - x)) / abs(y)) <= 40000000.0)
		tmp = Float64(1.0 - Float64(x / y));
	else
		tmp = abs(Float64(Float64(-x) / y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((abs((y - x)) / abs(y)) <= 40000000.0)
		tmp = 1.0 - (x / y);
	else
		tmp = abs((-x / y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision], 40000000.0], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[Abs[N[((-x) / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\left|y - x\right|}{\left|y\right|} \leq 40000000:\\
\;\;\;\;1 - \frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{-x}{y}\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (fabs.f64 (-.f64 x y)) (fabs.f64 y)) < 4e7

    1. Initial program 99.9%

      \[\frac{\left|x - y\right|}{\left|y\right|} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left|x - y\right|}{\left|y\right|}} \]
      2. lift-fabs.f64N/A

        \[\leadsto \frac{\color{blue}{\left|x - y\right|}}{\left|y\right|} \]
      3. neg-fabsN/A

        \[\leadsto \frac{\color{blue}{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}}{\left|y\right|} \]
      4. lift-fabs.f64N/A

        \[\leadsto \frac{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}{\color{blue}{\left|y\right|}} \]
      5. div-fabsN/A

        \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
      6. lower-fabs.f64N/A

        \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
      7. lower-/.f64N/A

        \[\leadsto \left|\color{blue}{\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}}\right| \]
      8. lift--.f64N/A

        \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x - y\right)}\right)}{y}\right| \]
      9. sub-negN/A

        \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x + \left(\mathsf{neg}\left(y\right)\right)\right)}\right)}{y}\right| \]
      10. +-commutativeN/A

        \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) + x\right)}\right)}{y}\right| \]
      11. distribute-neg-inN/A

        \[\leadsto \left|\frac{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{y}\right| \]
      12. remove-double-negN/A

        \[\leadsto \left|\frac{\color{blue}{y} + \left(\mathsf{neg}\left(x\right)\right)}{y}\right| \]
      13. sub-negN/A

        \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
      14. lower--.f6499.9

        \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
    4. Applied rewrites99.9%

      \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
    5. Step-by-step derivation
      1. lift-fabs.f64N/A

        \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
      2. lift-/.f64N/A

        \[\leadsto \left|\color{blue}{\frac{y - x}{y}}\right| \]
      3. clear-numN/A

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{y}{y - x}}}\right| \]
      4. lift-/.f64N/A

        \[\leadsto \left|\frac{1}{\color{blue}{\frac{y}{y - x}}}\right| \]
      5. fabs-divN/A

        \[\leadsto \color{blue}{\frac{\left|1\right|}{\left|\frac{y}{y - x}\right|}} \]
      6. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{1}}{\left|\frac{y}{y - x}\right|} \]
      7. lift-fabs.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\left|\frac{y}{y - x}\right|}} \]
      8. inv-powN/A

        \[\leadsto \color{blue}{{\left(\left|\frac{y}{y - x}\right|\right)}^{-1}} \]
      9. metadata-evalN/A

        \[\leadsto {\left(\left|\frac{y}{y - x}\right|\right)}^{\color{blue}{\left(2 \cdot \frac{-1}{2}\right)}} \]
      10. pow-powN/A

        \[\leadsto \color{blue}{{\left({\left(\left|\frac{y}{y - x}\right|\right)}^{2}\right)}^{\frac{-1}{2}}} \]
      11. pow2N/A

        \[\leadsto {\color{blue}{\left(\left|\frac{y}{y - x}\right| \cdot \left|\frac{y}{y - x}\right|\right)}}^{\frac{-1}{2}} \]
      12. lift-fabs.f64N/A

        \[\leadsto {\left(\color{blue}{\left|\frac{y}{y - x}\right|} \cdot \left|\frac{y}{y - x}\right|\right)}^{\frac{-1}{2}} \]
      13. lift-fabs.f64N/A

        \[\leadsto {\left(\left|\frac{y}{y - x}\right| \cdot \color{blue}{\left|\frac{y}{y - x}\right|}\right)}^{\frac{-1}{2}} \]
      14. sqr-absN/A

        \[\leadsto {\color{blue}{\left(\frac{y}{y - x} \cdot \frac{y}{y - x}\right)}}^{\frac{-1}{2}} \]
      15. pow-prod-downN/A

        \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}} \cdot {\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}}} \]
      16. pow-prod-upN/A

        \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\left(\frac{-1}{2} + \frac{-1}{2}\right)}} \]
      17. metadata-evalN/A

        \[\leadsto {\left(\frac{y}{y - x}\right)}^{\color{blue}{-1}} \]
      18. inv-powN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{y - x}}} \]
      19. lift-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{y}{y - x}}} \]
      20. clear-numN/A

        \[\leadsto \color{blue}{\frac{y - x}{y}} \]
      21. lift--.f64N/A

        \[\leadsto \frac{\color{blue}{y - x}}{y} \]
      22. div-subN/A

        \[\leadsto \color{blue}{\frac{y}{y} - \frac{x}{y}} \]
      23. *-inversesN/A

        \[\leadsto \color{blue}{1} - \frac{x}{y} \]
      24. lower--.f64N/A

        \[\leadsto \color{blue}{1 - \frac{x}{y}} \]
      25. lower-/.f6497.9

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

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

    if 4e7 < (/.f64 (fabs.f64 (-.f64 x y)) (fabs.f64 y))

    1. Initial program 100.0%

      \[\frac{\left|x - y\right|}{\left|y\right|} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left|x - y\right|}{\left|y\right|}} \]
      2. lift-fabs.f64N/A

        \[\leadsto \frac{\color{blue}{\left|x - y\right|}}{\left|y\right|} \]
      3. neg-fabsN/A

        \[\leadsto \frac{\color{blue}{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}}{\left|y\right|} \]
      4. lift-fabs.f64N/A

        \[\leadsto \frac{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}{\color{blue}{\left|y\right|}} \]
      5. div-fabsN/A

        \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
      6. lower-fabs.f64N/A

        \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
      7. lower-/.f64N/A

        \[\leadsto \left|\color{blue}{\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}}\right| \]
      8. lift--.f64N/A

        \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x - y\right)}\right)}{y}\right| \]
      9. sub-negN/A

        \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x + \left(\mathsf{neg}\left(y\right)\right)\right)}\right)}{y}\right| \]
      10. +-commutativeN/A

        \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) + x\right)}\right)}{y}\right| \]
      11. distribute-neg-inN/A

        \[\leadsto \left|\frac{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{y}\right| \]
      12. remove-double-negN/A

        \[\leadsto \left|\frac{\color{blue}{y} + \left(\mathsf{neg}\left(x\right)\right)}{y}\right| \]
      13. sub-negN/A

        \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
      14. lower--.f64100.0

        \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
    4. Applied rewrites100.0%

      \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
    5. Taylor expanded in y around 0

      \[\leadsto \left|\frac{\color{blue}{-1 \cdot x}}{y}\right| \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \left|\frac{\color{blue}{\mathsf{neg}\left(x\right)}}{y}\right| \]
      2. lower-neg.f6499.5

        \[\leadsto \left|\frac{\color{blue}{-x}}{y}\right| \]
    7. Applied rewrites99.5%

      \[\leadsto \left|\frac{\color{blue}{-x}}{y}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left|y - x\right|}{\left|y\right|} \leq 40000000:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{-x}{y}\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 73.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\left|y - x\right|}{\left|y\right|} \leq 2000:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= (/ (fabs (- y x)) (fabs y)) 2000.0) 1.0 (/ (- x) y)))
double code(double x, double y) {
	double tmp;
	if ((fabs((y - x)) / fabs(y)) <= 2000.0) {
		tmp = 1.0;
	} else {
		tmp = -x / y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((abs((y - x)) / abs(y)) <= 2000.0d0) then
        tmp = 1.0d0
    else
        tmp = -x / y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((Math.abs((y - x)) / Math.abs(y)) <= 2000.0) {
		tmp = 1.0;
	} else {
		tmp = -x / y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (math.fabs((y - x)) / math.fabs(y)) <= 2000.0:
		tmp = 1.0
	else:
		tmp = -x / y
	return tmp
function code(x, y)
	tmp = 0.0
	if (Float64(abs(Float64(y - x)) / abs(y)) <= 2000.0)
		tmp = 1.0;
	else
		tmp = Float64(Float64(-x) / y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((abs((y - x)) / abs(y)) <= 2000.0)
		tmp = 1.0;
	else
		tmp = -x / y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision], 2000.0], 1.0, N[((-x) / y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\left|y - x\right|}{\left|y\right|} \leq 2000:\\
\;\;\;\;1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (fabs.f64 (-.f64 x y)) (fabs.f64 y)) < 2e3

    1. Initial program 100.0%

      \[\frac{\left|x - y\right|}{\left|y\right|} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left|x - y\right|}{\left|y\right|}} \]
      2. lift-fabs.f64N/A

        \[\leadsto \frac{\color{blue}{\left|x - y\right|}}{\left|y\right|} \]
      3. neg-fabsN/A

        \[\leadsto \frac{\color{blue}{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}}{\left|y\right|} \]
      4. lift-fabs.f64N/A

        \[\leadsto \frac{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}{\color{blue}{\left|y\right|}} \]
      5. div-fabsN/A

        \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
      6. lower-fabs.f64N/A

        \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
      7. lower-/.f64N/A

        \[\leadsto \left|\color{blue}{\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}}\right| \]
      8. lift--.f64N/A

        \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x - y\right)}\right)}{y}\right| \]
      9. sub-negN/A

        \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x + \left(\mathsf{neg}\left(y\right)\right)\right)}\right)}{y}\right| \]
      10. +-commutativeN/A

        \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) + x\right)}\right)}{y}\right| \]
      11. distribute-neg-inN/A

        \[\leadsto \left|\frac{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{y}\right| \]
      12. remove-double-negN/A

        \[\leadsto \left|\frac{\color{blue}{y} + \left(\mathsf{neg}\left(x\right)\right)}{y}\right| \]
      13. sub-negN/A

        \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
      14. lower--.f64100.0

        \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
    4. Applied rewrites100.0%

      \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
    5. Step-by-step derivation
      1. lift-fabs.f64N/A

        \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
      2. lift-/.f64N/A

        \[\leadsto \left|\color{blue}{\frac{y - x}{y}}\right| \]
      3. clear-numN/A

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{y}{y - x}}}\right| \]
      4. lift-/.f64N/A

        \[\leadsto \left|\frac{1}{\color{blue}{\frac{y}{y - x}}}\right| \]
      5. fabs-divN/A

        \[\leadsto \color{blue}{\frac{\left|1\right|}{\left|\frac{y}{y - x}\right|}} \]
      6. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{1}}{\left|\frac{y}{y - x}\right|} \]
      7. lift-fabs.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\left|\frac{y}{y - x}\right|}} \]
      8. inv-powN/A

        \[\leadsto \color{blue}{{\left(\left|\frac{y}{y - x}\right|\right)}^{-1}} \]
      9. metadata-evalN/A

        \[\leadsto {\left(\left|\frac{y}{y - x}\right|\right)}^{\color{blue}{\left(2 \cdot \frac{-1}{2}\right)}} \]
      10. pow-powN/A

        \[\leadsto \color{blue}{{\left({\left(\left|\frac{y}{y - x}\right|\right)}^{2}\right)}^{\frac{-1}{2}}} \]
      11. pow2N/A

        \[\leadsto {\color{blue}{\left(\left|\frac{y}{y - x}\right| \cdot \left|\frac{y}{y - x}\right|\right)}}^{\frac{-1}{2}} \]
      12. lift-fabs.f64N/A

        \[\leadsto {\left(\color{blue}{\left|\frac{y}{y - x}\right|} \cdot \left|\frac{y}{y - x}\right|\right)}^{\frac{-1}{2}} \]
      13. lift-fabs.f64N/A

        \[\leadsto {\left(\left|\frac{y}{y - x}\right| \cdot \color{blue}{\left|\frac{y}{y - x}\right|}\right)}^{\frac{-1}{2}} \]
      14. sqr-absN/A

        \[\leadsto {\color{blue}{\left(\frac{y}{y - x} \cdot \frac{y}{y - x}\right)}}^{\frac{-1}{2}} \]
      15. pow-prod-downN/A

        \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}} \cdot {\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}}} \]
      16. pow-prod-upN/A

        \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\left(\frac{-1}{2} + \frac{-1}{2}\right)}} \]
      17. metadata-evalN/A

        \[\leadsto {\left(\frac{y}{y - x}\right)}^{\color{blue}{-1}} \]
      18. inv-powN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{y - x}}} \]
      19. lift-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{y}{y - x}}} \]
      20. clear-numN/A

        \[\leadsto \color{blue}{\frac{y - x}{y}} \]
      21. lift-/.f6499.3

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

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

      \[\leadsto \color{blue}{1} \]
    8. Step-by-step derivation
      1. Applied rewrites96.3%

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

      if 2e3 < (/.f64 (fabs.f64 (-.f64 x y)) (fabs.f64 y))

      1. Initial program 99.9%

        \[\frac{\left|x - y\right|}{\left|y\right|} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{\left|x - y\right|}{\left|y\right|}} \]
        2. lift-fabs.f64N/A

          \[\leadsto \frac{\color{blue}{\left|x - y\right|}}{\left|y\right|} \]
        3. neg-fabsN/A

          \[\leadsto \frac{\color{blue}{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}}{\left|y\right|} \]
        4. lift-fabs.f64N/A

          \[\leadsto \frac{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}{\color{blue}{\left|y\right|}} \]
        5. div-fabsN/A

          \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
        6. lower-fabs.f64N/A

          \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
        7. lower-/.f64N/A

          \[\leadsto \left|\color{blue}{\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}}\right| \]
        8. lift--.f64N/A

          \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x - y\right)}\right)}{y}\right| \]
        9. sub-negN/A

          \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x + \left(\mathsf{neg}\left(y\right)\right)\right)}\right)}{y}\right| \]
        10. +-commutativeN/A

          \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) + x\right)}\right)}{y}\right| \]
        11. distribute-neg-inN/A

          \[\leadsto \left|\frac{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{y}\right| \]
        12. remove-double-negN/A

          \[\leadsto \left|\frac{\color{blue}{y} + \left(\mathsf{neg}\left(x\right)\right)}{y}\right| \]
        13. sub-negN/A

          \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
        14. lower--.f6499.9

          \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
      4. Applied rewrites99.9%

        \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
      5. Step-by-step derivation
        1. lift-fabs.f64N/A

          \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
        2. lift-/.f64N/A

          \[\leadsto \left|\color{blue}{\frac{y - x}{y}}\right| \]
        3. clear-numN/A

          \[\leadsto \left|\color{blue}{\frac{1}{\frac{y}{y - x}}}\right| \]
        4. lift-/.f64N/A

          \[\leadsto \left|\frac{1}{\color{blue}{\frac{y}{y - x}}}\right| \]
        5. fabs-divN/A

          \[\leadsto \color{blue}{\frac{\left|1\right|}{\left|\frac{y}{y - x}\right|}} \]
        6. metadata-evalN/A

          \[\leadsto \frac{\color{blue}{1}}{\left|\frac{y}{y - x}\right|} \]
        7. lift-fabs.f64N/A

          \[\leadsto \frac{1}{\color{blue}{\left|\frac{y}{y - x}\right|}} \]
        8. inv-powN/A

          \[\leadsto \color{blue}{{\left(\left|\frac{y}{y - x}\right|\right)}^{-1}} \]
        9. metadata-evalN/A

          \[\leadsto {\left(\left|\frac{y}{y - x}\right|\right)}^{\color{blue}{\left(2 \cdot \frac{-1}{2}\right)}} \]
        10. pow-powN/A

          \[\leadsto \color{blue}{{\left({\left(\left|\frac{y}{y - x}\right|\right)}^{2}\right)}^{\frac{-1}{2}}} \]
        11. pow2N/A

          \[\leadsto {\color{blue}{\left(\left|\frac{y}{y - x}\right| \cdot \left|\frac{y}{y - x}\right|\right)}}^{\frac{-1}{2}} \]
        12. lift-fabs.f64N/A

          \[\leadsto {\left(\color{blue}{\left|\frac{y}{y - x}\right|} \cdot \left|\frac{y}{y - x}\right|\right)}^{\frac{-1}{2}} \]
        13. lift-fabs.f64N/A

          \[\leadsto {\left(\left|\frac{y}{y - x}\right| \cdot \color{blue}{\left|\frac{y}{y - x}\right|}\right)}^{\frac{-1}{2}} \]
        14. sqr-absN/A

          \[\leadsto {\color{blue}{\left(\frac{y}{y - x} \cdot \frac{y}{y - x}\right)}}^{\frac{-1}{2}} \]
        15. pow-prod-downN/A

          \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}} \cdot {\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}}} \]
        16. pow-prod-upN/A

          \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\left(\frac{-1}{2} + \frac{-1}{2}\right)}} \]
        17. metadata-evalN/A

          \[\leadsto {\left(\frac{y}{y - x}\right)}^{\color{blue}{-1}} \]
        18. inv-powN/A

          \[\leadsto \color{blue}{\frac{1}{\frac{y}{y - x}}} \]
        19. lift-/.f64N/A

          \[\leadsto \frac{1}{\color{blue}{\frac{y}{y - x}}} \]
        20. clear-numN/A

          \[\leadsto \color{blue}{\frac{y - x}{y}} \]
        21. lift-/.f6454.3

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

        \[\leadsto \color{blue}{\frac{y - x}{y}} \]
      7. Taylor expanded in y around 0

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

          \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{y} \]
        2. lower-neg.f6452.4

          \[\leadsto \frac{\color{blue}{-x}}{y} \]
      9. Applied rewrites52.4%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left|y - x\right|}{\left|y\right|} \leq 2000:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{y}\\ \end{array} \]
    11. Add Preprocessing

    Alternative 4: 73.7% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\left|y - x\right|}{\left|y\right|} \leq 2:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (if (<= (/ (fabs (- y x)) (fabs y)) 2.0) 1.0 (/ x y)))
    double code(double x, double y) {
    	double tmp;
    	if ((fabs((y - x)) / fabs(y)) <= 2.0) {
    		tmp = 1.0;
    	} else {
    		tmp = x / y;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8) :: tmp
        if ((abs((y - x)) / abs(y)) <= 2.0d0) then
            tmp = 1.0d0
        else
            tmp = x / y
        end if
        code = tmp
    end function
    
    public static double code(double x, double y) {
    	double tmp;
    	if ((Math.abs((y - x)) / Math.abs(y)) <= 2.0) {
    		tmp = 1.0;
    	} else {
    		tmp = x / y;
    	}
    	return tmp;
    }
    
    def code(x, y):
    	tmp = 0
    	if (math.fabs((y - x)) / math.fabs(y)) <= 2.0:
    		tmp = 1.0
    	else:
    		tmp = x / y
    	return tmp
    
    function code(x, y)
    	tmp = 0.0
    	if (Float64(abs(Float64(y - x)) / abs(y)) <= 2.0)
    		tmp = 1.0;
    	else
    		tmp = Float64(x / y);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y)
    	tmp = 0.0;
    	if ((abs((y - x)) / abs(y)) <= 2.0)
    		tmp = 1.0;
    	else
    		tmp = x / y;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_] := If[LessEqual[N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision], 2.0], 1.0, N[(x / y), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\frac{\left|y - x\right|}{\left|y\right|} \leq 2:\\
    \;\;\;\;1\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{x}{y}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f64 (fabs.f64 (-.f64 x y)) (fabs.f64 y)) < 2

      1. Initial program 100.0%

        \[\frac{\left|x - y\right|}{\left|y\right|} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{\left|x - y\right|}{\left|y\right|}} \]
        2. lift-fabs.f64N/A

          \[\leadsto \frac{\color{blue}{\left|x - y\right|}}{\left|y\right|} \]
        3. neg-fabsN/A

          \[\leadsto \frac{\color{blue}{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}}{\left|y\right|} \]
        4. lift-fabs.f64N/A

          \[\leadsto \frac{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}{\color{blue}{\left|y\right|}} \]
        5. div-fabsN/A

          \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
        6. lower-fabs.f64N/A

          \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
        7. lower-/.f64N/A

          \[\leadsto \left|\color{blue}{\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}}\right| \]
        8. lift--.f64N/A

          \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x - y\right)}\right)}{y}\right| \]
        9. sub-negN/A

          \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x + \left(\mathsf{neg}\left(y\right)\right)\right)}\right)}{y}\right| \]
        10. +-commutativeN/A

          \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) + x\right)}\right)}{y}\right| \]
        11. distribute-neg-inN/A

          \[\leadsto \left|\frac{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{y}\right| \]
        12. remove-double-negN/A

          \[\leadsto \left|\frac{\color{blue}{y} + \left(\mathsf{neg}\left(x\right)\right)}{y}\right| \]
        13. sub-negN/A

          \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
        14. lower--.f64100.0

          \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
      4. Applied rewrites100.0%

        \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
      5. Step-by-step derivation
        1. lift-fabs.f64N/A

          \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
        2. lift-/.f64N/A

          \[\leadsto \left|\color{blue}{\frac{y - x}{y}}\right| \]
        3. clear-numN/A

          \[\leadsto \left|\color{blue}{\frac{1}{\frac{y}{y - x}}}\right| \]
        4. lift-/.f64N/A

          \[\leadsto \left|\frac{1}{\color{blue}{\frac{y}{y - x}}}\right| \]
        5. fabs-divN/A

          \[\leadsto \color{blue}{\frac{\left|1\right|}{\left|\frac{y}{y - x}\right|}} \]
        6. metadata-evalN/A

          \[\leadsto \frac{\color{blue}{1}}{\left|\frac{y}{y - x}\right|} \]
        7. lift-fabs.f64N/A

          \[\leadsto \frac{1}{\color{blue}{\left|\frac{y}{y - x}\right|}} \]
        8. inv-powN/A

          \[\leadsto \color{blue}{{\left(\left|\frac{y}{y - x}\right|\right)}^{-1}} \]
        9. metadata-evalN/A

          \[\leadsto {\left(\left|\frac{y}{y - x}\right|\right)}^{\color{blue}{\left(2 \cdot \frac{-1}{2}\right)}} \]
        10. pow-powN/A

          \[\leadsto \color{blue}{{\left({\left(\left|\frac{y}{y - x}\right|\right)}^{2}\right)}^{\frac{-1}{2}}} \]
        11. pow2N/A

          \[\leadsto {\color{blue}{\left(\left|\frac{y}{y - x}\right| \cdot \left|\frac{y}{y - x}\right|\right)}}^{\frac{-1}{2}} \]
        12. lift-fabs.f64N/A

          \[\leadsto {\left(\color{blue}{\left|\frac{y}{y - x}\right|} \cdot \left|\frac{y}{y - x}\right|\right)}^{\frac{-1}{2}} \]
        13. lift-fabs.f64N/A

          \[\leadsto {\left(\left|\frac{y}{y - x}\right| \cdot \color{blue}{\left|\frac{y}{y - x}\right|}\right)}^{\frac{-1}{2}} \]
        14. sqr-absN/A

          \[\leadsto {\color{blue}{\left(\frac{y}{y - x} \cdot \frac{y}{y - x}\right)}}^{\frac{-1}{2}} \]
        15. pow-prod-downN/A

          \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}} \cdot {\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}}} \]
        16. pow-prod-upN/A

          \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\left(\frac{-1}{2} + \frac{-1}{2}\right)}} \]
        17. metadata-evalN/A

          \[\leadsto {\left(\frac{y}{y - x}\right)}^{\color{blue}{-1}} \]
        18. inv-powN/A

          \[\leadsto \color{blue}{\frac{1}{\frac{y}{y - x}}} \]
        19. lift-/.f64N/A

          \[\leadsto \frac{1}{\color{blue}{\frac{y}{y - x}}} \]
        20. clear-numN/A

          \[\leadsto \color{blue}{\frac{y - x}{y}} \]
        21. lift-/.f64100.0

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

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

        \[\leadsto \color{blue}{1} \]
      8. Step-by-step derivation
        1. Applied rewrites96.9%

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

        if 2 < (/.f64 (fabs.f64 (-.f64 x y)) (fabs.f64 y))

        1. Initial program 99.9%

          \[\frac{\left|x - y\right|}{\left|y\right|} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{\left|x - y\right|}{\left|y\right|}} \]
          2. lift-fabs.f64N/A

            \[\leadsto \frac{\color{blue}{\left|x - y\right|}}{\left|y\right|} \]
          3. neg-fabsN/A

            \[\leadsto \frac{\color{blue}{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}}{\left|y\right|} \]
          4. lift-fabs.f64N/A

            \[\leadsto \frac{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}{\color{blue}{\left|y\right|}} \]
          5. div-fabsN/A

            \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
          6. lower-fabs.f64N/A

            \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
          7. lower-/.f64N/A

            \[\leadsto \left|\color{blue}{\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}}\right| \]
          8. lift--.f64N/A

            \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x - y\right)}\right)}{y}\right| \]
          9. sub-negN/A

            \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x + \left(\mathsf{neg}\left(y\right)\right)\right)}\right)}{y}\right| \]
          10. +-commutativeN/A

            \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) + x\right)}\right)}{y}\right| \]
          11. distribute-neg-inN/A

            \[\leadsto \left|\frac{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{y}\right| \]
          12. remove-double-negN/A

            \[\leadsto \left|\frac{\color{blue}{y} + \left(\mathsf{neg}\left(x\right)\right)}{y}\right| \]
          13. sub-negN/A

            \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
          14. lower--.f6499.9

            \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
        4. Applied rewrites99.9%

          \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
        5. Step-by-step derivation
          1. lift-fabs.f64N/A

            \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
          2. lift-/.f64N/A

            \[\leadsto \left|\color{blue}{\frac{y - x}{y}}\right| \]
          3. clear-numN/A

            \[\leadsto \left|\color{blue}{\frac{1}{\frac{y}{y - x}}}\right| \]
          4. lift-/.f64N/A

            \[\leadsto \left|\frac{1}{\color{blue}{\frac{y}{y - x}}}\right| \]
          5. fabs-divN/A

            \[\leadsto \color{blue}{\frac{\left|1\right|}{\left|\frac{y}{y - x}\right|}} \]
          6. metadata-evalN/A

            \[\leadsto \frac{\color{blue}{1}}{\left|\frac{y}{y - x}\right|} \]
          7. lift-fabs.f64N/A

            \[\leadsto \frac{1}{\color{blue}{\left|\frac{y}{y - x}\right|}} \]
          8. inv-powN/A

            \[\leadsto \color{blue}{{\left(\left|\frac{y}{y - x}\right|\right)}^{-1}} \]
          9. metadata-evalN/A

            \[\leadsto {\left(\left|\frac{y}{y - x}\right|\right)}^{\color{blue}{\left(2 \cdot \frac{-1}{2}\right)}} \]
          10. pow-powN/A

            \[\leadsto \color{blue}{{\left({\left(\left|\frac{y}{y - x}\right|\right)}^{2}\right)}^{\frac{-1}{2}}} \]
          11. pow2N/A

            \[\leadsto {\color{blue}{\left(\left|\frac{y}{y - x}\right| \cdot \left|\frac{y}{y - x}\right|\right)}}^{\frac{-1}{2}} \]
          12. lift-fabs.f64N/A

            \[\leadsto {\left(\color{blue}{\left|\frac{y}{y - x}\right|} \cdot \left|\frac{y}{y - x}\right|\right)}^{\frac{-1}{2}} \]
          13. lift-fabs.f64N/A

            \[\leadsto {\left(\left|\frac{y}{y - x}\right| \cdot \color{blue}{\left|\frac{y}{y - x}\right|}\right)}^{\frac{-1}{2}} \]
          14. sqr-absN/A

            \[\leadsto {\color{blue}{\left(\frac{y}{y - x} \cdot \frac{y}{y - x}\right)}}^{\frac{-1}{2}} \]
          15. pow-prod-downN/A

            \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}} \cdot {\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}}} \]
          16. pow-prod-upN/A

            \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\left(\frac{-1}{2} + \frac{-1}{2}\right)}} \]
          17. metadata-evalN/A

            \[\leadsto {\left(\frac{y}{y - x}\right)}^{\color{blue}{-1}} \]
          18. inv-powN/A

            \[\leadsto \color{blue}{\frac{1}{\frac{y}{y - x}}} \]
          19. lift-/.f64N/A

            \[\leadsto \frac{1}{\color{blue}{\frac{y}{y - x}}} \]
          20. clear-numN/A

            \[\leadsto \color{blue}{\frac{y - x}{y}} \]
          21. lift-/.f6453.9

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

          \[\leadsto \color{blue}{\frac{y - x}{y}} \]
        7. Taylor expanded in y around 0

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

            \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{y} \]
          2. lower-neg.f6452.0

            \[\leadsto \frac{\color{blue}{-x}}{y} \]
        9. Applied rewrites52.0%

          \[\leadsto \frac{\color{blue}{-x}}{y} \]
        10. Step-by-step derivation
          1. Applied rewrites45.0%

            \[\leadsto \color{blue}{\frac{x}{y}} \]
        11. Recombined 2 regimes into one program.
        12. Final simplification72.0%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left|y - x\right|}{\left|y\right|} \leq 2:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
        13. Add Preprocessing

        Alternative 5: 74.6% accurate, 0.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \frac{x}{y}\\ \mathbf{if}\;x \leq -9 \cdot 10^{+247}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{+202}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (x y)
         :precision binary64
         (let* ((t_0 (- 1.0 (/ x y))))
           (if (<= x -9e+247) t_0 (if (<= x -1.7e+202) (/ x y) t_0))))
        double code(double x, double y) {
        	double t_0 = 1.0 - (x / y);
        	double tmp;
        	if (x <= -9e+247) {
        		tmp = t_0;
        	} else if (x <= -1.7e+202) {
        		tmp = x / y;
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8) :: t_0
            real(8) :: tmp
            t_0 = 1.0d0 - (x / y)
            if (x <= (-9d+247)) then
                tmp = t_0
            else if (x <= (-1.7d+202)) then
                tmp = x / y
            else
                tmp = t_0
            end if
            code = tmp
        end function
        
        public static double code(double x, double y) {
        	double t_0 = 1.0 - (x / y);
        	double tmp;
        	if (x <= -9e+247) {
        		tmp = t_0;
        	} else if (x <= -1.7e+202) {
        		tmp = x / y;
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(x, y):
        	t_0 = 1.0 - (x / y)
        	tmp = 0
        	if x <= -9e+247:
        		tmp = t_0
        	elif x <= -1.7e+202:
        		tmp = x / y
        	else:
        		tmp = t_0
        	return tmp
        
        function code(x, y)
        	t_0 = Float64(1.0 - Float64(x / y))
        	tmp = 0.0
        	if (x <= -9e+247)
        		tmp = t_0;
        	elseif (x <= -1.7e+202)
        		tmp = Float64(x / y);
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y)
        	t_0 = 1.0 - (x / y);
        	tmp = 0.0;
        	if (x <= -9e+247)
        		tmp = t_0;
        	elseif (x <= -1.7e+202)
        		tmp = x / y;
        	else
        		tmp = t_0;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9e+247], t$95$0, If[LessEqual[x, -1.7e+202], N[(x / y), $MachinePrecision], t$95$0]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := 1 - \frac{x}{y}\\
        \mathbf{if}\;x \leq -9 \cdot 10^{+247}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;x \leq -1.7 \cdot 10^{+202}:\\
        \;\;\;\;\frac{x}{y}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x < -9.00000000000000004e247 or -1.7e202 < x

          1. Initial program 100.0%

            \[\frac{\left|x - y\right|}{\left|y\right|} \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{\left|x - y\right|}{\left|y\right|}} \]
            2. lift-fabs.f64N/A

              \[\leadsto \frac{\color{blue}{\left|x - y\right|}}{\left|y\right|} \]
            3. neg-fabsN/A

              \[\leadsto \frac{\color{blue}{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}}{\left|y\right|} \]
            4. lift-fabs.f64N/A

              \[\leadsto \frac{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}{\color{blue}{\left|y\right|}} \]
            5. div-fabsN/A

              \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
            6. lower-fabs.f64N/A

              \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
            7. lower-/.f64N/A

              \[\leadsto \left|\color{blue}{\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}}\right| \]
            8. lift--.f64N/A

              \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x - y\right)}\right)}{y}\right| \]
            9. sub-negN/A

              \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x + \left(\mathsf{neg}\left(y\right)\right)\right)}\right)}{y}\right| \]
            10. +-commutativeN/A

              \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) + x\right)}\right)}{y}\right| \]
            11. distribute-neg-inN/A

              \[\leadsto \left|\frac{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{y}\right| \]
            12. remove-double-negN/A

              \[\leadsto \left|\frac{\color{blue}{y} + \left(\mathsf{neg}\left(x\right)\right)}{y}\right| \]
            13. sub-negN/A

              \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
            14. lower--.f64100.0

              \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
          4. Applied rewrites100.0%

            \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
          5. Step-by-step derivation
            1. lift-fabs.f64N/A

              \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
            2. lift-/.f64N/A

              \[\leadsto \left|\color{blue}{\frac{y - x}{y}}\right| \]
            3. clear-numN/A

              \[\leadsto \left|\color{blue}{\frac{1}{\frac{y}{y - x}}}\right| \]
            4. lift-/.f64N/A

              \[\leadsto \left|\frac{1}{\color{blue}{\frac{y}{y - x}}}\right| \]
            5. fabs-divN/A

              \[\leadsto \color{blue}{\frac{\left|1\right|}{\left|\frac{y}{y - x}\right|}} \]
            6. metadata-evalN/A

              \[\leadsto \frac{\color{blue}{1}}{\left|\frac{y}{y - x}\right|} \]
            7. lift-fabs.f64N/A

              \[\leadsto \frac{1}{\color{blue}{\left|\frac{y}{y - x}\right|}} \]
            8. inv-powN/A

              \[\leadsto \color{blue}{{\left(\left|\frac{y}{y - x}\right|\right)}^{-1}} \]
            9. metadata-evalN/A

              \[\leadsto {\left(\left|\frac{y}{y - x}\right|\right)}^{\color{blue}{\left(2 \cdot \frac{-1}{2}\right)}} \]
            10. pow-powN/A

              \[\leadsto \color{blue}{{\left({\left(\left|\frac{y}{y - x}\right|\right)}^{2}\right)}^{\frac{-1}{2}}} \]
            11. pow2N/A

              \[\leadsto {\color{blue}{\left(\left|\frac{y}{y - x}\right| \cdot \left|\frac{y}{y - x}\right|\right)}}^{\frac{-1}{2}} \]
            12. lift-fabs.f64N/A

              \[\leadsto {\left(\color{blue}{\left|\frac{y}{y - x}\right|} \cdot \left|\frac{y}{y - x}\right|\right)}^{\frac{-1}{2}} \]
            13. lift-fabs.f64N/A

              \[\leadsto {\left(\left|\frac{y}{y - x}\right| \cdot \color{blue}{\left|\frac{y}{y - x}\right|}\right)}^{\frac{-1}{2}} \]
            14. sqr-absN/A

              \[\leadsto {\color{blue}{\left(\frac{y}{y - x} \cdot \frac{y}{y - x}\right)}}^{\frac{-1}{2}} \]
            15. pow-prod-downN/A

              \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}} \cdot {\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}}} \]
            16. pow-prod-upN/A

              \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\left(\frac{-1}{2} + \frac{-1}{2}\right)}} \]
            17. metadata-evalN/A

              \[\leadsto {\left(\frac{y}{y - x}\right)}^{\color{blue}{-1}} \]
            18. inv-powN/A

              \[\leadsto \color{blue}{\frac{1}{\frac{y}{y - x}}} \]
            19. lift-/.f64N/A

              \[\leadsto \frac{1}{\color{blue}{\frac{y}{y - x}}} \]
            20. clear-numN/A

              \[\leadsto \color{blue}{\frac{y - x}{y}} \]
            21. lift--.f64N/A

              \[\leadsto \frac{\color{blue}{y - x}}{y} \]
            22. div-subN/A

              \[\leadsto \color{blue}{\frac{y}{y} - \frac{x}{y}} \]
            23. *-inversesN/A

              \[\leadsto \color{blue}{1} - \frac{x}{y} \]
            24. lower--.f64N/A

              \[\leadsto \color{blue}{1 - \frac{x}{y}} \]
            25. lower-/.f6481.6

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

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

          if -9.00000000000000004e247 < x < -1.7e202

          1. Initial program 100.0%

            \[\frac{\left|x - y\right|}{\left|y\right|} \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{\left|x - y\right|}{\left|y\right|}} \]
            2. lift-fabs.f64N/A

              \[\leadsto \frac{\color{blue}{\left|x - y\right|}}{\left|y\right|} \]
            3. neg-fabsN/A

              \[\leadsto \frac{\color{blue}{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}}{\left|y\right|} \]
            4. lift-fabs.f64N/A

              \[\leadsto \frac{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}{\color{blue}{\left|y\right|}} \]
            5. div-fabsN/A

              \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
            6. lower-fabs.f64N/A

              \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
            7. lower-/.f64N/A

              \[\leadsto \left|\color{blue}{\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}}\right| \]
            8. lift--.f64N/A

              \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x - y\right)}\right)}{y}\right| \]
            9. sub-negN/A

              \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x + \left(\mathsf{neg}\left(y\right)\right)\right)}\right)}{y}\right| \]
            10. +-commutativeN/A

              \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) + x\right)}\right)}{y}\right| \]
            11. distribute-neg-inN/A

              \[\leadsto \left|\frac{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{y}\right| \]
            12. remove-double-negN/A

              \[\leadsto \left|\frac{\color{blue}{y} + \left(\mathsf{neg}\left(x\right)\right)}{y}\right| \]
            13. sub-negN/A

              \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
            14. lower--.f64100.0

              \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
          4. Applied rewrites100.0%

            \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
          5. Step-by-step derivation
            1. lift-fabs.f64N/A

              \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
            2. lift-/.f64N/A

              \[\leadsto \left|\color{blue}{\frac{y - x}{y}}\right| \]
            3. clear-numN/A

              \[\leadsto \left|\color{blue}{\frac{1}{\frac{y}{y - x}}}\right| \]
            4. lift-/.f64N/A

              \[\leadsto \left|\frac{1}{\color{blue}{\frac{y}{y - x}}}\right| \]
            5. fabs-divN/A

              \[\leadsto \color{blue}{\frac{\left|1\right|}{\left|\frac{y}{y - x}\right|}} \]
            6. metadata-evalN/A

              \[\leadsto \frac{\color{blue}{1}}{\left|\frac{y}{y - x}\right|} \]
            7. lift-fabs.f64N/A

              \[\leadsto \frac{1}{\color{blue}{\left|\frac{y}{y - x}\right|}} \]
            8. inv-powN/A

              \[\leadsto \color{blue}{{\left(\left|\frac{y}{y - x}\right|\right)}^{-1}} \]
            9. metadata-evalN/A

              \[\leadsto {\left(\left|\frac{y}{y - x}\right|\right)}^{\color{blue}{\left(2 \cdot \frac{-1}{2}\right)}} \]
            10. pow-powN/A

              \[\leadsto \color{blue}{{\left({\left(\left|\frac{y}{y - x}\right|\right)}^{2}\right)}^{\frac{-1}{2}}} \]
            11. pow2N/A

              \[\leadsto {\color{blue}{\left(\left|\frac{y}{y - x}\right| \cdot \left|\frac{y}{y - x}\right|\right)}}^{\frac{-1}{2}} \]
            12. lift-fabs.f64N/A

              \[\leadsto {\left(\color{blue}{\left|\frac{y}{y - x}\right|} \cdot \left|\frac{y}{y - x}\right|\right)}^{\frac{-1}{2}} \]
            13. lift-fabs.f64N/A

              \[\leadsto {\left(\left|\frac{y}{y - x}\right| \cdot \color{blue}{\left|\frac{y}{y - x}\right|}\right)}^{\frac{-1}{2}} \]
            14. sqr-absN/A

              \[\leadsto {\color{blue}{\left(\frac{y}{y - x} \cdot \frac{y}{y - x}\right)}}^{\frac{-1}{2}} \]
            15. pow-prod-downN/A

              \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}} \cdot {\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}}} \]
            16. pow-prod-upN/A

              \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\left(\frac{-1}{2} + \frac{-1}{2}\right)}} \]
            17. metadata-evalN/A

              \[\leadsto {\left(\frac{y}{y - x}\right)}^{\color{blue}{-1}} \]
            18. inv-powN/A

              \[\leadsto \color{blue}{\frac{1}{\frac{y}{y - x}}} \]
            19. lift-/.f64N/A

              \[\leadsto \frac{1}{\color{blue}{\frac{y}{y - x}}} \]
            20. clear-numN/A

              \[\leadsto \color{blue}{\frac{y - x}{y}} \]
            21. lift-/.f647.9

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

            \[\leadsto \color{blue}{\frac{y - x}{y}} \]
          7. Taylor expanded in y around 0

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

              \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{y} \]
            2. lower-neg.f647.9

              \[\leadsto \frac{\color{blue}{-x}}{y} \]
          9. Applied rewrites7.9%

            \[\leadsto \frac{\color{blue}{-x}}{y} \]
          10. Step-by-step derivation
            1. Applied rewrites92.4%

              \[\leadsto \color{blue}{\frac{x}{y}} \]
          11. Recombined 2 regimes into one program.
          12. Add Preprocessing

          Alternative 6: 51.4% accurate, 19.0× speedup?

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

            \[\frac{\left|x - y\right|}{\left|y\right|} \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{\left|x - y\right|}{\left|y\right|}} \]
            2. lift-fabs.f64N/A

              \[\leadsto \frac{\color{blue}{\left|x - y\right|}}{\left|y\right|} \]
            3. neg-fabsN/A

              \[\leadsto \frac{\color{blue}{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}}{\left|y\right|} \]
            4. lift-fabs.f64N/A

              \[\leadsto \frac{\left|\mathsf{neg}\left(\left(x - y\right)\right)\right|}{\color{blue}{\left|y\right|}} \]
            5. div-fabsN/A

              \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
            6. lower-fabs.f64N/A

              \[\leadsto \color{blue}{\left|\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}\right|} \]
            7. lower-/.f64N/A

              \[\leadsto \left|\color{blue}{\frac{\mathsf{neg}\left(\left(x - y\right)\right)}{y}}\right| \]
            8. lift--.f64N/A

              \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x - y\right)}\right)}{y}\right| \]
            9. sub-negN/A

              \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(x + \left(\mathsf{neg}\left(y\right)\right)\right)}\right)}{y}\right| \]
            10. +-commutativeN/A

              \[\leadsto \left|\frac{\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(y\right)\right) + x\right)}\right)}{y}\right| \]
            11. distribute-neg-inN/A

              \[\leadsto \left|\frac{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{y}\right| \]
            12. remove-double-negN/A

              \[\leadsto \left|\frac{\color{blue}{y} + \left(\mathsf{neg}\left(x\right)\right)}{y}\right| \]
            13. sub-negN/A

              \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
            14. lower--.f64100.0

              \[\leadsto \left|\frac{\color{blue}{y - x}}{y}\right| \]
          4. Applied rewrites100.0%

            \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
          5. Step-by-step derivation
            1. lift-fabs.f64N/A

              \[\leadsto \color{blue}{\left|\frac{y - x}{y}\right|} \]
            2. lift-/.f64N/A

              \[\leadsto \left|\color{blue}{\frac{y - x}{y}}\right| \]
            3. clear-numN/A

              \[\leadsto \left|\color{blue}{\frac{1}{\frac{y}{y - x}}}\right| \]
            4. lift-/.f64N/A

              \[\leadsto \left|\frac{1}{\color{blue}{\frac{y}{y - x}}}\right| \]
            5. fabs-divN/A

              \[\leadsto \color{blue}{\frac{\left|1\right|}{\left|\frac{y}{y - x}\right|}} \]
            6. metadata-evalN/A

              \[\leadsto \frac{\color{blue}{1}}{\left|\frac{y}{y - x}\right|} \]
            7. lift-fabs.f64N/A

              \[\leadsto \frac{1}{\color{blue}{\left|\frac{y}{y - x}\right|}} \]
            8. inv-powN/A

              \[\leadsto \color{blue}{{\left(\left|\frac{y}{y - x}\right|\right)}^{-1}} \]
            9. metadata-evalN/A

              \[\leadsto {\left(\left|\frac{y}{y - x}\right|\right)}^{\color{blue}{\left(2 \cdot \frac{-1}{2}\right)}} \]
            10. pow-powN/A

              \[\leadsto \color{blue}{{\left({\left(\left|\frac{y}{y - x}\right|\right)}^{2}\right)}^{\frac{-1}{2}}} \]
            11. pow2N/A

              \[\leadsto {\color{blue}{\left(\left|\frac{y}{y - x}\right| \cdot \left|\frac{y}{y - x}\right|\right)}}^{\frac{-1}{2}} \]
            12. lift-fabs.f64N/A

              \[\leadsto {\left(\color{blue}{\left|\frac{y}{y - x}\right|} \cdot \left|\frac{y}{y - x}\right|\right)}^{\frac{-1}{2}} \]
            13. lift-fabs.f64N/A

              \[\leadsto {\left(\left|\frac{y}{y - x}\right| \cdot \color{blue}{\left|\frac{y}{y - x}\right|}\right)}^{\frac{-1}{2}} \]
            14. sqr-absN/A

              \[\leadsto {\color{blue}{\left(\frac{y}{y - x} \cdot \frac{y}{y - x}\right)}}^{\frac{-1}{2}} \]
            15. pow-prod-downN/A

              \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}} \cdot {\left(\frac{y}{y - x}\right)}^{\frac{-1}{2}}} \]
            16. pow-prod-upN/A

              \[\leadsto \color{blue}{{\left(\frac{y}{y - x}\right)}^{\left(\frac{-1}{2} + \frac{-1}{2}\right)}} \]
            17. metadata-evalN/A

              \[\leadsto {\left(\frac{y}{y - x}\right)}^{\color{blue}{-1}} \]
            18. inv-powN/A

              \[\leadsto \color{blue}{\frac{1}{\frac{y}{y - x}}} \]
            19. lift-/.f64N/A

              \[\leadsto \frac{1}{\color{blue}{\frac{y}{y - x}}} \]
            20. clear-numN/A

              \[\leadsto \color{blue}{\frac{y - x}{y}} \]
            21. lift-/.f6477.8

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

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

            \[\leadsto \color{blue}{1} \]
          8. Step-by-step derivation
            1. Applied rewrites52.9%

              \[\leadsto \color{blue}{1} \]
            2. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 2024268 
            (FPCore (x y)
              :name "Numeric.LinearAlgebra.Util:formatSparse from hmatrix-0.16.1.5"
              :precision binary64
              (/ (fabs (- x y)) (fabs y)))