Changeset 8fc1b4d in git
 Timestamp:
 Oct 11, 2006, 5:57:00 PM (17 years ago)
 Branches:
 (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
 Children:
 39132394cccb0abb04cb64b0a4c7c37ca8c84ed8
 Parents:
 94a5cd44d6fd0c7c2a974433347946e67ec5ceea
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

kernel/mpr_complex.cc
r94a5cd r8fc1b4d 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: mpr_complex.cc,v 1. 3 20050727 15:48:29Singular Exp $ */4 /* $Id: mpr_complex.cc,v 1.4 20061011 15:57:00 Singular Exp $ */ 5 5 6 6 /* … … 40 40 extern int mmInit(void); 41 41 int dummy=mmInit(); 42 static gmp_float gmpRel(0.0);43 static gmp_float diff(0.0);42 static gmp_float *gmpRel=NULL; 43 static gmp_float *diff=NULL; 44 44 45 45 … … 63 63 gmp_output_digits= digits; 64 64 mpf_set_default_prec( db ); 65 mpf_set_prec(*diff._mpfp(),32); 66 mpf_set_prec(*gmpRel._mpfp(),32); 67 mpf_set_d(*gmpRel._mpfp(),0.1); 68 mpf_pow_ui(*gmpRel._mpfp(),*gmpRel._mpfp(),digits); 65 if (diff!=NULL) delete diff; 66 diff=new gmp_float(0.0); 67 mpf_set_prec(*diff>_mpfp(),32); 68 if (gmpRel!=NULL) delete gmpRel; 69 gmpRel=new gmp_float(0.0); 70 mpf_set_prec(*gmpRel>_mpfp(),32); 71 mpf_set_d(*gmpRel>_mpfp(),0.1); 72 mpf_pow_ui(*gmpRel>_mpfp(),*gmpRel>_mpfp(),digits); 69 73 } 70 74 … … 135 139 } 136 140 mpf_add( t, t, a.t ); 137 mpf_set(diff .t, t);138 mpf_set_prec(diff .t, 32);139 mpf_div(diff .t, diff.t, a.t);140 mpf_abs(diff .t, diff.t);141 if(mpf_cmp(diff .t, gmpRel.t) < 0)141 mpf_set(diff>t, t); 142 mpf_set_prec(diff>t, 32); 143 mpf_div(diff>t, diff>t, a.t); 144 mpf_abs(diff>t, diff>t); 145 if(mpf_cmp(diff>t, gmpRel>t) < 0) 142 146 mpf_set_d( t, 0.0); 143 147 return *this; … … 156 160 } 157 161 mpf_sub( t, t, a.t ); 158 mpf_set(diff .t, t);159 mpf_set_prec(diff .t, 32);160 mpf_div(diff .t, diff.t, a.t);161 mpf_abs(diff .t, diff.t);162 if(mpf_cmp(diff .t, gmpRel.t) < 0)162 mpf_set(diff>t, t); 163 mpf_set_prec(diff>t, 32); 164 mpf_div(diff>t, diff>t, a.t); 165 mpf_abs(diff>t, diff>t); 166 if(mpf_cmp(diff>t, gmpRel>t) < 0) 163 167 mpf_set_d( t, 0.0); 164 168 return *this; … … 172 176 if((mpf_sgn(a.t)==0) && (mpf_sgn(b.t)==0)) 173 177 return true; 174 mpf_sub(diff .t, a.t, b.t);175 mpf_div(diff .t, diff.t, a.t);176 mpf_abs(diff .t, diff.t);177 if(mpf_cmp(diff .t, gmpRel.t) < 0)178 mpf_sub(diff>t, a.t, b.t); 179 mpf_div(diff>t, diff>t, a.t); 180 mpf_abs(diff>t, diff>t); 181 if(mpf_cmp(diff>t, gmpRel>t) < 0) 178 182 return true; 179 183 else … … 193 197 if (mpf_sgn(t) <= 0) 194 198 return false; 195 mpf_sub_ui(diff .t, t, 1);196 mpf_abs(diff .t, diff.t);197 if(mpf_cmp(diff .t, gmpRel.t) < 0)199 mpf_sub_ui(diff>t, t, 1); 200 mpf_abs(diff>t, diff>t); 201 if(mpf_cmp(diff>t, gmpRel>t) < 0) 198 202 return true; 199 203 else … … 209 213 if (mpf_sgn(t) >= 0) 210 214 return false; 211 mpf_add_ui(diff .t, t, 1);212 mpf_abs(diff .t, diff.t);213 if(mpf_cmp(diff .t, gmpRel.t) < 0)215 mpf_add_ui(diff>t, t, 1); 216 mpf_abs(diff>t, diff>t); 217 if(mpf_cmp(diff>t, gmpRel>t) < 0) 214 218 return true; 215 219 else … … 711 715 { 712 716 mpf_div(*ai._mpfp(), *ai._mpfp(), *ar._mpfp()); 713 if (ai < gmpRel) this>imag(0.0);717 if (ai < *gmpRel) this>imag(0.0); 714 718 } 715 719 else 716 720 { 717 721 mpf_div(*ar._mpfp(), *ar._mpfp(), *ai._mpfp()); 718 if (ar < gmpRel) this>real(0.0);722 if (ar < *gmpRel) this>real(0.0); 719 723 } 720 724 }
Note: See TracChangeset
for help on using the changeset viewer.