Changeset dd08e72 in git


Ignore:
Timestamp:
Jul 30, 1997, 5:06:33 PM (27 years ago)
Author:
Jens Schmidt <schmidt@…>
Branches:
(u'spielwiese', '82fc009ea2b0098c1a4896c841bb70860976bdfc')
Children:
28f80ff8221b7962cdedc98586baa2774b0d23a6
Parents:
93a9eca5ad58254c75835cb69423c2e57dbd55d0
Message:
	* canonicalform.cc (sqrt): sqrt(0) works now
	(sqrt): assertion added
	(sqrt): 'int h' changed to 'long long h'.  Casts added.


git-svn-id: file:///usr/local/Singular/svn/trunk@584 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/canonicalform.cc

    r93a9ec rdd08e72  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: canonicalform.cc,v 1.11 1997-07-30 07:55:02 schmidt Exp $ */
     2/* $Id: canonicalform.cc,v 1.12 1997-07-30 15:06:33 schmidt Exp $ */
    33
    44#include <config.h>
     
    12501250        ASSERT( is_imm( value ) == INTMARK, "not implemented" );
    12511251        int a = imm2int( value );
    1252         if ( a == 1 )
    1253             return CanonicalForm( CFFactory::basic( 1 ) );
    1254         else {
    1255             int h, x0, x1 = a;
     1252        ASSERT( a >= 0, "arg to sqrt less than zero" );
     1253        if ( a == 0 || a == 1 )
     1254            return CanonicalForm( CFFactory::basic( a ) );
     1255        else {
     1256            int x0, x1 = a;
     1257            long long int h;
    12561258            do {
    12571259                x0 = x1;
    1258                 h = x0 * x0 + a - 1;
     1260                h = (long long int)x0 * x0 + a - 1;
    12591261                if ( h % (2 * x0) == 0 )
    12601262                    x1 = h / (2 * x0);
Note: See TracChangeset for help on using the changeset viewer.