subtraction fraction

Percentage Accurate: 100.0% → 100.0%
Time: 4.9s
Alternatives: 9
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 9 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.2% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;f \leq 4.6 \cdot 10^{+14}:\\
\;\;\;\;1 + 2 \cdot \frac{f}{n}\\

\mathbf{else}:\\
\;\;\;\;-1 + \frac{n \cdot -2}{f}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if f < -7.50000000000000041e-56

    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. Simplified80.7%

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

      if -7.50000000000000041e-56 < f < 4.6e14

      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 + 2 \cdot \frac{f}{n}} \]
      6. Step-by-step derivation
        1. *-lft-identityN/A

          \[\leadsto 1 + 2 \cdot \frac{1 \cdot f}{n} \]
        2. associate-*l/N/A

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

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

          \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(\left(2 \cdot \frac{1}{n}\right) \cdot f\right)}\right) \]
        5. associate-*l*N/A

          \[\leadsto \mathsf{+.f64}\left(1, \left(2 \cdot \color{blue}{\left(\frac{1}{n} \cdot f\right)}\right)\right) \]
        6. associate-*l/N/A

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

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

          \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(2, \color{blue}{\left(\frac{f}{n}\right)}\right)\right) \]
        9. /-lowering-/.f6480.5%

          \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(2, \mathsf{/.f64}\left(f, \color{blue}{n}\right)\right)\right) \]
      7. Simplified80.5%

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

      if 4.6e14 < f

      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-*.f6481.6%

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

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

    Alternative 3: 75.0% accurate, 0.5× speedup?

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

      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. Simplified80.7%

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

        if -3.7000000000000002e-56 < f < 2.3e14

        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. Simplified80.5%

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

          if 2.3e14 < f

          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-*.f6481.6%

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

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

        Alternative 4: 74.8% accurate, 0.5× speedup?

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

          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. Simplified80.7%

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

            if -1.54999999999999994e-56 < f < 2.1e14

            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. Simplified80.5%

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

              if 2.1e14 < f

              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. Simplified81.1%

                  \[\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-/.f6481.2%

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

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

              Alternative 5: 74.8% accurate, 0.5× speedup?

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

                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. Simplified80.7%

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

                  if -6.59999999999999967e-56 < f < 5.4e14

                  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. Simplified79.9%

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

                      \[\leadsto \color{blue}{1 + \frac{f}{n}} \]
                    3. Step-by-step derivation
                      1. +-lowering-+.f64N/A

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

                        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(f, \color{blue}{n}\right)\right) \]
                    4. Simplified79.9%

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

                    if 5.4e14 < f

                    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. Simplified81.1%

                        \[\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-/.f6481.2%

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

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

                    Alternative 6: 75.0% accurate, 0.5× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} t_0 := -1 - \frac{n}{f}\\ \mathbf{if}\;f \leq -2.05 \cdot 10^{-15}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;f \leq 1.35 \cdot 10^{+16}:\\ \;\;\;\;1 + \frac{f}{n}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                    (FPCore (f n)
                     :precision binary64
                     (let* ((t_0 (- -1.0 (/ n f))))
                       (if (<= f -2.05e-15) t_0 (if (<= f 1.35e+16) (+ 1.0 (/ f n)) t_0))))
                    double code(double f, double n) {
                    	double t_0 = -1.0 - (n / f);
                    	double tmp;
                    	if (f <= -2.05e-15) {
                    		tmp = t_0;
                    	} else if (f <= 1.35e+16) {
                    		tmp = 1.0 + (f / n);
                    	} 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 = (-1.0d0) - (n / f)
                        if (f <= (-2.05d-15)) then
                            tmp = t_0
                        else if (f <= 1.35d+16) then
                            tmp = 1.0d0 + (f / n)
                        else
                            tmp = t_0
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double f, double n) {
                    	double t_0 = -1.0 - (n / f);
                    	double tmp;
                    	if (f <= -2.05e-15) {
                    		tmp = t_0;
                    	} else if (f <= 1.35e+16) {
                    		tmp = 1.0 + (f / n);
                    	} else {
                    		tmp = t_0;
                    	}
                    	return tmp;
                    }
                    
                    def code(f, n):
                    	t_0 = -1.0 - (n / f)
                    	tmp = 0
                    	if f <= -2.05e-15:
                    		tmp = t_0
                    	elif f <= 1.35e+16:
                    		tmp = 1.0 + (f / n)
                    	else:
                    		tmp = t_0
                    	return tmp
                    
                    function code(f, n)
                    	t_0 = Float64(-1.0 - Float64(n / f))
                    	tmp = 0.0
                    	if (f <= -2.05e-15)
                    		tmp = t_0;
                    	elseif (f <= 1.35e+16)
                    		tmp = Float64(1.0 + Float64(f / n));
                    	else
                    		tmp = t_0;
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(f, n)
                    	t_0 = -1.0 - (n / f);
                    	tmp = 0.0;
                    	if (f <= -2.05e-15)
                    		tmp = t_0;
                    	elseif (f <= 1.35e+16)
                    		tmp = 1.0 + (f / n);
                    	else
                    		tmp = t_0;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[f_, n_] := Block[{t$95$0 = N[(-1.0 - N[(n / f), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[f, -2.05e-15], t$95$0, If[LessEqual[f, 1.35e+16], N[(1.0 + N[(f / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    t_0 := -1 - \frac{n}{f}\\
                    \mathbf{if}\;f \leq -2.05 \cdot 10^{-15}:\\
                    \;\;\;\;t\_0\\
                    
                    \mathbf{elif}\;f \leq 1.35 \cdot 10^{+16}:\\
                    \;\;\;\;1 + \frac{f}{n}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;t\_0\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if f < -2.05000000000000018e-15 or 1.35e16 < f

                      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. Simplified82.5%

                          \[\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-/.f6482.2%

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

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

                        if -2.05000000000000018e-15 < f < 1.35e16

                        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.9%

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

                            \[\leadsto \color{blue}{1 + \frac{f}{n}} \]
                          3. Step-by-step derivation
                            1. +-lowering-+.f64N/A

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

                              \[\leadsto \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(f, \color{blue}{n}\right)\right) \]
                          4. Simplified77.9%

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

                        Alternative 7: 74.6% accurate, 0.5× speedup?

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

                          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. Simplified81.4%

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

                            if -1.11999999999999995e-29 < f < 2e14

                            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. Simplified78.3%

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

                                \[\leadsto \color{blue}{1 + \frac{f}{n}} \]
                              3. Step-by-step derivation
                                1. +-lowering-+.f64N/A

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

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

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

                            Alternative 8: 74.5% accurate, 0.7× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;f \leq -2.9 \cdot 10^{-15}:\\ \;\;\;\;-1\\ \mathbf{elif}\;f \leq 1.95 \cdot 10^{+14}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
                            (FPCore (f n)
                             :precision binary64
                             (if (<= f -2.9e-15) -1.0 (if (<= f 1.95e+14) 1.0 -1.0)))
                            double code(double f, double n) {
                            	double tmp;
                            	if (f <= -2.9e-15) {
                            		tmp = -1.0;
                            	} else if (f <= 1.95e+14) {
                            		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 (f <= (-2.9d-15)) then
                                    tmp = -1.0d0
                                else if (f <= 1.95d+14) 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 (f <= -2.9e-15) {
                            		tmp = -1.0;
                            	} else if (f <= 1.95e+14) {
                            		tmp = 1.0;
                            	} else {
                            		tmp = -1.0;
                            	}
                            	return tmp;
                            }
                            
                            def code(f, n):
                            	tmp = 0
                            	if f <= -2.9e-15:
                            		tmp = -1.0
                            	elif f <= 1.95e+14:
                            		tmp = 1.0
                            	else:
                            		tmp = -1.0
                            	return tmp
                            
                            function code(f, n)
                            	tmp = 0.0
                            	if (f <= -2.9e-15)
                            		tmp = -1.0;
                            	elseif (f <= 1.95e+14)
                            		tmp = 1.0;
                            	else
                            		tmp = -1.0;
                            	end
                            	return tmp
                            end
                            
                            function tmp_2 = code(f, n)
                            	tmp = 0.0;
                            	if (f <= -2.9e-15)
                            		tmp = -1.0;
                            	elseif (f <= 1.95e+14)
                            		tmp = 1.0;
                            	else
                            		tmp = -1.0;
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            code[f_, n_] := If[LessEqual[f, -2.9e-15], -1.0, If[LessEqual[f, 1.95e+14], 1.0, -1.0]]
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            \mathbf{if}\;f \leq -2.9 \cdot 10^{-15}:\\
                            \;\;\;\;-1\\
                            
                            \mathbf{elif}\;f \leq 1.95 \cdot 10^{+14}:\\
                            \;\;\;\;1\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;-1\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if f < -2.90000000000000019e-15 or 1.95e14 < f

                              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. Simplified81.9%

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

                                if -2.90000000000000019e-15 < f < 1.95e14

                                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. Simplified77.7%

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

                                Alternative 9: 49.6% 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. Simplified54.9%

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

                                  Reproduce

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