Changeset e1634d in git


Ignore:
Timestamp:
Jul 3, 2009, 4:38:34 PM (15 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
52696b20f5e20bdcd5f1882fed6a5d8305356070
Parents:
6ea941e4848eccc89aab2b61d4293cb289fe287c
Message:
*hannes: syntax


git-svn-id: file:///usr/local/Singular/svn/trunk@11941 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/rmodulo2m.cc

    r6ea941 re1634d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: rmodulo2m.cc,v 1.25 2009-07-03 13:14:10 seelisch Exp $ */
     4/* $Id: rmodulo2m.cc,v 1.26 2009-07-03 14:38:34 Singular Exp $ */
    55/*
    66* ABSTRACT: numbers modulo 2^m
     
    370370  */
    371371  NATNUMBER g = 1;
    372   NATNUMBER b_div = b;
     372  NATNUMBER b_div = (NATNUMBER)b;
    373373  if (b_div < 0) b_div = - b_div; // b_div now represents |b|
    374374  NATNUMBER r = 0;
  • kernel/rmodulon.cc

    r6ea941 re1634d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: rmodulon.cc,v 1.35 2009-07-03 13:14:10 seelisch Exp $ */
     4/* $Id: rmodulon.cc,v 1.36 2009-07-03 14:38:34 Singular Exp $ */
    55/*
    66* ABSTRACT: numbers modulo n
     
    338338          fulfills (1) and (2), i.e. r := t is the correct result. Hence
    339339          in this third case, r is the remainder of division of a by g in Z.
     340     Remark: according to mpz_mod: a,b are always non-negative
    340341  */
    341342  int_number g = (int_number) omAllocBin(gmp_nrn_bin);
    342   int_number b_abs = (int_number) omAllocBin(gmp_nrn_bin);
    343343  int_number r = (int_number) omAllocBin(gmp_nrn_bin);
    344344  mpz_init(g);
    345   mpz_init_set(b_abs,(int_number)b);
    346345  mpz_init_set_si(r,(long)0);
    347   if (mpz_isNeg(b_abs)) mpz_neg(b_abs, b_abs); // b_abs now represents |b|
    348   mpz_gcd(g, (int_number) nrnModul, b_abs); // g is now as above
     346  mpz_gcd(g, (int_number) nrnModul, (int_number)b); // g is now as above
    349347  if (mpz_cmp_si(g, (long)1) != 0) mpz_mod(r, (int_number)a, g); // the case g <> 1
    350348  mpz_clear(g);
    351   mpz_clear(b_abs);
    352349  omFreeBin(g, gmp_nrn_bin);
    353   omFreeBin(b_abs, gmp_nrn_bin);
    354350  return (number)r;
    355351}
Note: See TracChangeset for help on using the changeset viewer.