Numeric.LinearAlgebra.Util:formatSparse from hmatrix-0.16.1.5

Percentage Accurate: 100.0% → 100.0%
Time: 3.5s
Alternatives: 7
Speedup: 2.0×

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 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{\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, 2.0× 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. Step-by-step derivation
    1. div-fabs100.0%

      \[\leadsto \color{blue}{\left|\frac{x - y}{y}\right|} \]
    2. div-sub100.0%

      \[\leadsto \left|\color{blue}{\frac{x}{y} - \frac{y}{y}}\right| \]
    3. pow1100.0%

      \[\leadsto \left|\frac{x}{y} - \frac{\color{blue}{{y}^{1}}}{y}\right| \]
    4. pow1100.0%

      \[\leadsto \left|\frac{x}{y} - \frac{{y}^{1}}{\color{blue}{{y}^{1}}}\right| \]
    5. pow-div100.0%

      \[\leadsto \left|\frac{x}{y} - \color{blue}{{y}^{\left(1 - 1\right)}}\right| \]
    6. metadata-eval100.0%

      \[\leadsto \left|\frac{x}{y} - {y}^{\color{blue}{0}}\right| \]
    7. metadata-eval100.0%

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

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

    \[\leadsto \left|\frac{x}{y} + -1\right| \]

Alternative 2: 74.2% accurate, 18.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{-212} \lor \neg \left(y \leq -6.6 \cdot 10^{-257}\right) \land y \leq 2.5 \cdot 10^{-172}:\\
\;\;\;\;1 - \frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.5999999999999999e-212 or -6.6e-257 < y < 2.5e-172

    1. Initial program 100.0%

      \[\frac{\left|x - y\right|}{\left|y\right|} \]
    2. Step-by-step derivation
      1. add-sqr-sqrt73.8%

        \[\leadsto \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{\left|y\right|} \]
      2. fabs-sqr73.8%

        \[\leadsto \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{\left|y\right|} \]
      3. add-sqr-sqrt7.3%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right|} \]
      4. fabs-sqr7.3%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      5. add-sqr-sqrt7.4%

        \[\leadsto \frac{\color{blue}{x - y}}{\sqrt{y} \cdot \sqrt{y}} \]
      6. add-sqr-sqrt20.4%

        \[\leadsto \frac{x - y}{\color{blue}{y}} \]
      7. clear-num20.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x - y}}} \]
      8. associate-/r/20.3%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    3. Applied egg-rr20.3%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    4. Step-by-step derivation
      1. associate-*l/20.4%

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

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

        \[\leadsto \color{blue}{\frac{-\left(x - y\right)}{-y}} \]
      4. sub-neg20.4%

        \[\leadsto \frac{-\color{blue}{\left(x + \left(-y\right)\right)}}{-y} \]
      5. distribute-neg-in20.4%

        \[\leadsto \frac{\color{blue}{\left(-x\right) + \left(-\left(-y\right)\right)}}{-y} \]
      6. remove-double-neg20.4%

        \[\leadsto \frac{\left(-x\right) + \color{blue}{y}}{-y} \]
      7. add-sqr-sqrt12.9%

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

        \[\leadsto \frac{\left(-x\right) + y}{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}} \]
      9. sqr-neg14.0%

        \[\leadsto \frac{\left(-x\right) + y}{\sqrt{\color{blue}{y \cdot y}}} \]
      10. sqrt-unprod13.4%

        \[\leadsto \frac{\left(-x\right) + y}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      11. add-sqr-sqrt80.6%

        \[\leadsto \frac{\left(-x\right) + y}{\color{blue}{y}} \]
    5. Applied egg-rr80.6%

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

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

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

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

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

    if -1.5999999999999999e-212 < y < -6.6e-257 or 2.5e-172 < y

    1. Initial program 100.0%

      \[\frac{\left|x - y\right|}{\left|y\right|} \]
    2. Step-by-step derivation
      1. add-sqr-sqrt22.3%

        \[\leadsto \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{\left|y\right|} \]
      2. fabs-sqr22.3%

        \[\leadsto \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{\left|y\right|} \]
      3. add-sqr-sqrt21.3%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right|} \]
      4. fabs-sqr21.3%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      5. add-sqr-sqrt22.4%

        \[\leadsto \frac{\color{blue}{x - y}}{\sqrt{y} \cdot \sqrt{y}} \]
      6. add-sqr-sqrt29.9%

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

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x - y}}} \]
      8. associate-/r/29.8%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    3. Applied egg-rr29.8%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    4. Step-by-step derivation
      1. associate-*l/29.9%

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

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

        \[\leadsto \frac{\color{blue}{x + \left(-y\right)}}{y} \]
      4. add-sqr-sqrt7.5%

        \[\leadsto \frac{x + \color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{y} \]
      5. sqrt-unprod59.9%

        \[\leadsto \frac{x + \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{y} \]
      6. sqr-neg59.9%

        \[\leadsto \frac{x + \sqrt{\color{blue}{y \cdot y}}}{y} \]
      7. sqrt-unprod77.5%

        \[\leadsto \frac{x + \color{blue}{\sqrt{y} \cdot \sqrt{y}}}{y} \]
      8. add-sqr-sqrt86.3%

        \[\leadsto \frac{x + \color{blue}{y}}{y} \]
    5. Applied egg-rr86.3%

      \[\leadsto \color{blue}{\frac{x + y}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.6 \cdot 10^{-212} \lor \neg \left(y \leq -6.6 \cdot 10^{-257}\right) \land y \leq 2.5 \cdot 10^{-172}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y}{y}\\ \end{array} \]

Alternative 3: 57.3% accurate, 28.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{+231} \lor \neg \left(x \leq 2.9 \cdot 10^{+143}\right):\\
\;\;\;\;\frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.9999999999999997e231 or 2.8999999999999998e143 < x

    1. Initial program 99.9%

      \[\frac{\left|x - y\right|}{\left|y\right|} \]
    2. Step-by-step derivation
      1. add-sqr-sqrt68.1%

        \[\leadsto \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{\left|y\right|} \]
      2. fabs-sqr68.1%

        \[\leadsto \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{\left|y\right|} \]
      3. add-sqr-sqrt38.6%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right|} \]
      4. fabs-sqr38.6%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      5. add-sqr-sqrt38.8%

        \[\leadsto \frac{\color{blue}{x - y}}{\sqrt{y} \cdot \sqrt{y}} \]
      6. add-sqr-sqrt52.1%

        \[\leadsto \frac{x - y}{\color{blue}{y}} \]
      7. clear-num52.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x - y}}} \]
      8. associate-/r/52.0%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    3. Applied egg-rr52.0%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    4. Taylor expanded in y around 0 51.8%

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

    if -6.9999999999999997e231 < x < 2.8999999999999998e143

    1. Initial program 100.0%

      \[\frac{\left|x - y\right|}{\left|y\right|} \]
    2. Step-by-step derivation
      1. add-sqr-sqrt48.1%

        \[\leadsto \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{\left|y\right|} \]
      2. fabs-sqr48.1%

        \[\leadsto \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{\left|y\right|} \]
      3. add-sqr-sqrt6.3%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right|} \]
      4. fabs-sqr6.3%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      5. add-sqr-sqrt6.9%

        \[\leadsto \frac{\color{blue}{x - y}}{\sqrt{y} \cdot \sqrt{y}} \]
      6. add-sqr-sqrt17.0%

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

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x - y}}} \]
      8. associate-/r/16.9%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    3. Applied egg-rr16.9%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    4. Step-by-step derivation
      1. associate-*l/17.0%

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

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

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

        \[\leadsto \frac{x + \color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{y} \]
      5. sqrt-unprod32.8%

        \[\leadsto \frac{x + \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{y} \]
      6. sqr-neg32.8%

        \[\leadsto \frac{x + \sqrt{\color{blue}{y \cdot y}}}{y} \]
      7. sqrt-unprod37.0%

        \[\leadsto \frac{x + \color{blue}{\sqrt{y} \cdot \sqrt{y}}}{y} \]
      8. add-sqr-sqrt81.2%

        \[\leadsto \frac{x + \color{blue}{y}}{y} \]
    5. Applied egg-rr81.2%

      \[\leadsto \color{blue}{\frac{x + y}{y}} \]
    6. Taylor expanded in x around 0 67.8%

      \[\leadsto \color{blue}{1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification64.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7 \cdot 10^{+231} \lor \neg \left(x \leq 2.9 \cdot 10^{+143}\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 4: 58.2% accurate, 28.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+179}:\\
\;\;\;\;\frac{-x}{y}\\

\mathbf{elif}\;x \leq 2.8 \cdot 10^{+143}:\\
\;\;\;\;1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.50000000000000052e179

    1. Initial program 99.9%

      \[\frac{\left|x - y\right|}{\left|y\right|} \]
    2. Step-by-step derivation
      1. add-sqr-sqrt3.9%

        \[\leadsto \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{\left|y\right|} \]
      2. fabs-sqr3.9%

        \[\leadsto \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{\left|y\right|} \]
      3. add-sqr-sqrt0.0%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right|} \]
      4. fabs-sqr0.0%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      5. add-sqr-sqrt0.2%

        \[\leadsto \frac{\color{blue}{x - y}}{\sqrt{y} \cdot \sqrt{y}} \]
      6. add-sqr-sqrt36.2%

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

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x - y}}} \]
      8. associate-/r/36.1%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    3. Applied egg-rr36.1%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    4. Step-by-step derivation
      1. associate-*l/36.2%

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

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

        \[\leadsto \color{blue}{\frac{-\left(x - y\right)}{-y}} \]
      4. sub-neg36.2%

        \[\leadsto \frac{-\color{blue}{\left(x + \left(-y\right)\right)}}{-y} \]
      5. distribute-neg-in36.2%

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

        \[\leadsto \frac{\left(-x\right) + \color{blue}{y}}{-y} \]
      7. add-sqr-sqrt35.8%

        \[\leadsto \frac{\left(-x\right) + y}{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}} \]
      8. sqrt-unprod76.7%

        \[\leadsto \frac{\left(-x\right) + y}{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}} \]
      9. sqr-neg76.7%

        \[\leadsto \frac{\left(-x\right) + y}{\sqrt{\color{blue}{y \cdot y}}} \]
      10. sqrt-unprod59.8%

        \[\leadsto \frac{\left(-x\right) + y}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      11. add-sqr-sqrt64.2%

        \[\leadsto \frac{\left(-x\right) + y}{\color{blue}{y}} \]
    5. Applied egg-rr64.2%

      \[\leadsto \color{blue}{\frac{\left(-x\right) + y}{y}} \]
    6. Taylor expanded in x around inf 53.0%

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

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

        \[\leadsto \frac{\color{blue}{-x}}{y} \]
    8. Simplified53.0%

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

    if -6.50000000000000052e179 < x < 2.79999999999999998e143

    1. Initial program 100.0%

      \[\frac{\left|x - y\right|}{\left|y\right|} \]
    2. Step-by-step derivation
      1. add-sqr-sqrt50.3%

        \[\leadsto \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{\left|y\right|} \]
      2. fabs-sqr50.3%

        \[\leadsto \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{\left|y\right|} \]
      3. add-sqr-sqrt6.6%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right|} \]
      4. fabs-sqr6.6%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      5. add-sqr-sqrt7.2%

        \[\leadsto \frac{\color{blue}{x - y}}{\sqrt{y} \cdot \sqrt{y}} \]
      6. add-sqr-sqrt16.7%

        \[\leadsto \frac{x - y}{\color{blue}{y}} \]
      7. clear-num16.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x - y}}} \]
      8. associate-/r/16.7%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    3. Applied egg-rr16.7%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    4. Step-by-step derivation
      1. associate-*l/16.7%

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

        \[\leadsto \frac{\color{blue}{x - y}}{y} \]
      3. sub-neg16.7%

        \[\leadsto \frac{\color{blue}{x + \left(-y\right)}}{y} \]
      4. add-sqr-sqrt9.4%

        \[\leadsto \frac{x + \color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{y} \]
      5. sqrt-unprod33.3%

        \[\leadsto \frac{x + \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{y} \]
      6. sqr-neg33.3%

        \[\leadsto \frac{x + \sqrt{\color{blue}{y \cdot y}}}{y} \]
      7. sqrt-unprod37.7%

        \[\leadsto \frac{x + \color{blue}{\sqrt{y} \cdot \sqrt{y}}}{y} \]
      8. add-sqr-sqrt82.9%

        \[\leadsto \frac{x + \color{blue}{y}}{y} \]
    5. Applied egg-rr82.9%

      \[\leadsto \color{blue}{\frac{x + y}{y}} \]
    6. Taylor expanded in x around 0 69.8%

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

    if 2.79999999999999998e143 < x

    1. Initial program 100.0%

      \[\frac{\left|x - y\right|}{\left|y\right|} \]
    2. Step-by-step derivation
      1. add-sqr-sqrt94.2%

        \[\leadsto \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{\left|y\right|} \]
      2. fabs-sqr94.2%

        \[\leadsto \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{\left|y\right|} \]
      3. add-sqr-sqrt54.9%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right|} \]
      4. fabs-sqr54.9%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      5. add-sqr-sqrt55.1%

        \[\leadsto \frac{\color{blue}{x - y}}{\sqrt{y} \cdot \sqrt{y}} \]
      6. add-sqr-sqrt55.5%

        \[\leadsto \frac{x - y}{\color{blue}{y}} \]
      7. clear-num55.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x - y}}} \]
      8. associate-/r/55.4%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    3. Applied egg-rr55.4%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    4. Taylor expanded in y around 0 56.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+179}:\\ \;\;\;\;\frac{-x}{y}\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{+143}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 5: 74.7% accurate, 29.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 6.49999999999999954e260

    1. Initial program 100.0%

      \[\frac{\left|x - y\right|}{\left|y\right|} \]
    2. Step-by-step derivation
      1. add-sqr-sqrt50.0%

        \[\leadsto \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{\left|y\right|} \]
      2. fabs-sqr50.0%

        \[\leadsto \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{\left|y\right|} \]
      3. add-sqr-sqrt10.1%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right|} \]
      4. fabs-sqr10.1%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      5. add-sqr-sqrt10.6%

        \[\leadsto \frac{\color{blue}{x - y}}{\sqrt{y} \cdot \sqrt{y}} \]
      6. add-sqr-sqrt21.9%

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

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x - y}}} \]
      8. associate-/r/21.8%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    3. Applied egg-rr21.8%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    4. Step-by-step derivation
      1. associate-*l/21.9%

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

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

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

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

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

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

        \[\leadsto \frac{\left(-x\right) + y}{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}} \]
      8. sqrt-unprod28.5%

        \[\leadsto \frac{\left(-x\right) + y}{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}} \]
      9. sqr-neg28.5%

        \[\leadsto \frac{\left(-x\right) + y}{\sqrt{\color{blue}{y \cdot y}}} \]
      10. sqrt-unprod38.7%

        \[\leadsto \frac{\left(-x\right) + y}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      11. add-sqr-sqrt79.2%

        \[\leadsto \frac{\left(-x\right) + y}{\color{blue}{y}} \]
    5. Applied egg-rr79.2%

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

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{x}{y}} \]
    7. Step-by-step derivation
      1. mul-1-neg79.2%

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

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

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

    if 6.49999999999999954e260 < x

    1. Initial program 100.0%

      \[\frac{\left|x - y\right|}{\left|y\right|} \]
    2. Step-by-step derivation
      1. add-sqr-sqrt99.7%

        \[\leadsto \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{\left|y\right|} \]
      2. fabs-sqr99.7%

        \[\leadsto \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{\left|y\right|} \]
      3. add-sqr-sqrt74.7%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right|} \]
      4. fabs-sqr74.7%

        \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      5. add-sqr-sqrt74.9%

        \[\leadsto \frac{\color{blue}{x - y}}{\sqrt{y} \cdot \sqrt{y}} \]
      6. add-sqr-sqrt75.0%

        \[\leadsto \frac{x - y}{\color{blue}{y}} \]
      7. clear-num75.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x - y}}} \]
      8. associate-/r/75.0%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    3. Applied egg-rr75.0%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
    4. Taylor expanded in y around 0 75.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 6.5 \cdot 10^{+260}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 6: 1.3% accurate, 205.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. Step-by-step derivation
    1. add-sqr-sqrt52.3%

      \[\leadsto \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{\left|y\right|} \]
    2. fabs-sqr52.3%

      \[\leadsto \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{\left|y\right|} \]
    3. add-sqr-sqrt13.2%

      \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right|} \]
    4. fabs-sqr13.2%

      \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
    5. add-sqr-sqrt13.7%

      \[\leadsto \frac{\color{blue}{x - y}}{\sqrt{y} \cdot \sqrt{y}} \]
    6. add-sqr-sqrt24.4%

      \[\leadsto \frac{x - y}{\color{blue}{y}} \]
    7. clear-num24.3%

      \[\leadsto \color{blue}{\frac{1}{\frac{y}{x - y}}} \]
    8. associate-/r/24.3%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
  3. Applied egg-rr24.3%

    \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
  4. Taylor expanded in y around inf 1.3%

    \[\leadsto \color{blue}{-1} \]
  5. Final simplification1.3%

    \[\leadsto -1 \]

Alternative 7: 51.3% accurate, 205.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. Step-by-step derivation
    1. add-sqr-sqrt52.3%

      \[\leadsto \frac{\left|\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}\right|}{\left|y\right|} \]
    2. fabs-sqr52.3%

      \[\leadsto \frac{\color{blue}{\sqrt{x - y} \cdot \sqrt{x - y}}}{\left|y\right|} \]
    3. add-sqr-sqrt13.2%

      \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\left|\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right|} \]
    4. fabs-sqr13.2%

      \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
    5. add-sqr-sqrt13.7%

      \[\leadsto \frac{\color{blue}{x - y}}{\sqrt{y} \cdot \sqrt{y}} \]
    6. add-sqr-sqrt24.4%

      \[\leadsto \frac{x - y}{\color{blue}{y}} \]
    7. clear-num24.3%

      \[\leadsto \color{blue}{\frac{1}{\frac{y}{x - y}}} \]
    8. associate-/r/24.3%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
  3. Applied egg-rr24.3%

    \[\leadsto \color{blue}{\frac{1}{y} \cdot \left(x - y\right)} \]
  4. Step-by-step derivation
    1. associate-*l/24.4%

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

      \[\leadsto \frac{\color{blue}{x - y}}{y} \]
    3. sub-neg24.4%

      \[\leadsto \frac{\color{blue}{x + \left(-y\right)}}{y} \]
    4. add-sqr-sqrt10.7%

      \[\leadsto \frac{x + \color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{y} \]
    5. sqrt-unprod36.1%

      \[\leadsto \frac{x + \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{y} \]
    6. sqr-neg36.1%

      \[\leadsto \frac{x + \sqrt{\color{blue}{y \cdot y}}}{y} \]
    7. sqrt-unprod38.0%

      \[\leadsto \frac{x + \color{blue}{\sqrt{y} \cdot \sqrt{y}}}{y} \]
    8. add-sqr-sqrt75.9%

      \[\leadsto \frac{x + \color{blue}{y}}{y} \]
  5. Applied egg-rr75.9%

    \[\leadsto \color{blue}{\frac{x + y}{y}} \]
  6. Taylor expanded in x around 0 55.4%

    \[\leadsto \color{blue}{1} \]
  7. Final simplification55.4%

    \[\leadsto 1 \]

Reproduce

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