subtraction fraction

Percentage Accurate: 100.0% → 100.0%
Time: 5.1s
Alternatives: 8
Speedup: 1.1×

Specification

?
\[\begin{array}{l} \\ \frac{-\left(f + n\right)}{f - n} \end{array} \]
(FPCore (f n) :precision binary64 (/ (- (+ f n)) (- f n)))
double code(double f, double n) {
	return -(f + n) / (f - n);
}
real(8) function code(f, n)
    real(8), intent (in) :: f
    real(8), intent (in) :: n
    code = -(f + n) / (f - n)
end function
public static double code(double f, double n) {
	return -(f + n) / (f - n);
}
def code(f, n):
	return -(f + n) / (f - n)
function code(f, n)
	return Float64(Float64(-Float64(f + n)) / Float64(f - n))
end
function tmp = code(f, n)
	tmp = -(f + n) / (f - n);
end
code[f_, n_] := N[((-N[(f + n), $MachinePrecision]) / N[(f - n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{-\left(f + n\right)}{f - n}
\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 8 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(f + n\right)}{f - n} \end{array} \]
(FPCore (f n) :precision binary64 (/ (- (+ f n)) (- f n)))
double code(double f, double n) {
	return -(f + n) / (f - n);
}
real(8) function code(f, n)
    real(8), intent (in) :: f
    real(8), intent (in) :: n
    code = -(f + n) / (f - n)
end function
public static double code(double f, double n) {
	return -(f + n) / (f - n);
}
def code(f, n):
	return -(f + n) / (f - n)
function code(f, n)
	return Float64(Float64(-Float64(f + n)) / Float64(f - n))
end
function tmp = code(f, n)
	tmp = -(f + n) / (f - n);
end
code[f_, n_] := N[((-N[(f + n), $MachinePrecision]) / N[(f - n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{-\left(f + n\right)}{f - n}
\end{array}

Alternative 1: 100.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \frac{f + n}{n - f} \end{array} \]
(FPCore (f n) :precision binary64 (/ (+ f n) (- n f)))
double code(double f, double n) {
	return (f + n) / (n - f);
}
real(8) function code(f, n)
    real(8), intent (in) :: f
    real(8), intent (in) :: n
    code = (f + n) / (n - f)
end function
public static double code(double f, double n) {
	return (f + n) / (n - f);
}
def code(f, n):
	return (f + n) / (n - f)
function code(f, n)
	return Float64(Float64(f + n) / Float64(n - f))
end
function tmp = code(f, n)
	tmp = (f + n) / (n - f);
end
code[f_, n_] := N[(N[(f + n), $MachinePrecision] / N[(n - f), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{f + n}{n - f}
\end{array}
Derivation
  1. Initial program 100.0%

    \[\frac{-\left(f + n\right)}{f - n} \]
  2. Step-by-step derivation
    1. distribute-frac-negN/A

      \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
    2. distribute-neg-frac2N/A

      \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
    3. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
    4. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
    5. sub-negN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
    6. +-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
    7. distribute-neg-inN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
    8. unsub-negN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
    9. remove-double-negN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
    10. --lowering--.f64100.0%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 2: 75.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -4.8 \cdot 10^{-11}:\\ \;\;\;\;\frac{n}{n - f}\\ \mathbf{elif}\;n \leq 3.4 \cdot 10^{-69}:\\ \;\;\;\;-1 + \frac{n \cdot -2}{f}\\ \mathbf{else}:\\ \;\;\;\;\frac{f + n}{n}\\ \end{array} \end{array} \]
(FPCore (f n)
 :precision binary64
 (if (<= n -4.8e-11)
   (/ n (- n f))
   (if (<= n 3.4e-69) (+ -1.0 (/ (* n -2.0) f)) (/ (+ f n) n))))
double code(double f, double n) {
	double tmp;
	if (n <= -4.8e-11) {
		tmp = n / (n - f);
	} else if (n <= 3.4e-69) {
		tmp = -1.0 + ((n * -2.0) / f);
	} else {
		tmp = (f + n) / n;
	}
	return tmp;
}
real(8) function code(f, n)
    real(8), intent (in) :: f
    real(8), intent (in) :: n
    real(8) :: tmp
    if (n <= (-4.8d-11)) then
        tmp = n / (n - f)
    else if (n <= 3.4d-69) then
        tmp = (-1.0d0) + ((n * (-2.0d0)) / f)
    else
        tmp = (f + n) / n
    end if
    code = tmp
end function
public static double code(double f, double n) {
	double tmp;
	if (n <= -4.8e-11) {
		tmp = n / (n - f);
	} else if (n <= 3.4e-69) {
		tmp = -1.0 + ((n * -2.0) / f);
	} else {
		tmp = (f + n) / n;
	}
	return tmp;
}
def code(f, n):
	tmp = 0
	if n <= -4.8e-11:
		tmp = n / (n - f)
	elif n <= 3.4e-69:
		tmp = -1.0 + ((n * -2.0) / f)
	else:
		tmp = (f + n) / n
	return tmp
function code(f, n)
	tmp = 0.0
	if (n <= -4.8e-11)
		tmp = Float64(n / Float64(n - f));
	elseif (n <= 3.4e-69)
		tmp = Float64(-1.0 + Float64(Float64(n * -2.0) / f));
	else
		tmp = Float64(Float64(f + n) / n);
	end
	return tmp
end
function tmp_2 = code(f, n)
	tmp = 0.0;
	if (n <= -4.8e-11)
		tmp = n / (n - f);
	elseif (n <= 3.4e-69)
		tmp = -1.0 + ((n * -2.0) / f);
	else
		tmp = (f + n) / n;
	end
	tmp_2 = tmp;
end
code[f_, n_] := If[LessEqual[n, -4.8e-11], N[(n / N[(n - f), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.4e-69], N[(-1.0 + N[(N[(n * -2.0), $MachinePrecision] / f), $MachinePrecision]), $MachinePrecision], N[(N[(f + n), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.8 \cdot 10^{-11}:\\
\;\;\;\;\frac{n}{n - f}\\

\mathbf{elif}\;n \leq 3.4 \cdot 10^{-69}:\\
\;\;\;\;-1 + \frac{n \cdot -2}{f}\\

\mathbf{else}:\\
\;\;\;\;\frac{f + n}{n}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -4.8000000000000002e-11

    1. Initial program 100.0%

      \[\frac{-\left(f + n\right)}{f - n} \]
    2. Step-by-step derivation
      1. distribute-frac-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
      2. distribute-neg-frac2N/A

        \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
      7. distribute-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
      8. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
      9. remove-double-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
      10. --lowering--.f64100.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
    4. Add Preprocessing
    5. Taylor expanded in f around 0

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{n}, \mathsf{\_.f64}\left(n, f\right)\right) \]
    6. Step-by-step derivation
      1. Simplified85.7%

        \[\leadsto \frac{\color{blue}{n}}{n - f} \]

      if -4.8000000000000002e-11 < n < 3.40000000000000008e-69

      1. Initial program 100.0%

        \[\frac{-\left(f + n\right)}{f - n} \]
      2. Step-by-step derivation
        1. distribute-frac-negN/A

          \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
        2. distribute-neg-frac2N/A

          \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
        3. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
        4. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
        5. sub-negN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
        6. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
        7. distribute-neg-inN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
        8. unsub-negN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
        9. remove-double-negN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
        10. --lowering--.f64100.0%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
      3. Simplified100.0%

        \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
      4. Add Preprocessing
      5. Taylor expanded in f around inf

        \[\leadsto \color{blue}{-1 \cdot \frac{n}{f} - \left(1 + \frac{n}{f}\right)} \]
      6. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto -1 \cdot \frac{n}{f} - \left(\frac{n}{f} + \color{blue}{1}\right) \]
        2. associate--r+N/A

          \[\leadsto \left(-1 \cdot \frac{n}{f} - \frac{n}{f}\right) - \color{blue}{1} \]
        3. associate-*r/N/A

          \[\leadsto \left(\frac{-1 \cdot n}{f} - \frac{n}{f}\right) - 1 \]
        4. div-subN/A

          \[\leadsto \frac{-1 \cdot n - n}{f} - 1 \]
        5. sub-negN/A

          \[\leadsto \frac{-1 \cdot n - n}{f} + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)} \]
        6. metadata-evalN/A

          \[\leadsto \frac{-1 \cdot n - n}{f} + -1 \]
        7. +-commutativeN/A

          \[\leadsto -1 + \color{blue}{\frac{-1 \cdot n - n}{f}} \]
        8. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(-1, \color{blue}{\left(\frac{-1 \cdot n - n}{f}\right)}\right) \]
        9. /-lowering-/.f64N/A

          \[\leadsto \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\left(-1 \cdot n - n\right), \color{blue}{f}\right)\right) \]
        10. *-lft-identityN/A

          \[\leadsto \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\left(-1 \cdot n - 1 \cdot n\right), f\right)\right) \]
        11. distribute-rgt-out--N/A

          \[\leadsto \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\left(n \cdot \left(-1 - 1\right)\right), f\right)\right) \]
        12. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\left(n \cdot -2\right), f\right)\right) \]
        13. *-lowering-*.f6478.7%

          \[\leadsto \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(n, -2\right), f\right)\right) \]
      7. Simplified78.7%

        \[\leadsto \color{blue}{-1 + \frac{n \cdot -2}{f}} \]

      if 3.40000000000000008e-69 < n

      1. Initial program 100.0%

        \[\frac{-\left(f + n\right)}{f - n} \]
      2. Step-by-step derivation
        1. distribute-frac-negN/A

          \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
        2. distribute-neg-frac2N/A

          \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
        3. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
        4. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
        5. sub-negN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
        6. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
        7. distribute-neg-inN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
        8. unsub-negN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
        9. remove-double-negN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
        10. --lowering--.f64100.0%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
      3. Simplified100.0%

        \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
      4. Add Preprocessing
      5. Taylor expanded in n around inf

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \color{blue}{n}\right) \]
      6. Step-by-step derivation
        1. Simplified76.6%

          \[\leadsto \frac{f + n}{\color{blue}{n}} \]
      7. Recombined 3 regimes into one program.
      8. Add Preprocessing

      Alternative 3: 75.1% accurate, 0.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -1.2 \cdot 10^{-8}:\\ \;\;\;\;\frac{n}{n - f}\\ \mathbf{elif}\;n \leq 7 \cdot 10^{-52}:\\ \;\;\;\;\frac{f}{n - f}\\ \mathbf{else}:\\ \;\;\;\;\frac{f + n}{n}\\ \end{array} \end{array} \]
      (FPCore (f n)
       :precision binary64
       (if (<= n -1.2e-8)
         (/ n (- n f))
         (if (<= n 7e-52) (/ f (- n f)) (/ (+ f n) n))))
      double code(double f, double n) {
      	double tmp;
      	if (n <= -1.2e-8) {
      		tmp = n / (n - f);
      	} else if (n <= 7e-52) {
      		tmp = f / (n - f);
      	} else {
      		tmp = (f + n) / n;
      	}
      	return tmp;
      }
      
      real(8) function code(f, n)
          real(8), intent (in) :: f
          real(8), intent (in) :: n
          real(8) :: tmp
          if (n <= (-1.2d-8)) then
              tmp = n / (n - f)
          else if (n <= 7d-52) then
              tmp = f / (n - f)
          else
              tmp = (f + n) / n
          end if
          code = tmp
      end function
      
      public static double code(double f, double n) {
      	double tmp;
      	if (n <= -1.2e-8) {
      		tmp = n / (n - f);
      	} else if (n <= 7e-52) {
      		tmp = f / (n - f);
      	} else {
      		tmp = (f + n) / n;
      	}
      	return tmp;
      }
      
      def code(f, n):
      	tmp = 0
      	if n <= -1.2e-8:
      		tmp = n / (n - f)
      	elif n <= 7e-52:
      		tmp = f / (n - f)
      	else:
      		tmp = (f + n) / n
      	return tmp
      
      function code(f, n)
      	tmp = 0.0
      	if (n <= -1.2e-8)
      		tmp = Float64(n / Float64(n - f));
      	elseif (n <= 7e-52)
      		tmp = Float64(f / Float64(n - f));
      	else
      		tmp = Float64(Float64(f + n) / n);
      	end
      	return tmp
      end
      
      function tmp_2 = code(f, n)
      	tmp = 0.0;
      	if (n <= -1.2e-8)
      		tmp = n / (n - f);
      	elseif (n <= 7e-52)
      		tmp = f / (n - f);
      	else
      		tmp = (f + n) / n;
      	end
      	tmp_2 = tmp;
      end
      
      code[f_, n_] := If[LessEqual[n, -1.2e-8], N[(n / N[(n - f), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7e-52], N[(f / N[(n - f), $MachinePrecision]), $MachinePrecision], N[(N[(f + n), $MachinePrecision] / n), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;n \leq -1.2 \cdot 10^{-8}:\\
      \;\;\;\;\frac{n}{n - f}\\
      
      \mathbf{elif}\;n \leq 7 \cdot 10^{-52}:\\
      \;\;\;\;\frac{f}{n - f}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{f + n}{n}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if n < -1.19999999999999999e-8

        1. Initial program 100.0%

          \[\frac{-\left(f + n\right)}{f - n} \]
        2. Step-by-step derivation
          1. distribute-frac-negN/A

            \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
          2. distribute-neg-frac2N/A

            \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
          3. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
          4. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
          5. sub-negN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
          6. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
          7. distribute-neg-inN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
          8. unsub-negN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
          9. remove-double-negN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
          10. --lowering--.f64100.0%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
        3. Simplified100.0%

          \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
        4. Add Preprocessing
        5. Taylor expanded in f around 0

          \[\leadsto \mathsf{/.f64}\left(\color{blue}{n}, \mathsf{\_.f64}\left(n, f\right)\right) \]
        6. Step-by-step derivation
          1. Simplified85.7%

            \[\leadsto \frac{\color{blue}{n}}{n - f} \]

          if -1.19999999999999999e-8 < n < 7.0000000000000001e-52

          1. Initial program 100.0%

            \[\frac{-\left(f + n\right)}{f - n} \]
          2. Step-by-step derivation
            1. distribute-frac-negN/A

              \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
            2. distribute-neg-frac2N/A

              \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
            3. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
            4. +-lowering-+.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
            5. sub-negN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
            6. +-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
            7. distribute-neg-inN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
            8. unsub-negN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
            9. remove-double-negN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
            10. --lowering--.f64100.0%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
          3. Simplified100.0%

            \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
          4. Add Preprocessing
          5. Taylor expanded in f around inf

            \[\leadsto \mathsf{/.f64}\left(\color{blue}{f}, \mathsf{\_.f64}\left(n, f\right)\right) \]
          6. Step-by-step derivation
            1. Simplified78.2%

              \[\leadsto \frac{\color{blue}{f}}{n - f} \]

            if 7.0000000000000001e-52 < n

            1. Initial program 100.0%

              \[\frac{-\left(f + n\right)}{f - n} \]
            2. Step-by-step derivation
              1. distribute-frac-negN/A

                \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
              2. distribute-neg-frac2N/A

                \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
              3. /-lowering-/.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
              4. +-lowering-+.f64N/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
              5. sub-negN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
              6. +-commutativeN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
              7. distribute-neg-inN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
              8. unsub-negN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
              9. remove-double-negN/A

                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
              10. --lowering--.f64100.0%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
            3. Simplified100.0%

              \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
            4. Add Preprocessing
            5. Taylor expanded in n around inf

              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \color{blue}{n}\right) \]
            6. Step-by-step derivation
              1. Simplified77.3%

                \[\leadsto \frac{f + n}{\color{blue}{n}} \]
            7. Recombined 3 regimes into one program.
            8. Add Preprocessing

            Alternative 4: 75.2% accurate, 0.5× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{n}{n - f}\\ \mathbf{if}\;n \leq -9.5 \cdot 10^{-14}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq 1.2 \cdot 10^{-47}:\\ \;\;\;\;\frac{f}{n - f}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
            (FPCore (f n)
             :precision binary64
             (let* ((t_0 (/ n (- n f))))
               (if (<= n -9.5e-14) t_0 (if (<= n 1.2e-47) (/ f (- n f)) t_0))))
            double code(double f, double n) {
            	double t_0 = n / (n - f);
            	double tmp;
            	if (n <= -9.5e-14) {
            		tmp = t_0;
            	} else if (n <= 1.2e-47) {
            		tmp = f / (n - f);
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            real(8) function code(f, n)
                real(8), intent (in) :: f
                real(8), intent (in) :: n
                real(8) :: t_0
                real(8) :: tmp
                t_0 = n / (n - f)
                if (n <= (-9.5d-14)) then
                    tmp = t_0
                else if (n <= 1.2d-47) then
                    tmp = f / (n - f)
                else
                    tmp = t_0
                end if
                code = tmp
            end function
            
            public static double code(double f, double n) {
            	double t_0 = n / (n - f);
            	double tmp;
            	if (n <= -9.5e-14) {
            		tmp = t_0;
            	} else if (n <= 1.2e-47) {
            		tmp = f / (n - f);
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            def code(f, n):
            	t_0 = n / (n - f)
            	tmp = 0
            	if n <= -9.5e-14:
            		tmp = t_0
            	elif n <= 1.2e-47:
            		tmp = f / (n - f)
            	else:
            		tmp = t_0
            	return tmp
            
            function code(f, n)
            	t_0 = Float64(n / Float64(n - f))
            	tmp = 0.0
            	if (n <= -9.5e-14)
            		tmp = t_0;
            	elseif (n <= 1.2e-47)
            		tmp = Float64(f / Float64(n - f));
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            function tmp_2 = code(f, n)
            	t_0 = n / (n - f);
            	tmp = 0.0;
            	if (n <= -9.5e-14)
            		tmp = t_0;
            	elseif (n <= 1.2e-47)
            		tmp = f / (n - f);
            	else
            		tmp = t_0;
            	end
            	tmp_2 = tmp;
            end
            
            code[f_, n_] := Block[{t$95$0 = N[(n / N[(n - f), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -9.5e-14], t$95$0, If[LessEqual[n, 1.2e-47], N[(f / N[(n - f), $MachinePrecision]), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := \frac{n}{n - f}\\
            \mathbf{if}\;n \leq -9.5 \cdot 10^{-14}:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;n \leq 1.2 \cdot 10^{-47}:\\
            \;\;\;\;\frac{f}{n - f}\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if n < -9.4999999999999999e-14 or 1.2e-47 < n

              1. Initial program 100.0%

                \[\frac{-\left(f + n\right)}{f - n} \]
              2. Step-by-step derivation
                1. distribute-frac-negN/A

                  \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
                2. distribute-neg-frac2N/A

                  \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
                3. /-lowering-/.f64N/A

                  \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
                4. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
                5. sub-negN/A

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
                6. +-commutativeN/A

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
                7. distribute-neg-inN/A

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
                8. unsub-negN/A

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
                9. remove-double-negN/A

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
                10. --lowering--.f64100.0%

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
              3. Simplified100.0%

                \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
              4. Add Preprocessing
              5. Taylor expanded in f around 0

                \[\leadsto \mathsf{/.f64}\left(\color{blue}{n}, \mathsf{\_.f64}\left(n, f\right)\right) \]
              6. Step-by-step derivation
                1. Simplified81.1%

                  \[\leadsto \frac{\color{blue}{n}}{n - f} \]

                if -9.4999999999999999e-14 < n < 1.2e-47

                1. Initial program 100.0%

                  \[\frac{-\left(f + n\right)}{f - n} \]
                2. Step-by-step derivation
                  1. distribute-frac-negN/A

                    \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
                  2. distribute-neg-frac2N/A

                    \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
                  3. /-lowering-/.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
                  4. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
                  5. sub-negN/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
                  6. +-commutativeN/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
                  7. distribute-neg-inN/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
                  8. unsub-negN/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
                  9. remove-double-negN/A

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
                  10. --lowering--.f64100.0%

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
                3. Simplified100.0%

                  \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
                4. Add Preprocessing
                5. Taylor expanded in f around inf

                  \[\leadsto \mathsf{/.f64}\left(\color{blue}{f}, \mathsf{\_.f64}\left(n, f\right)\right) \]
                6. Step-by-step derivation
                  1. Simplified78.2%

                    \[\leadsto \frac{\color{blue}{f}}{n - f} \]
                7. Recombined 2 regimes into one program.
                8. Add Preprocessing

                Alternative 5: 74.6% accurate, 0.5× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -2.5 \cdot 10^{+14}:\\ \;\;\;\;1\\ \mathbf{elif}\;n \leq 10^{-50}:\\ \;\;\;\;\frac{f}{n - f}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
                (FPCore (f n)
                 :precision binary64
                 (if (<= n -2.5e+14) 1.0 (if (<= n 1e-50) (/ f (- n f)) 1.0)))
                double code(double f, double n) {
                	double tmp;
                	if (n <= -2.5e+14) {
                		tmp = 1.0;
                	} else if (n <= 1e-50) {
                		tmp = f / (n - f);
                	} else {
                		tmp = 1.0;
                	}
                	return tmp;
                }
                
                real(8) function code(f, n)
                    real(8), intent (in) :: f
                    real(8), intent (in) :: n
                    real(8) :: tmp
                    if (n <= (-2.5d+14)) then
                        tmp = 1.0d0
                    else if (n <= 1d-50) then
                        tmp = f / (n - f)
                    else
                        tmp = 1.0d0
                    end if
                    code = tmp
                end function
                
                public static double code(double f, double n) {
                	double tmp;
                	if (n <= -2.5e+14) {
                		tmp = 1.0;
                	} else if (n <= 1e-50) {
                		tmp = f / (n - f);
                	} else {
                		tmp = 1.0;
                	}
                	return tmp;
                }
                
                def code(f, n):
                	tmp = 0
                	if n <= -2.5e+14:
                		tmp = 1.0
                	elif n <= 1e-50:
                		tmp = f / (n - f)
                	else:
                		tmp = 1.0
                	return tmp
                
                function code(f, n)
                	tmp = 0.0
                	if (n <= -2.5e+14)
                		tmp = 1.0;
                	elseif (n <= 1e-50)
                		tmp = Float64(f / Float64(n - f));
                	else
                		tmp = 1.0;
                	end
                	return tmp
                end
                
                function tmp_2 = code(f, n)
                	tmp = 0.0;
                	if (n <= -2.5e+14)
                		tmp = 1.0;
                	elseif (n <= 1e-50)
                		tmp = f / (n - f);
                	else
                		tmp = 1.0;
                	end
                	tmp_2 = tmp;
                end
                
                code[f_, n_] := If[LessEqual[n, -2.5e+14], 1.0, If[LessEqual[n, 1e-50], N[(f / N[(n - f), $MachinePrecision]), $MachinePrecision], 1.0]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;n \leq -2.5 \cdot 10^{+14}:\\
                \;\;\;\;1\\
                
                \mathbf{elif}\;n \leq 10^{-50}:\\
                \;\;\;\;\frac{f}{n - f}\\
                
                \mathbf{else}:\\
                \;\;\;\;1\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if n < -2.5e14 or 1.00000000000000001e-50 < n

                  1. Initial program 100.0%

                    \[\frac{-\left(f + n\right)}{f - n} \]
                  2. Step-by-step derivation
                    1. distribute-frac-negN/A

                      \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
                    2. distribute-neg-frac2N/A

                      \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
                    3. /-lowering-/.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
                    4. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
                    5. sub-negN/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
                    6. +-commutativeN/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
                    7. distribute-neg-inN/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
                    8. unsub-negN/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
                    9. remove-double-negN/A

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
                    10. --lowering--.f64100.0%

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
                  3. Simplified100.0%

                    \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
                  4. Add Preprocessing
                  5. Taylor expanded in f around 0

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

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

                    if -2.5e14 < n < 1.00000000000000001e-50

                    1. Initial program 100.0%

                      \[\frac{-\left(f + n\right)}{f - n} \]
                    2. Step-by-step derivation
                      1. distribute-frac-negN/A

                        \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
                      2. distribute-neg-frac2N/A

                        \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
                      3. /-lowering-/.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
                      4. +-lowering-+.f64N/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
                      5. sub-negN/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
                      6. +-commutativeN/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
                      7. distribute-neg-inN/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
                      8. unsub-negN/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
                      9. remove-double-negN/A

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
                      10. --lowering--.f64100.0%

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
                    3. Simplified100.0%

                      \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
                    4. Add Preprocessing
                    5. Taylor expanded in f around inf

                      \[\leadsto \mathsf{/.f64}\left(\color{blue}{f}, \mathsf{\_.f64}\left(n, f\right)\right) \]
                    6. Step-by-step derivation
                      1. Simplified77.7%

                        \[\leadsto \frac{\color{blue}{f}}{n - f} \]
                    7. Recombined 2 regimes into one program.
                    8. Add Preprocessing

                    Alternative 6: 74.3% accurate, 0.5× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -3.7 \cdot 10^{-10}:\\ \;\;\;\;1\\ \mathbf{elif}\;n \leq 2.7 \cdot 10^{-74}:\\ \;\;\;\;-1 - \frac{n}{f}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
                    (FPCore (f n)
                     :precision binary64
                     (if (<= n -3.7e-10) 1.0 (if (<= n 2.7e-74) (- -1.0 (/ n f)) 1.0)))
                    double code(double f, double n) {
                    	double tmp;
                    	if (n <= -3.7e-10) {
                    		tmp = 1.0;
                    	} else if (n <= 2.7e-74) {
                    		tmp = -1.0 - (n / f);
                    	} else {
                    		tmp = 1.0;
                    	}
                    	return tmp;
                    }
                    
                    real(8) function code(f, n)
                        real(8), intent (in) :: f
                        real(8), intent (in) :: n
                        real(8) :: tmp
                        if (n <= (-3.7d-10)) then
                            tmp = 1.0d0
                        else if (n <= 2.7d-74) then
                            tmp = (-1.0d0) - (n / f)
                        else
                            tmp = 1.0d0
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double f, double n) {
                    	double tmp;
                    	if (n <= -3.7e-10) {
                    		tmp = 1.0;
                    	} else if (n <= 2.7e-74) {
                    		tmp = -1.0 - (n / f);
                    	} else {
                    		tmp = 1.0;
                    	}
                    	return tmp;
                    }
                    
                    def code(f, n):
                    	tmp = 0
                    	if n <= -3.7e-10:
                    		tmp = 1.0
                    	elif n <= 2.7e-74:
                    		tmp = -1.0 - (n / f)
                    	else:
                    		tmp = 1.0
                    	return tmp
                    
                    function code(f, n)
                    	tmp = 0.0
                    	if (n <= -3.7e-10)
                    		tmp = 1.0;
                    	elseif (n <= 2.7e-74)
                    		tmp = Float64(-1.0 - Float64(n / f));
                    	else
                    		tmp = 1.0;
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(f, n)
                    	tmp = 0.0;
                    	if (n <= -3.7e-10)
                    		tmp = 1.0;
                    	elseif (n <= 2.7e-74)
                    		tmp = -1.0 - (n / f);
                    	else
                    		tmp = 1.0;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[f_, n_] := If[LessEqual[n, -3.7e-10], 1.0, If[LessEqual[n, 2.7e-74], N[(-1.0 - N[(n / f), $MachinePrecision]), $MachinePrecision], 1.0]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;n \leq -3.7 \cdot 10^{-10}:\\
                    \;\;\;\;1\\
                    
                    \mathbf{elif}\;n \leq 2.7 \cdot 10^{-74}:\\
                    \;\;\;\;-1 - \frac{n}{f}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;1\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if n < -3.70000000000000015e-10 or 2.70000000000000018e-74 < n

                      1. Initial program 100.0%

                        \[\frac{-\left(f + n\right)}{f - n} \]
                      2. Step-by-step derivation
                        1. distribute-frac-negN/A

                          \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
                        2. distribute-neg-frac2N/A

                          \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
                        3. /-lowering-/.f64N/A

                          \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
                        4. +-lowering-+.f64N/A

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
                        5. sub-negN/A

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
                        6. +-commutativeN/A

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
                        7. distribute-neg-inN/A

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
                        8. unsub-negN/A

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
                        9. remove-double-negN/A

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
                        10. --lowering--.f64100.0%

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
                      3. Simplified100.0%

                        \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
                      4. Add Preprocessing
                      5. Taylor expanded in f around 0

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

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

                        if -3.70000000000000015e-10 < n < 2.70000000000000018e-74

                        1. Initial program 100.0%

                          \[\frac{-\left(f + n\right)}{f - n} \]
                        2. Step-by-step derivation
                          1. distribute-frac-negN/A

                            \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
                          2. distribute-neg-frac2N/A

                            \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
                          3. /-lowering-/.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
                          4. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
                          5. sub-negN/A

                            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
                          6. +-commutativeN/A

                            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
                          7. distribute-neg-inN/A

                            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
                          8. unsub-negN/A

                            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
                          9. remove-double-negN/A

                            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
                          10. --lowering--.f64100.0%

                            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
                        3. Simplified100.0%

                          \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
                        4. Add Preprocessing
                        5. Taylor expanded in f around inf

                          \[\leadsto \mathsf{/.f64}\left(\color{blue}{f}, \mathsf{\_.f64}\left(n, f\right)\right) \]
                        6. Step-by-step derivation
                          1. Simplified78.6%

                            \[\leadsto \frac{\color{blue}{f}}{n - f} \]
                          2. Taylor expanded in f around inf

                            \[\leadsto \color{blue}{-1 \cdot \frac{n}{f} - 1} \]
                          3. Step-by-step derivation
                            1. sub-negN/A

                              \[\leadsto -1 \cdot \frac{n}{f} + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)} \]
                            2. metadata-evalN/A

                              \[\leadsto -1 \cdot \frac{n}{f} + -1 \]
                            3. +-commutativeN/A

                              \[\leadsto -1 + \color{blue}{-1 \cdot \frac{n}{f}} \]
                            4. mul-1-negN/A

                              \[\leadsto -1 + \left(\mathsf{neg}\left(\frac{n}{f}\right)\right) \]
                            5. sub-negN/A

                              \[\leadsto -1 - \color{blue}{\frac{n}{f}} \]
                            6. --lowering--.f64N/A

                              \[\leadsto \mathsf{\_.f64}\left(-1, \color{blue}{\left(\frac{n}{f}\right)}\right) \]
                            7. /-lowering-/.f6478.5%

                              \[\leadsto \mathsf{\_.f64}\left(-1, \mathsf{/.f64}\left(n, \color{blue}{f}\right)\right) \]
                          4. Simplified78.5%

                            \[\leadsto \color{blue}{-1 - \frac{n}{f}} \]
                        7. Recombined 2 regimes into one program.
                        8. Add Preprocessing

                        Alternative 7: 73.9% accurate, 0.7× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -1.45 \cdot 10^{+14}:\\ \;\;\;\;1\\ \mathbf{elif}\;n \leq 3 \cdot 10^{-69}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
                        (FPCore (f n)
                         :precision binary64
                         (if (<= n -1.45e+14) 1.0 (if (<= n 3e-69) -1.0 1.0)))
                        double code(double f, double n) {
                        	double tmp;
                        	if (n <= -1.45e+14) {
                        		tmp = 1.0;
                        	} else if (n <= 3e-69) {
                        		tmp = -1.0;
                        	} else {
                        		tmp = 1.0;
                        	}
                        	return tmp;
                        }
                        
                        real(8) function code(f, n)
                            real(8), intent (in) :: f
                            real(8), intent (in) :: n
                            real(8) :: tmp
                            if (n <= (-1.45d+14)) then
                                tmp = 1.0d0
                            else if (n <= 3d-69) then
                                tmp = -1.0d0
                            else
                                tmp = 1.0d0
                            end if
                            code = tmp
                        end function
                        
                        public static double code(double f, double n) {
                        	double tmp;
                        	if (n <= -1.45e+14) {
                        		tmp = 1.0;
                        	} else if (n <= 3e-69) {
                        		tmp = -1.0;
                        	} else {
                        		tmp = 1.0;
                        	}
                        	return tmp;
                        }
                        
                        def code(f, n):
                        	tmp = 0
                        	if n <= -1.45e+14:
                        		tmp = 1.0
                        	elif n <= 3e-69:
                        		tmp = -1.0
                        	else:
                        		tmp = 1.0
                        	return tmp
                        
                        function code(f, n)
                        	tmp = 0.0
                        	if (n <= -1.45e+14)
                        		tmp = 1.0;
                        	elseif (n <= 3e-69)
                        		tmp = -1.0;
                        	else
                        		tmp = 1.0;
                        	end
                        	return tmp
                        end
                        
                        function tmp_2 = code(f, n)
                        	tmp = 0.0;
                        	if (n <= -1.45e+14)
                        		tmp = 1.0;
                        	elseif (n <= 3e-69)
                        		tmp = -1.0;
                        	else
                        		tmp = 1.0;
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        code[f_, n_] := If[LessEqual[n, -1.45e+14], 1.0, If[LessEqual[n, 3e-69], -1.0, 1.0]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;n \leq -1.45 \cdot 10^{+14}:\\
                        \;\;\;\;1\\
                        
                        \mathbf{elif}\;n \leq 3 \cdot 10^{-69}:\\
                        \;\;\;\;-1\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;1\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if n < -1.45e14 or 2.99999999999999989e-69 < n

                          1. Initial program 100.0%

                            \[\frac{-\left(f + n\right)}{f - n} \]
                          2. Step-by-step derivation
                            1. distribute-frac-negN/A

                              \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
                            2. distribute-neg-frac2N/A

                              \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
                            3. /-lowering-/.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
                            4. +-lowering-+.f64N/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
                            5. sub-negN/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
                            6. +-commutativeN/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
                            7. distribute-neg-inN/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
                            8. unsub-negN/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
                            9. remove-double-negN/A

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
                            10. --lowering--.f64100.0%

                              \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
                          3. Simplified100.0%

                            \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
                          4. Add Preprocessing
                          5. Taylor expanded in f around 0

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

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

                            if -1.45e14 < n < 2.99999999999999989e-69

                            1. Initial program 100.0%

                              \[\frac{-\left(f + n\right)}{f - n} \]
                            2. Step-by-step derivation
                              1. distribute-frac-negN/A

                                \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
                              2. distribute-neg-frac2N/A

                                \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
                              3. /-lowering-/.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
                              4. +-lowering-+.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
                              5. sub-negN/A

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
                              6. +-commutativeN/A

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
                              7. distribute-neg-inN/A

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
                              8. unsub-negN/A

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
                              9. remove-double-negN/A

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
                              10. --lowering--.f64100.0%

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
                            3. Simplified100.0%

                              \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
                            4. Add Preprocessing
                            5. Taylor expanded in f around inf

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

                                \[\leadsto \color{blue}{-1} \]
                            7. Recombined 2 regimes into one program.
                            8. Add Preprocessing

                            Alternative 8: 50.1% accurate, 8.0× speedup?

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

                              \[\frac{-\left(f + n\right)}{f - n} \]
                            2. Step-by-step derivation
                              1. distribute-frac-negN/A

                                \[\leadsto \mathsf{neg}\left(\frac{f + n}{f - n}\right) \]
                              2. distribute-neg-frac2N/A

                                \[\leadsto \frac{f + n}{\color{blue}{\mathsf{neg}\left(\left(f - n\right)\right)}} \]
                              3. /-lowering-/.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(\left(f + n\right), \color{blue}{\left(\mathsf{neg}\left(\left(f - n\right)\right)\right)}\right) \]
                              4. +-lowering-+.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\color{blue}{\left(f - n\right)}\right)\right)\right) \]
                              5. sub-negN/A

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(f + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right) \]
                              6. +-commutativeN/A

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(n\right)\right) + f\right)\right)\right)\right) \]
                              7. distribute-neg-inN/A

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) + \color{blue}{\left(\mathsf{neg}\left(f\right)\right)}\right)\right) \]
                              8. unsub-negN/A

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(n\right)\right)\right)\right) - \color{blue}{f}\right)\right) \]
                              9. remove-double-negN/A

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \left(n - f\right)\right) \]
                              10. --lowering--.f64100.0%

                                \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(f, n\right), \mathsf{\_.f64}\left(n, \color{blue}{f}\right)\right) \]
                            3. Simplified100.0%

                              \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
                            4. Add Preprocessing
                            5. Taylor expanded in f around inf

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

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

                              Reproduce

                              ?
                              herbie shell --seed 2024170 
                              (FPCore (f n)
                                :name "subtraction fraction"
                                :precision binary64
                                (/ (- (+ f n)) (- f n)))