Changeset 2b44a1 in git for factory/int_int.cc
- Timestamp:
- Dec 4, 2007, 4:24:53 PM (16 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 76cee4ecf4f4ebb3a8aa88178fdda32dc26fe987
- Parents:
- 01c4861ef358d95157809da52c75de1595678444
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/int_int.cc
r01c486 r2b44a1 1 1 /* emacs edit mode for this file is -*- C++ -*- */ 2 /* $Id: int_int.cc,v 1.1 8 2006-05-15 09:03:06Singular Exp $ */2 /* $Id: int_int.cc,v 1.19 2007-12-04 15:24:53 Singular Exp $ */ 3 3 4 4 #include <config.h> … … 384 384 385 385 // simply return 1 if we are calculating over the rationals 386 if ( cf_glob_switches.isOn( SW_RATIONAL ) ) { 386 if ( cf_glob_switches.isOn( SW_RATIONAL ) ) 387 { 387 388 a = 1/CanonicalForm( copyObject() ); b = 0; 388 389 return int2imm( 1 ); … … 399 400 400 401 // check and modify signs 401 if ( mpz_sgn( &result ) < 0 ) { 402 if ( mpz_sgn( &result ) < 0 ) 403 { 402 404 mpz_neg( &result, &result ); 403 405 mpz_neg( &aMPI, &aMPI ); … … 406 408 407 409 // postconditioning of result 408 if ( mpz_is_imm( &aMPI ) ) { 410 if ( mpz_is_imm( &aMPI ) ) 411 { 409 412 a = CanonicalForm( int2imm( mpz_get_si( &aMPI ) ) ); 410 413 mpz_clear( &aMPI ); 411 } else 414 } 415 else 412 416 a = CanonicalForm( new InternalInteger( aMPI ) ); 413 if ( mpz_is_imm( &bMPI ) ) { 417 if ( mpz_is_imm( &bMPI ) ) 418 { 414 419 b = CanonicalForm( int2imm( mpz_get_si( &bMPI ) ) ); 415 420 mpz_clear( &bMPI ); 416 } else 421 } 422 else 417 423 b = CanonicalForm( new InternalInteger( bMPI ) ); 418 if ( mpz_is_imm( &result ) ) { 424 if ( mpz_is_imm( &result ) ) 425 { 419 426 InternalCF * res = int2imm( mpz_get_si( &result ) ); 420 427 mpz_clear( &result ); … … 431 438 432 439 // simply return 1 if we are calculating over the rationals 433 if ( cf_glob_switches.isOn( SW_RATIONAL ) ) { 440 if ( cf_glob_switches.isOn( SW_RATIONAL ) ) 441 { 434 442 a = 1/CanonicalForm( copyObject() ); b = 0; 435 443 return int2imm( 1 ); … … 439 447 440 448 // trivial cases 441 if ( cInt == 1 || cInt == -1 ) { 449 if ( cInt == 1 || cInt == -1 ) 450 { 442 451 a = 0; b = cInt; 443 452 return int2imm( 1 ); 444 } else if ( cInt == 0 ) { 453 } 454 else if ( cInt == 0 ) 455 { 445 456 a = 1; b = 0; 446 457 return copyObject(); … … 493 504 mpz_init( &result ); 494 505 mpz_sqrt( &result, &thempi ); 495 if ( mpz_is_imm( &result ) ) { 506 if ( mpz_is_imm( &result ) ) 507 { 496 508 InternalCF * res = int2imm( mpz_get_si( &result ) ); 497 509 mpz_clear( &result );
Note: See TracChangeset
for help on using the changeset viewer.