Changeset 3c6379 in git


Ignore:
Timestamp:
Jul 30, 2004, 2:18:50 PM (20 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
9995418f9a692786b393990b5d8ec6afc065e936
Parents:
f12d4f65e05f0c6728f1743580a54e40d44c0f21
Message:
*hannes; again long real rounding


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

Legend:

Unmodified
Added
Removed
  • kernel/gnumpfl.cc

    rf12d4f6 r3c6379  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: gnumpfl.cc,v 1.1.1.1 2003-10-06 12:15:53 Singular Exp $ */
     4/* $Id: gnumpfl.cc,v 1.2 2004-07-30 12:18:50 Singular Exp $ */
    55/*
    66* ABSTRACT: computations with GMP floating-point numbers
     
    118118{
    119119  if ( i == NULL ) return 0;
    120   return (int)*(gmp_float*)i;
     120  double d=(double)*(gmp_float*)i;
     121  if (d<0.0)
     122    return (int)(d-0.5);
     123  else
     124    return (int)(d+0.5);
    121125}
    122126
  • kernel/mpr_complex.h

    rf12d4f6 r3c6379  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: mpr_complex.h,v 1.3 2004-07-29 18:13:28 Singular Exp $ */
     6/* $Id: mpr_complex.h,v 1.4 2004-07-30 12:18:50 Singular Exp $ */
    77
    88/*
     
    3131 * @short wrapper class for GNU Multi Precision Floats
    3232 */
     33class gmp_float;
     34char *floatToStr( const gmp_float & r, const unsigned int oprec );
    3335class gmp_float
    3436{
     
    132134  inline operator int() { return (int)mpf_get_d( t ); };
    133135  inline operator int() const { return (int)mpf_get_d( t ); };
    134 #else
     136//#else
    135137  inline operator int() const
    136138  { if (mpf_fits_sint_p(t))
    137     {
    138       gmp_float tmp(*this);
    139       tmp+=gmp_float(0.5);
    140       return (int)mpf_get_si( tmp.t );
    141     }
     139    { return (int)mpf_get_si( t ); }
    142140    return 0;
    143141  };
     
    165163gmp_float numberToFloat( number num );
    166164gmp_float numberFieldToFloat( number num, int k );
    167 char *floatToStr( const gmp_float & r, const unsigned int oprec );
     165//char *floatToStr( const gmp_float & r, const unsigned int oprec );
    168166//<-
    169167
Note: See TracChangeset for help on using the changeset viewer.