Average Error: 0.0 → 0.0
Time: 2.3s
Precision: binary64
\[\frac{-\left(f + n\right)}{f - n} \]
\[\frac{\left(-f\right) - n}{f - n} \]
(FPCore (f n) :precision binary64 (/ (- (+ f n)) (- f n)))
(FPCore (f n) :precision binary64 (/ (- (- f) n) (- f n)))
double code(double f, double n) {
	return -(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
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);
}
public static double code(double f, double n) {
	return (-f - n) / (f - n);
}
def code(f, 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 code(f, n)
	return Float64(Float64(Float64(-f) - n) / Float64(f - n))
end
function tmp = code(f, n)
	tmp = -(f + n) / (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]
code[f_, n_] := N[(N[((-f) - n), $MachinePrecision] / N[(f - n), $MachinePrecision]), $MachinePrecision]
\frac{-\left(f + n\right)}{f - n}
\frac{\left(-f\right) - n}{f - n}

Error

Bits error versus f

Bits error versus n

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[\frac{-\left(f + n\right)}{f - n} \]
  2. Simplified0.0

    \[\leadsto \color{blue}{\frac{f + n}{n - f}} \]
  3. Applied egg-rr0.0

    \[\leadsto \color{blue}{-\frac{f + n}{-\left(n - f\right)}} \]
  4. Final simplification0.0

    \[\leadsto \frac{\left(-f\right) - n}{f - n} \]

Reproduce

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