| Alternative 1 | |
|---|---|
| Error | 16.8 |
| Cost | 712 |
\[\begin{array}{l}
t_0 := 2 \cdot \frac{f}{n} + 1\\
\mathbf{if}\;n \leq -6.3 \cdot 10^{-68}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 3.3 \cdot 10^{+72}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
(FPCore (f n) :precision binary64 (/ (- (+ f n)) (- f n)))
(FPCore (f n) :precision binary64 (log (exp (/ (+ f n) (- n f)))))
double code(double f, double n) {
return -(f + n) / (f - n);
}
double code(double f, double n) {
return log(exp(((f + n) / (n - f))));
}
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 = log(exp(((f + n) / (n - f))))
end function
public static double code(double f, double n) {
return -(f + n) / (f - n);
}
public static double code(double f, double n) {
return Math.log(Math.exp(((f + n) / (n - f))));
}
def code(f, n): return -(f + n) / (f - n)
def code(f, n): return math.log(math.exp(((f + n) / (n - f))))
function code(f, n) return Float64(Float64(-Float64(f + n)) / Float64(f - n)) end
function code(f, n) return log(exp(Float64(Float64(f + n) / Float64(n - f)))) end
function tmp = code(f, n) tmp = -(f + n) / (f - n); end
function tmp = code(f, n) tmp = log(exp(((f + n) / (n - f)))); end
code[f_, n_] := N[((-N[(f + n), $MachinePrecision]) / N[(f - n), $MachinePrecision]), $MachinePrecision]
code[f_, n_] := N[Log[N[Exp[N[(N[(f + n), $MachinePrecision] / N[(n - f), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\frac{-\left(f + n\right)}{f - n}
\log \left(e^{\frac{f + n}{n - f}}\right)
Results
Initial program 0.0
Simplified0.0
Applied egg-rr0.0
Final simplification0.0
| Alternative 1 | |
|---|---|
| Error | 16.8 |
| Cost | 712 |
| Alternative 2 | |
|---|---|
| Error | 0.0 |
| Cost | 704 |
| Alternative 3 | |
|---|---|
| Error | 0.0 |
| Cost | 448 |
| Alternative 4 | |
|---|---|
| Error | 17.2 |
| Cost | 328 |
| Alternative 5 | |
|---|---|
| Error | 31.9 |
| Cost | 64 |
herbie shell --seed 2022338
(FPCore (f n)
:name "subtraction fraction"
:precision binary64
(/ (- (+ f n)) (- f n)))