summaryrefslogtreecommitdiff
path: root/mpz/bin_ui.c
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2000-06-04 00:49:45 +0200
committerKevin Ryde <user42@zip.com.au>2000-06-04 00:49:45 +0200
commit4a8b0b3c1ab478ad2517369af4339b9a07f4412a (patch)
treefb1dc4aee4a0269d46aafa09b92b772598702336 /mpz/bin_ui.c
parent0c6c4469bd6231ed0e8e6c5058426abaf6809e19 (diff)
downloadgmp-4a8b0b3c1ab478ad2517369af4339b9a07f4412a.tar.gz
Correct two formulas in comments.
Diffstat (limited to 'mpz/bin_ui.c')
-rw-r--r--mpz/bin_ui.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mpz/bin_ui.c b/mpz/bin_ui.c
index 4c1c571b6..216f7ef41 100644
--- a/mpz/bin_ui.c
+++ b/mpz/bin_ui.c
@@ -28,8 +28,8 @@ MA 02111-1307, USA. */
In fact consider calling mpz_bin_uiui() when the arguments fit, leaving
the code here only for big n.
- For the identity bin(n,k) = bin(-n+k-1,k) see Knuth vol 1 section 1.2.6
- part G. */
+ For the identity bin(n,k) = (-1)^k * bin(-n+k-1,k) see Knuth vol 1
+ section 1.2.6 part G. */
void
#if __STDC__
@@ -48,7 +48,7 @@ mpz_bin_ui (r, n, k)
if (mpz_sgn (n) < 0)
{
- /* bin(n,k) = bin(-n+k-1,k), and set ni = -n+k-1 - k = -n-1 */
+ /* bin(n,k) = (-1)^k * bin(-n+k-1,k), and set ni = -n+k-1 - k = -n-1 */
mpz_init (ni);
mpz_neg (ni, n);
mpz_sub_ui (ni, ni, 1L);