
(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:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(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}
Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
(FPCore (f n) :precision binary64 (if (<= n -59.0) (+ 1.0 (/ f n)) (if (<= n 1.08e-11) (+ (* -2.0 (/ n f)) -1.0) (+ 1.0 (* (/ f n) 2.0)))))
double code(double f, double n) {
double tmp;
if (n <= -59.0) {
tmp = 1.0 + (f / n);
} else if (n <= 1.08e-11) {
tmp = (-2.0 * (n / f)) + -1.0;
} else {
tmp = 1.0 + ((f / n) * 2.0);
}
return tmp;
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-59.0d0)) then
tmp = 1.0d0 + (f / n)
else if (n <= 1.08d-11) then
tmp = ((-2.0d0) * (n / f)) + (-1.0d0)
else
tmp = 1.0d0 + ((f / n) * 2.0d0)
end if
code = tmp
end function
public static double code(double f, double n) {
double tmp;
if (n <= -59.0) {
tmp = 1.0 + (f / n);
} else if (n <= 1.08e-11) {
tmp = (-2.0 * (n / f)) + -1.0;
} else {
tmp = 1.0 + ((f / n) * 2.0);
}
return tmp;
}
def code(f, n): tmp = 0 if n <= -59.0: tmp = 1.0 + (f / n) elif n <= 1.08e-11: tmp = (-2.0 * (n / f)) + -1.0 else: tmp = 1.0 + ((f / n) * 2.0) return tmp
function code(f, n) tmp = 0.0 if (n <= -59.0) tmp = Float64(1.0 + Float64(f / n)); elseif (n <= 1.08e-11) tmp = Float64(Float64(-2.0 * Float64(n / f)) + -1.0); else tmp = Float64(1.0 + Float64(Float64(f / n) * 2.0)); end return tmp end
function tmp_2 = code(f, n) tmp = 0.0; if (n <= -59.0) tmp = 1.0 + (f / n); elseif (n <= 1.08e-11) tmp = (-2.0 * (n / f)) + -1.0; else tmp = 1.0 + ((f / n) * 2.0); end tmp_2 = tmp; end
code[f_, n_] := If[LessEqual[n, -59.0], N[(1.0 + N[(f / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.08e-11], N[(N[(-2.0 * N[(n / f), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(1.0 + N[(N[(f / n), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -59:\\
\;\;\;\;1 + \frac{f}{n}\\
\mathbf{elif}\;n \leq 1.08 \cdot 10^{-11}:\\
\;\;\;\;-2 \cdot \frac{n}{f} + -1\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{f}{n} \cdot 2\\
\end{array}
\end{array}
if n < -59Initial program 100.0%
distribute-frac-neg100.0%
distribute-neg-frac2100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in f around 0 75.0%
Taylor expanded in n around inf 75.1%
if -59 < n < 1.07999999999999992e-11Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in n around 0 83.4%
if 1.07999999999999992e-11 < n Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in f around 0 82.0%
Final simplification81.3%
(FPCore (f n) :precision binary64 (if (<= n -59.0) (+ 1.0 (/ f n)) (if (<= n 1.18e-7) (/ f (- n f)) (+ 1.0 (* (/ f n) 2.0)))))
double code(double f, double n) {
double tmp;
if (n <= -59.0) {
tmp = 1.0 + (f / n);
} else if (n <= 1.18e-7) {
tmp = f / (n - f);
} else {
tmp = 1.0 + ((f / n) * 2.0);
}
return tmp;
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-59.0d0)) then
tmp = 1.0d0 + (f / n)
else if (n <= 1.18d-7) then
tmp = f / (n - f)
else
tmp = 1.0d0 + ((f / n) * 2.0d0)
end if
code = tmp
end function
public static double code(double f, double n) {
double tmp;
if (n <= -59.0) {
tmp = 1.0 + (f / n);
} else if (n <= 1.18e-7) {
tmp = f / (n - f);
} else {
tmp = 1.0 + ((f / n) * 2.0);
}
return tmp;
}
def code(f, n): tmp = 0 if n <= -59.0: tmp = 1.0 + (f / n) elif n <= 1.18e-7: tmp = f / (n - f) else: tmp = 1.0 + ((f / n) * 2.0) return tmp
function code(f, n) tmp = 0.0 if (n <= -59.0) tmp = Float64(1.0 + Float64(f / n)); elseif (n <= 1.18e-7) tmp = Float64(f / Float64(n - f)); else tmp = Float64(1.0 + Float64(Float64(f / n) * 2.0)); end return tmp end
function tmp_2 = code(f, n) tmp = 0.0; if (n <= -59.0) tmp = 1.0 + (f / n); elseif (n <= 1.18e-7) tmp = f / (n - f); else tmp = 1.0 + ((f / n) * 2.0); end tmp_2 = tmp; end
code[f_, n_] := If[LessEqual[n, -59.0], N[(1.0 + N[(f / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.18e-7], N[(f / N[(n - f), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(f / n), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -59:\\
\;\;\;\;1 + \frac{f}{n}\\
\mathbf{elif}\;n \leq 1.18 \cdot 10^{-7}:\\
\;\;\;\;\frac{f}{n - f}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{f}{n} \cdot 2\\
\end{array}
\end{array}
if n < -59Initial program 100.0%
distribute-frac-neg100.0%
distribute-neg-frac2100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in f around 0 75.0%
Taylor expanded in n around inf 75.1%
if -59 < n < 1.18e-7Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in f around inf 82.4%
if 1.18e-7 < n Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in f around 0 82.8%
Final simplification81.1%
(FPCore (f n) :precision binary64 (if (or (<= n -20.5) (not (<= n 1.76e-7))) (+ 1.0 (/ f n)) (/ f (- n f))))
double code(double f, double n) {
double tmp;
if ((n <= -20.5) || !(n <= 1.76e-7)) {
tmp = 1.0 + (f / n);
} else {
tmp = f / (n - f);
}
return tmp;
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-20.5d0)) .or. (.not. (n <= 1.76d-7))) then
tmp = 1.0d0 + (f / n)
else
tmp = f / (n - f)
end if
code = tmp
end function
public static double code(double f, double n) {
double tmp;
if ((n <= -20.5) || !(n <= 1.76e-7)) {
tmp = 1.0 + (f / n);
} else {
tmp = f / (n - f);
}
return tmp;
}
def code(f, n): tmp = 0 if (n <= -20.5) or not (n <= 1.76e-7): tmp = 1.0 + (f / n) else: tmp = f / (n - f) return tmp
function code(f, n) tmp = 0.0 if ((n <= -20.5) || !(n <= 1.76e-7)) tmp = Float64(1.0 + Float64(f / n)); else tmp = Float64(f / Float64(n - f)); end return tmp end
function tmp_2 = code(f, n) tmp = 0.0; if ((n <= -20.5) || ~((n <= 1.76e-7))) tmp = 1.0 + (f / n); else tmp = f / (n - f); end tmp_2 = tmp; end
code[f_, n_] := If[Or[LessEqual[n, -20.5], N[Not[LessEqual[n, 1.76e-7]], $MachinePrecision]], N[(1.0 + N[(f / n), $MachinePrecision]), $MachinePrecision], N[(f / N[(n - f), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -20.5 \lor \neg \left(n \leq 1.76 \cdot 10^{-7}\right):\\
\;\;\;\;1 + \frac{f}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{f}{n - f}\\
\end{array}
\end{array}
if n < -20.5 or 1.7599999999999999e-7 < n Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in f around 0 78.4%
Taylor expanded in n around inf 78.2%
if -20.5 < n < 1.7599999999999999e-7Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in f around inf 82.4%
Final simplification80.2%
(FPCore (f n) :precision binary64 (if (or (<= n -76.0) (not (<= n 7e-12))) (+ 1.0 (/ f n)) (- -1.0 (/ n f))))
double code(double f, double n) {
double tmp;
if ((n <= -76.0) || !(n <= 7e-12)) {
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 ((n <= (-76.0d0)) .or. (.not. (n <= 7d-12))) 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 ((n <= -76.0) || !(n <= 7e-12)) {
tmp = 1.0 + (f / n);
} else {
tmp = -1.0 - (n / f);
}
return tmp;
}
def code(f, n): tmp = 0 if (n <= -76.0) or not (n <= 7e-12): tmp = 1.0 + (f / n) else: tmp = -1.0 - (n / f) return tmp
function code(f, n) tmp = 0.0 if ((n <= -76.0) || !(n <= 7e-12)) 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 ((n <= -76.0) || ~((n <= 7e-12))) tmp = 1.0 + (f / n); else tmp = -1.0 - (n / f); end tmp_2 = tmp; end
code[f_, n_] := If[Or[LessEqual[n, -76.0], N[Not[LessEqual[n, 7e-12]], $MachinePrecision]], N[(1.0 + N[(f / n), $MachinePrecision]), $MachinePrecision], N[(-1.0 - N[(n / f), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -76 \lor \neg \left(n \leq 7 \cdot 10^{-12}\right):\\
\;\;\;\;1 + \frac{f}{n}\\
\mathbf{else}:\\
\;\;\;\;-1 - \frac{n}{f}\\
\end{array}
\end{array}
if n < -76 or 7.0000000000000001e-12 < n Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in f around 0 78.0%
Taylor expanded in n around inf 77.8%
if -76 < n < 7.0000000000000001e-12Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in f around inf 82.8%
Taylor expanded in f around inf 82.8%
neg-mul-182.8%
neg-sub082.8%
associate--r+82.8%
+-commutative82.8%
associate--r+82.8%
metadata-eval82.8%
Simplified82.8%
Final simplification80.2%
(FPCore (f n) :precision binary64 (if (or (<= n -13.0) (not (<= n 1.5e-7))) (+ 1.0 (/ f n)) -1.0))
double code(double f, double n) {
double tmp;
if ((n <= -13.0) || !(n <= 1.5e-7)) {
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 ((n <= (-13.0d0)) .or. (.not. (n <= 1.5d-7))) 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 ((n <= -13.0) || !(n <= 1.5e-7)) {
tmp = 1.0 + (f / n);
} else {
tmp = -1.0;
}
return tmp;
}
def code(f, n): tmp = 0 if (n <= -13.0) or not (n <= 1.5e-7): tmp = 1.0 + (f / n) else: tmp = -1.0 return tmp
function code(f, n) tmp = 0.0 if ((n <= -13.0) || !(n <= 1.5e-7)) 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 ((n <= -13.0) || ~((n <= 1.5e-7))) tmp = 1.0 + (f / n); else tmp = -1.0; end tmp_2 = tmp; end
code[f_, n_] := If[Or[LessEqual[n, -13.0], N[Not[LessEqual[n, 1.5e-7]], $MachinePrecision]], N[(1.0 + N[(f / n), $MachinePrecision]), $MachinePrecision], -1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -13 \lor \neg \left(n \leq 1.5 \cdot 10^{-7}\right):\\
\;\;\;\;1 + \frac{f}{n}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if n < -13 or 1.4999999999999999e-7 < n Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in f around 0 78.4%
Taylor expanded in n around inf 78.2%
if -13 < n < 1.4999999999999999e-7Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in f around inf 81.8%
Final simplification80.0%
(FPCore (f n) :precision binary64 (if (<= n -50.0) (+ 1.0 (/ f n)) (if (<= n 5.8e-12) (/ f (- n f)) (/ n (- n f)))))
double code(double f, double n) {
double tmp;
if (n <= -50.0) {
tmp = 1.0 + (f / n);
} else if (n <= 5.8e-12) {
tmp = f / (n - f);
} else {
tmp = n / (n - f);
}
return tmp;
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-50.0d0)) then
tmp = 1.0d0 + (f / n)
else if (n <= 5.8d-12) then
tmp = f / (n - f)
else
tmp = n / (n - f)
end if
code = tmp
end function
public static double code(double f, double n) {
double tmp;
if (n <= -50.0) {
tmp = 1.0 + (f / n);
} else if (n <= 5.8e-12) {
tmp = f / (n - f);
} else {
tmp = n / (n - f);
}
return tmp;
}
def code(f, n): tmp = 0 if n <= -50.0: tmp = 1.0 + (f / n) elif n <= 5.8e-12: tmp = f / (n - f) else: tmp = n / (n - f) return tmp
function code(f, n) tmp = 0.0 if (n <= -50.0) tmp = Float64(1.0 + Float64(f / n)); elseif (n <= 5.8e-12) tmp = Float64(f / Float64(n - f)); else tmp = Float64(n / Float64(n - f)); end return tmp end
function tmp_2 = code(f, n) tmp = 0.0; if (n <= -50.0) tmp = 1.0 + (f / n); elseif (n <= 5.8e-12) tmp = f / (n - f); else tmp = n / (n - f); end tmp_2 = tmp; end
code[f_, n_] := If[LessEqual[n, -50.0], N[(1.0 + N[(f / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.8e-12], N[(f / N[(n - f), $MachinePrecision]), $MachinePrecision], N[(n / N[(n - f), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -50:\\
\;\;\;\;1 + \frac{f}{n}\\
\mathbf{elif}\;n \leq 5.8 \cdot 10^{-12}:\\
\;\;\;\;\frac{f}{n - f}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{n - f}\\
\end{array}
\end{array}
if n < -50Initial program 100.0%
distribute-frac-neg100.0%
distribute-neg-frac2100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in f around 0 75.0%
Taylor expanded in n around inf 75.1%
if -50 < n < 5.8000000000000003e-12Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in f around inf 82.8%
if 5.8000000000000003e-12 < n Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in f around 0 79.8%
(FPCore (f n) :precision binary64 (if (<= n -20.5) 1.0 (if (<= n 1.4e-11) -1.0 1.0)))
double code(double f, double n) {
double tmp;
if (n <= -20.5) {
tmp = 1.0;
} else if (n <= 1.4e-11) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(f, n)
real(8), intent (in) :: f
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-20.5d0)) then
tmp = 1.0d0
else if (n <= 1.4d-11) then
tmp = -1.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double f, double n) {
double tmp;
if (n <= -20.5) {
tmp = 1.0;
} else if (n <= 1.4e-11) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(f, n): tmp = 0 if n <= -20.5: tmp = 1.0 elif n <= 1.4e-11: tmp = -1.0 else: tmp = 1.0 return tmp
function code(f, n) tmp = 0.0 if (n <= -20.5) tmp = 1.0; elseif (n <= 1.4e-11) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(f, n) tmp = 0.0; if (n <= -20.5) tmp = 1.0; elseif (n <= 1.4e-11) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[f_, n_] := If[LessEqual[n, -20.5], 1.0, If[LessEqual[n, 1.4e-11], -1.0, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -20.5:\\
\;\;\;\;1\\
\mathbf{elif}\;n \leq 1.4 \cdot 10^{-11}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if n < -20.5 or 1.4e-11 < n Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in f around 0 77.2%
if -20.5 < n < 1.4e-11Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in f around inf 82.3%
(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}
Initial program 99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in f around inf 51.0%
herbie shell --seed 2024172
(FPCore (f n)
:name "subtraction fraction"
:precision binary64
(/ (- (+ f n)) (- f n)))