Changeset 3a143d in git


Ignore:
Timestamp:
Jul 2, 1999, 4:28:53 PM (24 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
1ce62fa5979699f05bc8ccbc453b8bfdafd92c1c
Parents:
5ec0264649e3318cb84ecd5ffd7c5a2296539b5a
Message:
*hannes/wenk: nPower for complex


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

Legend:

Unmodified
Added
Removed
  • Singular/gnumpc.cc

    r5ec0264 r3a143d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: gnumpc.cc,v 1.3 1999-06-29 09:03:42 wenk Exp $ */
     4/* $Id: gnumpc.cc,v 1.4 1999-07-02 14:28:51 Singular Exp $ */
    55/*
    66* ABSTRACT: computations with GMP complex floating-point numbers
     
    7474void ngcNew (number * r)
    7575{
    76   *r= NULL;
     76  gmp_complex* n= new gmp_complex( );
     77  *r=(number)n;
    7778}
    7879
     
    250251  if ( exp == 0 )
    251252  {
    252     *(gmp_complex*)u= (gmp_complex)1.0;
     253    gmp_complex* n = new gmp_complex(1);
     254    *u=(number)n;
    253255    return;
    254256  }
    255257  if ( exp == 1 )
    256258  {
     259    nNew(u);
    257260    if ( x == NULL )
    258261    {
    259       *(gmp_complex*)u= (gmp_complex)0.0;
     262      gmp_complex* n = new gmp_complex();
     263      *u=(number)n;
    260264    }
    261265    else
    262266    {
    263       *(gmp_complex*)u= *(gmp_complex*)x;
     267      gmp_complex* n = new gmp_complex();
     268      *n= *(gmp_complex*)x;
     269      *u=(number)n;
    264270    }
    265271    return;
    266272  }
    267273  ngcPower(x,exp-1,u);
    268   *(gmp_complex*)u*= *(gmp_complex*)x;
     274  gmp_complex *n=new gmp_complex();
     275  *n=*(gmp_complex*)x;
     276  *(gmp_complex*)(*u) *= *(gmp_complex*)n;
     277  delete n;
    269278}
    270279
  • Singular/gnumpfl.cc

    r5ec0264 r3a143d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: gnumpfl.cc,v 1.4 1999-06-23 08:26:43 wenk Exp $ */
     4/* $Id: gnumpfl.cc,v 1.5 1999-07-02 14:28:52 Singular Exp $ */
    55/*
    66* ABSTRACT: computations with GMP floating-point numbers
     
    241241{
    242242  if ( exp == 0 )
    243   {
     243  {
     244    nNew(u);
    244245    *(gmp_float*)u= (gmp_float)1.0;
    245246    return;
     
    247248  if ( exp == 1 )
    248249  {
     250    nNew(u);
    249251    if ( x == NULL )
    250252    {
  • Singular/mpr_complex.cc

    r5ec0264 r3a143d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mpr_complex.cc,v 1.8 1999-06-28 16:06:26 Singular Exp $ */
     4/* $Id: mpr_complex.cc,v 1.9 1999-07-02 14:28:53 Singular Exp $ */
    55
    66/*
     
    509509    if (rField_is_long_C())
    510510    {
    511       out=(char*)AllocL((strlen(in_real)+strlen(in_imag)+5+strlen(currRing->parameter[0]))*sizeof(char));
     511      int len=(strlen(in_real)+strlen(in_imag)+5+strlen(currRing->parameter[0]))*sizeof(char);
     512      out=(char*)AllocL(len);
     513      memset(out,0,len);
    512514      sprintf(out,"%s%s%s*%s",in_real,c.imag().sign()>=0?"+":"-",currRing->parameter[0],in_imag);
    513515    }
    514516    else
    515517    {
    516       out=(char*)AllocL( (strlen(in_real)+strlen(in_imag)+8) * sizeof(char));
     518      int len=(strlen(in_real)+strlen(in_imag)+8) * sizeof(char);
     519      out=(char*)AllocL( len );
     520      memset(out,0,len);
    517521      sprintf(out,"%s%s%s",in_real,c.imag().sign()>=0?" + I ":" - I ",in_imag);
    518522    }
Note: See TracChangeset for help on using the changeset viewer.