Average Error: 0.0 → 0.0
Time: 11.7s
Precision: binary64
\[\frac{-\left(f + n\right)}{f - n} \]
\[\begin{array}{l} t_0 := \frac{f + n}{n - f}\\ 0.5 \cdot t_0 + \log \left(\sqrt{e^{t_0}}\right) \end{array} \]
(FPCore (f n) :precision binary64 (/ (- (+ f n)) (- f n)))
(FPCore (f n)
 :precision binary64
 (let* ((t_0 (/ (+ f n) (- n f)))) (+ (* 0.5 t_0) (log (sqrt (exp t_0))))))
double code(double f, double n) {
	return -(f + n) / (f - n);
}
double code(double f, double n) {
	double t_0 = (f + n) / (n - f);
	return (0.5 * t_0) + log(sqrt(exp(t_0)));
}
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
    real(8) :: t_0
    t_0 = (f + n) / (n - f)
    code = (0.5d0 * t_0) + log(sqrt(exp(t_0)))
end function
public static double code(double f, double n) {
	return -(f + n) / (f - n);
}
public static double code(double f, double n) {
	double t_0 = (f + n) / (n - f);
	return (0.5 * t_0) + Math.log(Math.sqrt(Math.exp(t_0)));
}
def code(f, n):
	return -(f + n) / (f - n)
def code(f, n):
	t_0 = (f + n) / (n - f)
	return (0.5 * t_0) + math.log(math.sqrt(math.exp(t_0)))
function code(f, n)
	return Float64(Float64(-Float64(f + n)) / Float64(f - n))
end
function code(f, n)
	t_0 = Float64(Float64(f + n) / Float64(n - f))
	return Float64(Float64(0.5 * t_0) + log(sqrt(exp(t_0))))
end
function tmp = code(f, n)
	tmp = -(f + n) / (f - n);
end
function tmp = code(f, n)
	t_0 = (f + n) / (n - f);
	tmp = (0.5 * t_0) + log(sqrt(exp(t_0)));
end
code[f_, n_] := N[((-N[(f + n), $MachinePrecision]) / N[(f - n), $MachinePrecision]), $MachinePrecision]
code[f_, n_] := Block[{t$95$0 = N[(N[(f + n), $MachinePrecision] / N[(n - f), $MachinePrecision]), $MachinePrecision]}, N[(N[(0.5 * t$95$0), $MachinePrecision] + N[Log[N[Sqrt[N[Exp[t$95$0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\frac{-\left(f + n\right)}{f - n}
\begin{array}{l}
t_0 := \frac{f + n}{n - f}\\
0.5 \cdot t_0 + \log \left(\sqrt{e^{t_0}}\right)
\end{array}

Error

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}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{f + n}{n - f}\right)\right)} \]
  4. Applied egg-rr0.0

    \[\leadsto \color{blue}{\log \left(\sqrt{e^{\frac{f + n}{n - f}}}\right) + \log \left(\sqrt{e^{\frac{f + n}{n - f}}}\right)} \]
  5. Applied egg-rr0.0

    \[\leadsto \color{blue}{0.5 \cdot \frac{f + n}{n - f}} + \log \left(\sqrt{e^{\frac{f + n}{n - f}}}\right) \]
  6. Final simplification0.0

    \[\leadsto 0.5 \cdot \frac{f + n}{n - f} + \log \left(\sqrt{e^{\frac{f + n}{n - f}}}\right) \]

Reproduce

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