Changeset 2b44a1 in git for factory/canonicalform.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/canonicalform.cc
r01c486 r2b44a1 1 1 /* emacs edit mode for this file is -*- C++ -*- */ 2 /* $Id: canonicalform.cc,v 1.4 0 2006-05-15 09:03:04Singular Exp $ */2 /* $Id: canonicalform.cc,v 1.41 2007-12-04 15:24:53 Singular Exp $ */ 3 3 4 4 #include <config.h> … … 1437 1437 // check immediate cases 1438 1438 int what = is_imm( g.value ); 1439 if ( is_imm( f.value ) ) { 1439 if ( is_imm( f.value ) ) 1440 { 1440 1441 ASSERT( ! what || (what == is_imm( f.value )), "incompatible operands" ); 1441 1442 if ( what == 0 ) 1442 1443 return g.value->bgcdcoeff( f.value ); 1443 else if ( what == INTMARK && ! cf_glob_switches.isOn( SW_RATIONAL ) ) { 1444 else if ( what == INTMARK && ! cf_glob_switches.isOn( SW_RATIONAL ) ) 1445 { 1444 1446 // calculate gcd using standard integer 1445 1447 // arithmetic … … 1450 1452 if ( gInt < 0 ) gInt = -gInt; 1451 1453 // swap fInt and gInt 1452 if ( gInt > fInt ) { 1454 if ( gInt > fInt ) 1455 { 1453 1456 int swap = gInt; 1454 1457 gInt = fInt; … … 1457 1460 1458 1461 // now, 0 <= gInt <= fInt. Start the loop. 1459 while ( gInt ) { 1462 while ( gInt ) 1463 { 1460 1464 // calculate (fInt, gInt) = (gInt, fInt%gInt) 1461 1465 int r = fInt % gInt; … … 1465 1469 1466 1470 return CanonicalForm( fInt ); 1467 } else 1471 } 1472 else 1468 1473 // we do not go for maximal speed for these stupid 1469 1474 // special cases … … 1477 1482 1478 1483 // check levels 1479 if ( fLevel == gLevel ) { 1484 if ( fLevel == gLevel ) 1485 { 1480 1486 fLevel = f.value->levelcoeff(); 1481 1487 gLevel = g.value->levelcoeff();
Note: See TracChangeset
for help on using the changeset viewer.