Numeric.LinearAlgebra.Util:formatSparse from hmatrix-0.16.1.5

Percentage Accurate: 100.0% → 100.0%
Time: 6.1s
Alternatives: 5
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);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y)
use fmin_fmax_functions
    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 5 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);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y)
use fmin_fmax_functions
    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{y - x}{y}\right| \end{array} \]
(FPCore (x y) :precision binary64 (fabs (/ (- y x) y)))
double code(double x, double y) {
	return fabs(((y - x) / y));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

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

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

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

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

Alternative 2: 73.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|\frac{y - x}{y}\right|\\ \mathbf{if}\;t\_0 \leq 1000000:\\ \;\;\;\;1\\ \mathbf{elif}\;t\_0 \leq 10^{+177}:\\ \;\;\;\;\frac{-x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (fabs (/ (- y x) y))))
   (if (<= t_0 1000000.0) 1.0 (if (<= t_0 1e+177) (/ (- x) y) (/ x y)))))
double code(double x, double y) {
	double t_0 = fabs(((y - x) / y));
	double tmp;
	if (t_0 <= 1000000.0) {
		tmp = 1.0;
	} else if (t_0 <= 1e+177) {
		tmp = -x / y;
	} else {
		tmp = x / y;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = abs(((y - x) / y))
    if (t_0 <= 1000000.0d0) then
        tmp = 1.0d0
    else if (t_0 <= 1d+177) then
        tmp = -x / y
    else
        tmp = x / y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = Math.abs(((y - x) / y));
	double tmp;
	if (t_0 <= 1000000.0) {
		tmp = 1.0;
	} else if (t_0 <= 1e+177) {
		tmp = -x / y;
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y):
	t_0 = math.fabs(((y - x) / y))
	tmp = 0
	if t_0 <= 1000000.0:
		tmp = 1.0
	elif t_0 <= 1e+177:
		tmp = -x / y
	else:
		tmp = x / y
	return tmp
function code(x, y)
	t_0 = abs(Float64(Float64(y - x) / y))
	tmp = 0.0
	if (t_0 <= 1000000.0)
		tmp = 1.0;
	elseif (t_0 <= 1e+177)
		tmp = Float64(Float64(-x) / y);
	else
		tmp = Float64(x / y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = abs(((y - x) / y));
	tmp = 0.0;
	if (t_0 <= 1000000.0)
		tmp = 1.0;
	elseif (t_0 <= 1e+177)
		tmp = -x / y;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[Abs[N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 1000000.0], 1.0, If[LessEqual[t$95$0, 1e+177], N[((-x) / y), $MachinePrecision], N[(x / y), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left|\frac{y - x}{y}\right|\\
\mathbf{if}\;t\_0 \leq 1000000:\\
\;\;\;\;1\\

\mathbf{elif}\;t\_0 \leq 10^{+177}:\\
\;\;\;\;\frac{-x}{y}\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

      if 1e6 < (/.f64 (fabs.f64 (-.f64 x y)) (fabs.f64 y)) < 1e177

      1. Initial program 100.0%

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

          \[\leadsto \frac{\color{blue}{\left|x - y\right|}}{\left|y\right|} \]
        2. rem-sqrt-square-revN/A

          \[\leadsto \frac{\color{blue}{\sqrt{\left(x - y\right) \cdot \left(x - y\right)}}}{\left|y\right|} \]
        3. pow1/2N/A

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

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

          \[\leadsto \frac{{\left(\color{blue}{\sqrt{\left(x - y\right) \cdot \left(x - y\right)}} \cdot \left(x - y\right)\right)}^{\frac{1}{2}}}{\left|y\right|} \]
        6. rem-sqrt-square-revN/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{\sqrt{y - x}} \cdot {\left(y - x\right)}^{\frac{1}{2}}}{\left|y\right|} \]
        17. pow1/2N/A

          \[\leadsto \frac{\sqrt{y - x} \cdot \color{blue}{\sqrt{y - x}}}{\left|y\right|} \]
        18. add-sqr-sqrtN/A

          \[\leadsto \frac{\color{blue}{y - x}}{\left|y\right|} \]
        19. lower--.f6444.4

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

          \[\leadsto \frac{y - x}{\color{blue}{\left|y\right|}} \]
        21. rem-sqrt-square-revN/A

          \[\leadsto \frac{y - x}{\color{blue}{\sqrt{y \cdot y}}} \]
        22. sqrt-prodN/A

          \[\leadsto \frac{y - x}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
        23. add-sqr-sqrt63.4

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

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

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

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

        if 1e177 < (/.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. rem-sqrt-square-revN/A

            \[\leadsto \frac{\color{blue}{\sqrt{\left(x - y\right) \cdot \left(x - y\right)}}}{\left|y\right|} \]
          4. sqrt-prodN/A

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

            \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\left|y\right|}} \]
          6. rem-sqrt-square-revN/A

            \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y \cdot y}}} \]
          7. sqrt-prodN/A

            \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
          8. add-sqr-sqrtN/A

            \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{y}} \]
          9. add-sqr-sqrtN/A

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

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

            \[\leadsto \color{blue}{\frac{x}{y} - \frac{y}{y}} \]
          12. pow1N/A

            \[\leadsto \frac{x}{y} - \frac{\color{blue}{{y}^{1}}}{y} \]
          13. pow1N/A

            \[\leadsto \frac{x}{y} - \frac{{y}^{1}}{\color{blue}{{y}^{1}}} \]
          14. pow-divN/A

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

            \[\leadsto \frac{x}{y} - {y}^{\color{blue}{0}} \]
          16. metadata-evalN/A

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

            \[\leadsto \color{blue}{\frac{x}{y} - 1} \]
          18. lower-/.f6461.5

            \[\leadsto \color{blue}{\frac{x}{y}} - 1 \]
        4. Applied rewrites61.5%

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;\left|\frac{y - x}{y}\right| \leq 1000000:\\ \;\;\;\;1\\ \mathbf{elif}\;\left|\frac{y - x}{y}\right| \leq 10^{+177}:\\ \;\;\;\;\frac{-x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
        9. Add Preprocessing

        Alternative 3: 75.1% accurate, 0.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|\frac{y - x}{y}\right| \leq 10^{+177}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
        (FPCore (x y)
         :precision binary64
         (if (<= (fabs (/ (- y x) y)) 1e+177) (- 1.0 (/ x y)) (/ x y)))
        double code(double x, double y) {
        	double tmp;
        	if (fabs(((y - x) / y)) <= 1e+177) {
        		tmp = 1.0 - (x / y);
        	} else {
        		tmp = x / y;
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(x, y)
        use fmin_fmax_functions
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8) :: tmp
            if (abs(((y - x) / y)) <= 1d+177) 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 (Math.abs(((y - x) / y)) <= 1e+177) {
        		tmp = 1.0 - (x / y);
        	} else {
        		tmp = x / y;
        	}
        	return tmp;
        }
        
        def code(x, y):
        	tmp = 0
        	if math.fabs(((y - x) / y)) <= 1e+177:
        		tmp = 1.0 - (x / y)
        	else:
        		tmp = x / y
        	return tmp
        
        function code(x, y)
        	tmp = 0.0
        	if (abs(Float64(Float64(y - x) / y)) <= 1e+177)
        		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 (abs(((y - x) / y)) <= 1e+177)
        		tmp = 1.0 - (x / y);
        	else
        		tmp = x / y;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_] := If[LessEqual[N[Abs[N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], 1e+177], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;\left|\frac{y - x}{y}\right| \leq 10^{+177}:\\
        \;\;\;\;1 - \frac{x}{y}\\
        
        \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)) < 1e177

          1. Initial program 100.0%

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

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

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

            \[\leadsto \color{blue}{\sqrt{\frac{y - x}{y}} \cdot \sqrt{\frac{y - x}{y}}} \]
          5. Step-by-step derivation
            1. lift-*.f64N/A

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

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

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

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

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

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

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

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

              \[\leadsto 1 - \color{blue}{\frac{x}{y}} \]
            10. lower--.f6485.6

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

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

          if 1e177 < (/.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. rem-sqrt-square-revN/A

              \[\leadsto \frac{\color{blue}{\sqrt{\left(x - y\right) \cdot \left(x - y\right)}}}{\left|y\right|} \]
            4. sqrt-prodN/A

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

              \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\left|y\right|}} \]
            6. rem-sqrt-square-revN/A

              \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y \cdot y}}} \]
            7. sqrt-prodN/A

              \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
            8. add-sqr-sqrtN/A

              \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{y}} \]
            9. add-sqr-sqrtN/A

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

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

              \[\leadsto \color{blue}{\frac{x}{y} - \frac{y}{y}} \]
            12. pow1N/A

              \[\leadsto \frac{x}{y} - \frac{\color{blue}{{y}^{1}}}{y} \]
            13. pow1N/A

              \[\leadsto \frac{x}{y} - \frac{{y}^{1}}{\color{blue}{{y}^{1}}} \]
            14. pow-divN/A

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

              \[\leadsto \frac{x}{y} - {y}^{\color{blue}{0}} \]
            16. metadata-evalN/A

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

              \[\leadsto \color{blue}{\frac{x}{y} - 1} \]
            18. lower-/.f6461.5

              \[\leadsto \color{blue}{\frac{x}{y}} - 1 \]
          4. Applied rewrites61.5%

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

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

              \[\leadsto \color{blue}{\frac{x}{y}} \]
          7. Recombined 2 regimes into one program.
          8. Final simplification80.2%

            \[\leadsto \begin{array}{l} \mathbf{if}\;\left|\frac{y - x}{y}\right| \leq 10^{+177}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
          9. Add Preprocessing

          Alternative 4: 73.4% accurate, 0.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|\frac{y - x}{y}\right| \leq 2:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
          (FPCore (x y)
           :precision binary64
           (if (<= (fabs (/ (- y x) y)) 2.0) 1.0 (/ x y)))
          double code(double x, double y) {
          	double tmp;
          	if (fabs(((y - x) / y)) <= 2.0) {
          		tmp = 1.0;
          	} else {
          		tmp = x / y;
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x, y)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8) :: tmp
              if (abs(((y - x) / 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) / y)) <= 2.0) {
          		tmp = 1.0;
          	} else {
          		tmp = x / y;
          	}
          	return tmp;
          }
          
          def code(x, y):
          	tmp = 0
          	if math.fabs(((y - x) / y)) <= 2.0:
          		tmp = 1.0
          	else:
          		tmp = x / y
          	return tmp
          
          function code(x, y)
          	tmp = 0.0
          	if (abs(Float64(Float64(y - x) / 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) / y)) <= 2.0)
          		tmp = 1.0;
          	else
          		tmp = x / y;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_] := If[LessEqual[N[Abs[N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], 2.0], 1.0, N[(x / y), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;\left|\frac{y - x}{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. add-sqr-sqrtN/A

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

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

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

              \[\leadsto \color{blue}{1} \]
            6. Step-by-step derivation
              1. Applied rewrites94.6%

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

              if 2 < (/.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. rem-sqrt-square-revN/A

                  \[\leadsto \frac{\color{blue}{\sqrt{\left(x - y\right) \cdot \left(x - y\right)}}}{\left|y\right|} \]
                4. sqrt-prodN/A

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

                  \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\left|y\right|}} \]
                6. rem-sqrt-square-revN/A

                  \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y \cdot y}}} \]
                7. sqrt-prodN/A

                  \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
                8. add-sqr-sqrtN/A

                  \[\leadsto \frac{\sqrt{x - y} \cdot \sqrt{x - y}}{\color{blue}{y}} \]
                9. add-sqr-sqrtN/A

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

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

                  \[\leadsto \color{blue}{\frac{x}{y} - \frac{y}{y}} \]
                12. pow1N/A

                  \[\leadsto \frac{x}{y} - \frac{\color{blue}{{y}^{1}}}{y} \]
                13. pow1N/A

                  \[\leadsto \frac{x}{y} - \frac{{y}^{1}}{\color{blue}{{y}^{1}}} \]
                14. pow-divN/A

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

                  \[\leadsto \frac{x}{y} - {y}^{\color{blue}{0}} \]
                16. metadata-evalN/A

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

                  \[\leadsto \color{blue}{\frac{x}{y} - 1} \]
                18. lower-/.f6448.8

                  \[\leadsto \color{blue}{\frac{x}{y}} - 1 \]
              4. Applied rewrites48.8%

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

                \[\leadsto \color{blue}{\frac{x}{y}} \]
              6. Step-by-step derivation
                1. Applied rewrites47.9%

                  \[\leadsto \color{blue}{\frac{x}{y}} \]
              7. Recombined 2 regimes into one program.
              8. Final simplification70.5%

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

              Alternative 5: 51.3% 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;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(x, y)
              use fmin_fmax_functions
                  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. add-sqr-sqrtN/A

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

                  \[\leadsto \color{blue}{\sqrt{\frac{\left|x - y\right|}{\left|y\right|}} \cdot \sqrt{\frac{\left|x - y\right|}{\left|y\right|}}} \]
              4. Applied rewrites74.8%

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

                \[\leadsto \color{blue}{1} \]
              6. Step-by-step derivation
                1. Applied rewrites48.5%

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

                Reproduce

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