Changeset 1daf0d in git for factory/int_rat.cc
- Timestamp:
- Jul 7, 2012, 3:14:28 PM (12 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- 2616026dd2a4a8abd18adedb6f3d10e41ace78ea
- Parents:
- 800704ab0a248cdefe0f3e65b42f1c867ef4db6a
- git-author:
- Adrian Popescu <adi_popescum@yahoo.de>2012-07-07 15:14:28+02:00
- git-committer:
- Martin Lee <martinlee84@web.de>2013-02-18 22:09:31+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/int_rat.cc
r800704 r1daf0d 13 13 #include "gmpext.h" 14 14 15 static int intgcd( int a, intb )15 static long intgcd( long a, long b ) 16 16 { 17 17 if ( a < 0 ) a = -a; 18 18 if ( b < 0 ) b = -b; 19 19 20 intc;20 long c; 21 21 22 22 while ( b != 0 ) … … 29 29 } 30 30 31 static long intgcd( long a, long b )32 {33 if ( a < 0 ) a = -a;34 if ( b < 0 ) b = -b;35 36 long c;37 38 while ( b != 0 )39 {40 c = a % b;41 a = b;42 b = c;43 }44 return a;45 }46 47 31 48 32 InternalRational::InternalRational() … … 68 52 else 69 53 { 70 int g = intgcd( n,d );54 long g = intgcd( (long) n, (long) d ); 71 55 if ( d < 0 ) 72 56 { 73 mpz_init_set_si( _num, - n/ g );74 mpz_init_set_si( _den, - d/ g );57 mpz_init_set_si( _num, -((long)n) / g ); 58 mpz_init_set_si( _den, -((long)d) / g ); 75 59 } 76 60 else
Note: See TracChangeset
for help on using the changeset viewer.