80 template<
unsigned int Precision>
127#ifndef _AMP_NO_TEMPLATE_CONSTRUCTORS
128 template<
unsigned int Precision2>
168#ifndef _AMP_NO_TEMPLATE_CONSTRUCTORS
169 template<
unsigned int Precision2>
172 if( (
void*)
this==(
void*)(&r) )
207 std::string
toHex()
const;
208 std::string
toDec()
const;
243 template<
unsigned int Precision>
250 template<
unsigned int Precision>
255 mpfr_set_ui(getWritePtr(), 0, GMP_RNDN);
258 template<
unsigned int Precision>
263 mpfr_set_si(getWritePtr(), sv, GMP_RNDN);
266 template<
unsigned int Precision>
271 mpfr_set_ui(getWritePtr(),
v, GMP_RNDN);
274 template<
unsigned int Precision>
279 mpfr_set_ld(getWritePtr(),
v, GMP_RNDN);
282 template<
unsigned int Precision>
287 mpfr_strtofr(getWritePtr(),
s,
NULL, 0, GMP_RNDN);
290 template<
unsigned int Precision>
301 template<
unsigned int Precision>
304 if( rval->refCount==1 )
307 mpfr_set(newrval->
value, rval->value, GMP_RNDN);
313 template<
unsigned int Precision>
316 return mpfr_number_p(getReadPtr())!=0;
319 template<
unsigned int Precision>
322 if( !isFiniteNumber() )
324 return mpfr_sgn(getReadPtr())>0;
327 template<
unsigned int Precision>
330 return mpfr_zero_p(getReadPtr())!=0;
333 template<
unsigned int Precision>
336 if( !isFiniteNumber() )
338 return mpfr_sgn(getReadPtr())<0;
341 template<
unsigned int Precision>
344 return getUlpOf(*
this);
347 template<
unsigned int Precision>
350 return mpfr_get_d(getReadPtr(), GMP_RNDN);
353 template<
unsigned int Precision>
359 if( !isFiniteNumber() )
364 ptr = mpfr_get_str(
NULL, &_e, 16, 0, getReadPtr(), GMP_RNDN);
379 ptr = mpfr_get_str(
NULL, &expval, 16, 0, getReadPtr(), GMP_RNDN);
382 if( iexpval!=expval )
384 sprintf(buf_e,
"%ld",
long(iexpval));
398 template<
unsigned int Precision>
406 if( !isFiniteNumber() )
411 ptr = mpfr_get_str(
NULL, &_e, 10, 0, getReadPtr(), GMP_RNDN);
426 ptr = mpfr_get_str(
NULL, &expval, 10, 0, getReadPtr(), GMP_RNDN);
429 if( iexpval!=expval )
431 sprintf(buf_e,
"%ld",
long(iexpval));
444 template<
unsigned int Precision>
447 char *toString_Block=(
char *)
omAlloc(256);
451 if( !isFiniteNumber() )
455 ptr = mpfr_get_str(
NULL, &_e, 10, 0, getReadPtr(), GMP_RNDN);
456 strcpy(toString_Block, ptr);
458 return toString_Block;
470 ptr = mpfr_get_str(
NULL, &expval, 10, 0, getReadPtr(), GMP_RNDN);
473 if( iexpval!=expval )
475 sprintf(buf_e,
"%ld",
long(iexpval));
479 sprintf(toString_Block,
"-0.%sE%s",ptr,buf_e);
482 sprintf(toString_Block,
"0.%sE%s",ptr,buf_e);
484 return toString_Block;
487 template<
unsigned int Precision>
490 if( !
x.isFiniteNumber() )
500 mpfr_get_exp(
x.getReadPtr()),
510 template<
unsigned int Precision>
519 template<
unsigned int Precision>
533 template<
unsigned int Precision>
547 template<
unsigned int Precision>
556 template<
unsigned int Precision>
564 template<
unsigned int Precision>
570 template<
unsigned int Precision>
574 mp_exp_t e1 = mpfr_get_emax();
575 mp_exp_t e2 = -mpfr_get_emin();
576 mp_exp_t e = e1>e2 ? e1 : e2;
581 template<
unsigned int Precision>
585 mp_exp_t e1 = mpfr_get_emax();
586 mp_exp_t e2 = -mpfr_get_emin();
587 mp_exp_t e = e1>e2 ? e1 : e2;
592 template<
unsigned int Precision>
603 template<
unsigned int Precision>
609 template<
unsigned int Precision>
615 template<
unsigned int Precision>
621 template<
unsigned int Precision>
627 template<
unsigned int Precision>
633 template<
unsigned int Precision>
642 template<
unsigned int Precision>
648 template<
unsigned int Precision>
656 template<
unsigned int Precision>
664 template<
unsigned int Precision>
673 template<
unsigned int Precision>
681 template<
unsigned int Precision>
692 template<
unsigned int Precision>
697 mpfr_sqr(
res.getWritePtr(),
x.getReadPtr(), GMP_RNDN);
701 template<
unsigned int Precision>
704 int s = mpfr_sgn(
x.getReadPtr());
712 template<
unsigned int Precision>
717 mpfr_abs(
res.getWritePtr(),
x.getReadPtr(), GMP_RNDN);
721 template<
unsigned int Precision>
726 mpfr_max(
res.getWritePtr(),
x.getReadPtr(),
y.getReadPtr(), GMP_RNDN);
730 template<
unsigned int Precision>
735 mpfr_min(
res.getWritePtr(),
x.getReadPtr(),
y.getReadPtr(), GMP_RNDN);
739 template<
unsigned int Precision>
744 mpfr_sqrt(
res.getWritePtr(),
x.getReadPtr(), GMP_RNDN);
748 template<
unsigned int Precision>
756 mpfr_clear_erangeflag();
758 if( mpfr_erangeflag_p()!=0 )
763 template<
unsigned int Precision>
772 template<
unsigned int Precision>
780 mpfr_clear_erangeflag();
782 if( mpfr_erangeflag_p()!=0 )
787 template<
unsigned int Precision>
795 mpfr_clear_erangeflag();
797 if( mpfr_erangeflag_p()!=0 )
802 template<
unsigned int Precision>
810 mpfr_clear_erangeflag();
812 if( mpfr_erangeflag_p()!=0 )
817 template<
unsigned int Precision>
822 if( !
x.isFiniteNumber() )
836 template<
unsigned int Precision>
848 #define __AMP_BINARY_OPI(type) \
849 template<unsigned int Precision> const ampf<Precision> operator+(const signed type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)+op2; } \
850 template<unsigned int Precision> const ampf<Precision> operator+(const unsigned type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)+op2; } \
851 template<unsigned int Precision> const ampf<Precision> operator+(const ampf<Precision>& op1, const signed type& op2) { return op1+ampf<Precision>(op2); } \
852 template<unsigned int Precision> const ampf<Precision> operator+(const ampf<Precision>& op1, const unsigned type& op2) { return op1+ampf<Precision>(op2); } \
853 template<unsigned int Precision> const ampf<Precision> operator-(const signed type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)-op2; } \
854 template<unsigned int Precision> const ampf<Precision> operator-(const unsigned type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)-op2; } \
855 template<unsigned int Precision> const ampf<Precision> operator-(const ampf<Precision>& op1, const signed type& op2) { return op1-ampf<Precision>(op2); } \
856 template<unsigned int Precision> const ampf<Precision> operator-(const ampf<Precision>& op1, const unsigned type& op2) { return op1-ampf<Precision>(op2); } \
857 template<unsigned int Precision> const ampf<Precision> operator*(const signed type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)*op2; } \
858 template<unsigned int Precision> const ampf<Precision> operator*(const unsigned type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)*op2; } \
859 template<unsigned int Precision> const ampf<Precision> operator*(const ampf<Precision>& op1, const signed type& op2) { return op1*ampf<Precision>(op2); } \
860 template<unsigned int Precision> const ampf<Precision> operator*(const ampf<Precision>& op1, const unsigned type& op2) { return op1*ampf<Precision>(op2); } \
861 template<unsigned int Precision> const ampf<Precision> operator/(const signed type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)/op2; } \
862 template<unsigned int Precision> const ampf<Precision> operator/(const unsigned type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)/op2; } \
863 template<unsigned int Precision> const ampf<Precision> operator/(const ampf<Precision>& op1, const signed type& op2) { return op1/ampf<Precision>(op2); } \
864 template<unsigned int Precision> const ampf<Precision> operator/(const ampf<Precision>& op1, const unsigned type& op2) { return op1/ampf<Precision>(op2); } \
865 template<unsigned int Precision> const bool operator==(const signed type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)==op2; } \
866 template<unsigned int Precision> const bool operator==(const unsigned type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)==op2; } \
867 template<unsigned int Precision> const bool operator==(const ampf<Precision>& op1, const signed type& op2) { return op1==ampf<Precision>(op2); } \
868 template<unsigned int Precision> const bool operator==(const ampf<Precision>& op1, const unsigned type& op2) { return op1==ampf<Precision>(op2); } \
869 template<unsigned int Precision> const bool operator!=(const signed type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)!=op2; } \
870 template<unsigned int Precision> const bool operator!=(const unsigned type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)!=op2; } \
871 template<unsigned int Precision> const bool operator!=(const ampf<Precision>& op1, const signed type& op2) { return op1!=ampf<Precision>(op2); } \
872 template<unsigned int Precision> const bool operator!=(const ampf<Precision>& op1, const unsigned type& op2) { return op1!=ampf<Precision>(op2); } \
873 template<unsigned int Precision> const bool operator<=(const signed type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)<=op2; } \
874 template<unsigned int Precision> const bool operator<=(const unsigned type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)<=op2; } \
875 template<unsigned int Precision> const bool operator<=(const ampf<Precision>& op1, const signed type& op2) { return op1<=ampf<Precision>(op2); } \
876 template<unsigned int Precision> const bool operator<=(const ampf<Precision>& op1, const unsigned type& op2) { return op1<=ampf<Precision>(op2); } \
877 template<unsigned int Precision> const bool operator>=(const signed type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)>=op2; } \
878 template<unsigned int Precision> const bool operator>=(const unsigned type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)>=op2; } \
879 template<unsigned int Precision> const bool operator>=(const ampf<Precision>& op1, const signed type& op2) { return op1>=ampf<Precision>(op2); } \
880 template<unsigned int Precision> const bool operator>=(const ampf<Precision>& op1, const unsigned type& op2) { return op1>=ampf<Precision>(op2); } \
881 template<unsigned int Precision> const bool operator<(const signed type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)<op2; } \
882 template<unsigned int Precision> const bool operator<(const unsigned type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)<op2; } \
883 template<unsigned int Precision> const bool operator<(const ampf<Precision>& op1, const signed type& op2) { return op1<ampf<Precision>(op2); } \
884 template<unsigned int Precision> const bool operator<(const ampf<Precision>& op1, const unsigned type& op2) { return op1<ampf<Precision>(op2); } \
885 template<unsigned int Precision> const bool operator>(const signed type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)>op2; } \
886 template<unsigned int Precision> const bool operator>(const unsigned type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)>op2; } \
887 template<unsigned int Precision> const bool operator>(const ampf<Precision>& op1, const signed type& op2) { return op1>ampf<Precision>(op2); } \
888 template<unsigned int Precision> const bool operator>(const ampf<Precision>& op1, const unsigned type& op2) { return op1>ampf<Precision>(op2); }
893 #undef __AMP_BINARY_OPI
894 #define __AMP_BINARY_OPF(type) \
895 template<unsigned int Precision> const ampf<Precision> operator+(const type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)+op2; } \
896 template<unsigned int Precision> const ampf<Precision> operator+(const ampf<Precision>& op1, const type& op2) { return op1+ampf<Precision>(op2); } \
897 template<unsigned int Precision> const ampf<Precision> operator-(const type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)-op2; } \
898 template<unsigned int Precision> const ampf<Precision> operator-(const ampf<Precision>& op1, const type& op2) { return op1-ampf<Precision>(op2); } \
899 template<unsigned int Precision> const ampf<Precision> operator*(const type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)*op2; } \
900 template<unsigned int Precision> const ampf<Precision> operator*(const ampf<Precision>& op1, const type& op2) { return op1*ampf<Precision>(op2); } \
901 template<unsigned int Precision> const ampf<Precision> operator/(const type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)/op2; } \
902 template<unsigned int Precision> const ampf<Precision> operator/(const ampf<Precision>& op1, const type& op2) { return op1/ampf<Precision>(op2); } \
903 template<unsigned int Precision> bool operator==(const type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)==op2; } \
904 template<unsigned int Precision> bool operator==(const ampf<Precision>& op1, const type& op2) { return op1==ampf<Precision>(op2); } \
905 template<unsigned int Precision> bool operator!=(const type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)!=op2; } \
906 template<unsigned int Precision> bool operator!=(const ampf<Precision>& op1, const type& op2) { return op1!=ampf<Precision>(op2); } \
907 template<unsigned int Precision> bool operator<=(const type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)<=op2; } \
908 template<unsigned int Precision> bool operator<=(const ampf<Precision>& op1, const type& op2) { return op1<=ampf<Precision>(op2); } \
909 template<unsigned int Precision> bool operator>=(const type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)>=op2; } \
910 template<unsigned int Precision> bool operator>=(const ampf<Precision>& op1, const type& op2) { return op1>=ampf<Precision>(op2); } \
911 template<unsigned int Precision> bool operator<(const type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)<op2; } \
912 template<unsigned int Precision> bool operator<(const ampf<Precision>& op1, const type& op2) { return op1<ampf<Precision>(op2); } \
913 template<unsigned int Precision> bool operator>(const type& op1, const ampf<Precision>& op2) { return ampf<Precision>(op1)>op2; } \
914 template<unsigned int Precision> bool operator>(const ampf<Precision>& op1, const type& op2) { return op1>ampf<Precision>(op2); }
918 #undef __AMP_BINARY_OPF
923 template<
unsigned int Precision>
927 mpfr_const_pi(
v->value, GMP_RNDN);
931 template<
unsigned int Precision>
935 mpfr_const_pi(
v->value, GMP_RNDN);
936 mpfr_mul_2si(
v->value,
v->value, -1, GMP_RNDN);
940 template<
unsigned int Precision>
944 mpfr_const_pi(
v->value, GMP_RNDN);
945 mpfr_mul_2si(
v->value,
v->value, +1, GMP_RNDN);
949 template<
unsigned int Precision>
953 mpfr_sin(
v->value,
x.getReadPtr(), GMP_RNDN);
957 template<
unsigned int Precision>
961 mpfr_cos(
v->value,
x.getReadPtr(), GMP_RNDN);
965 template<
unsigned int Precision>
969 mpfr_tan(
v->value,
x.getReadPtr(), GMP_RNDN);
973 template<
unsigned int Precision>
977 mpfr_asin(
v->value,
x.getReadPtr(), GMP_RNDN);
981 template<
unsigned int Precision>
985 mpfr_acos(
v->value,
x.getReadPtr(), GMP_RNDN);
989 template<
unsigned int Precision>
993 mpfr_atan(
v->value,
x.getReadPtr(), GMP_RNDN);
997 template<
unsigned int Precision>
1001 mpfr_atan2(
v->value,
y.getReadPtr(),
x.getReadPtr(), GMP_RNDN);
1005 template<
unsigned int Precision>
1009 mpfr_log(
v->value,
x.getReadPtr(), GMP_RNDN);
1013 template<
unsigned int Precision>
1017 mpfr_log2(
v->value,
x.getReadPtr(), GMP_RNDN);
1021 template<
unsigned int Precision>
1025 mpfr_log10(
v->value,
x.getReadPtr(), GMP_RNDN);
1029 template<
unsigned int Precision>
1033 mpfr_exp(
v->value,
x.getReadPtr(), GMP_RNDN);
1037 template<
unsigned int Precision>
1041 mpfr_sinh(
v->value,
x.getReadPtr(), GMP_RNDN);
1045 template<
unsigned int Precision>
1049 mpfr_cosh(
v->value,
x.getReadPtr(), GMP_RNDN);
1053 template<
unsigned int Precision>
1057 mpfr_tanh(
v->value,
x.getReadPtr(), GMP_RNDN);
1061 template<
unsigned int Precision>
1065 mpfr_pow(
v->value,
x.getReadPtr(),
y.getReadPtr(), GMP_RNDN);
1072 template<
unsigned int Precision>
1091#ifndef _AMP_NO_TEMPLATE_CONSTRUCTORS
1092 template<
unsigned int Prec2>
1115#ifndef _AMP_NO_TEMPLATE_CONSTRUCTORS
1116 template<
unsigned int Precision2>
1131 template<
unsigned int Precision>
1133 {
return lhs.
x==rhs.
x && lhs.
y==rhs.
y; }
1135 template<
unsigned int Precision>
1137 {
return lhs.
x!=rhs.
x || lhs.
y!=rhs.
y; }
1139 template<
unsigned int Precision>
1143 template<
unsigned int Precision>
1145 { lhs.
x += rhs.
x; lhs.
y += rhs.
y;
return lhs; }
1147 template<
unsigned int Precision>
1151 template<
unsigned int Precision>
1155 template<
unsigned int Precision>
1157 { lhs.
x -= rhs.
x; lhs.
y -= rhs.
y;
return lhs; }
1159 template<
unsigned int Precision>
1163 template<
unsigned int Precision>
1172 template<
unsigned int Precision>
1176 template<
unsigned int Precision>
1199 template<
unsigned int Precision>
1206 template<
unsigned int Precision>
1213 w = xabs>yabs ? xabs : yabs;
1214 v = xabs<yabs ? xabs : yabs;
1224 template<
unsigned int Precision>
1230 template<
unsigned int Precision>
1240 #define __AMP_BINARY_OPI(type) \
1241 template<unsigned int Precision> const campf<Precision> operator+ (const signed type& op1, const campf<Precision>& op2) { return campf<Precision>(op1+op2.x, op2.y); } \
1242 template<unsigned int Precision> const campf<Precision> operator+ (const unsigned type& op1, const campf<Precision>& op2) { return campf<Precision>(op1+op2.x, op2.y); } \
1243 template<unsigned int Precision> const campf<Precision> operator+ (const campf<Precision>& op1, const signed type& op2) { return campf<Precision>(op1.x+op2, op1.y); } \
1244 template<unsigned int Precision> const campf<Precision> operator+ (const campf<Precision>& op1, const unsigned type& op2) { return campf<Precision>(op1.x+op2, op1.y); } \
1245 template<unsigned int Precision> const campf<Precision> operator- (const signed type& op1, const campf<Precision>& op2) { return campf<Precision>(op1-op2.x, -op2.y); } \
1246 template<unsigned int Precision> const campf<Precision> operator- (const unsigned type& op1, const campf<Precision>& op2) { return campf<Precision>(op1-op2.x, -op2.y); } \
1247 template<unsigned int Precision> const campf<Precision> operator- (const campf<Precision>& op1, const signed type& op2) { return campf<Precision>(op1.x-op2, op1.y); } \
1248 template<unsigned int Precision> const campf<Precision> operator- (const campf<Precision>& op1, const unsigned type& op2) { return campf<Precision>(op1.x-op2, op1.y); } \
1249 template<unsigned int Precision> const campf<Precision> operator* (const signed type& op1, const campf<Precision>& op2) { return campf<Precision>(op1*op2.x, op1*op2.y); } \
1250 template<unsigned int Precision> const campf<Precision> operator* (const unsigned type& op1, const campf<Precision>& op2) { return campf<Precision>(op1*op2.x, op1*op2.y); } \
1251 template<unsigned int Precision> const campf<Precision> operator* (const campf<Precision>& op1, const signed type& op2) { return campf<Precision>(op2*op1.x, op2*op1.y); } \
1252 template<unsigned int Precision> const campf<Precision> operator* (const campf<Precision>& op1, const unsigned type& op2) { return campf<Precision>(op2*op1.x, op2*op1.y); } \
1253 template<unsigned int Precision> const campf<Precision> operator/ (const signed type& op1, const campf<Precision>& op2) { return campf<Precision>(ampf<Precision>(op1),ampf<Precision>(0))/op2; } \
1254 template<unsigned int Precision> const campf<Precision> operator/ (const unsigned type& op1, const campf<Precision>& op2) { return campf<Precision>(ampf<Precision>(op1),ampf<Precision>(0))/op2; } \
1255 template<unsigned int Precision> const campf<Precision> operator/ (const campf<Precision>& op1, const signed type& op2) { return campf<Precision>(op1.x/op2, op1.y/op2); } \
1256 template<unsigned int Precision> const campf<Precision> operator/ (const campf<Precision>& op1, const unsigned type& op2) { return campf<Precision>(op1.x/op2, op1.y/op2); } \
1257 template<unsigned int Precision> bool operator==(const signed type& op1, const campf<Precision>& op2) { return op1==op2.x && op2.y==0; } \
1258 template<unsigned int Precision> bool operator==(const unsigned type& op1, const campf<Precision>& op2) { return op1==op2.x && op2.y==0; } \
1259 template<unsigned int Precision> bool operator==(const campf<Precision>& op1, const signed type& op2) { return op1.x==op2 && op1.y==0; } \
1260 template<unsigned int Precision> bool operator==(const campf<Precision>& op1, const unsigned type& op2) { return op1.x==op2 && op1.y==0; } \
1261 template<unsigned int Precision> bool operator!=(const campf<Precision>& op1, const signed type& op2) { return op1.x!=op2 || op1.y!=0; } \
1262 template<unsigned int Precision> bool operator!=(const campf<Precision>& op1, const unsigned type& op2) { return op1.x!=op2 || op1.y!=0; } \
1263 template<unsigned int Precision> bool operator!=(const signed type& op1, const campf<Precision>& op2) { return op1!=op2.x || op2.y!=0; } \
1264 template<unsigned int Precision> bool operator!=(const unsigned type& op1, const campf<Precision>& op2) { return op1!=op2.x || op2.y!=0; }
1269 #undef __AMP_BINARY_OPI
1270 #define __AMP_BINARY_OPF(type) \
1271 template<unsigned int Precision> const campf<Precision> operator+ (const type& op1, const campf<Precision>& op2) { return campf<Precision>(op1+op2.x, op2.y); } \
1272 template<unsigned int Precision> const campf<Precision> operator+ (const campf<Precision>& op1, const type& op2) { return campf<Precision>(op1.x+op2, op1.y); } \
1273 template<unsigned int Precision> const campf<Precision> operator- (const type& op1, const campf<Precision>& op2) { return campf<Precision>(op1-op2.x, -op2.y); } \
1274 template<unsigned int Precision> const campf<Precision> operator- (const campf<Precision>& op1, const type& op2) { return campf<Precision>(op1.x-op2, op1.y); } \
1275 template<unsigned int Precision> const campf<Precision> operator* (const type& op1, const campf<Precision>& op2) { return campf<Precision>(op1*op2.x, op1*op2.y); } \
1276 template<unsigned int Precision> const campf<Precision> operator* (const campf<Precision>& op1, const type& op2) { return campf<Precision>(op2*op1.x, op2*op1.y); } \
1277 template<unsigned int Precision> const campf<Precision> operator/ (const type& op1, const campf<Precision>& op2) { return campf<Precision>(ampf<Precision>(op1),ampf<Precision>(0))/op2; } \
1278 template<unsigned int Precision> const campf<Precision> operator/ (const campf<Precision>& op1, const type& op2) { return campf<Precision>(op1.x/op2, op1.y/op2); } \
1279 template<unsigned int Precision> bool operator==(const type& op1, const campf<Precision>& op2) { return op1==op2.x && op2.y==0; } \
1280 template<unsigned int Precision> bool operator==(const campf<Precision>& op1, const type& op2) { return op1.x==op2 && op1.y==0; } \
1281 template<unsigned int Precision> bool operator!=(const type& op1, const campf<Precision>& op2) { return op1!=op2.x || op2.y!=0; } \
1282 template<unsigned int Precision> bool operator!=(const campf<Precision>& op1, const type& op2) { return op1.x!=op2 || op1.y!=0; }
1287 #undef __AMP_BINARY_OPF
1292 template<
unsigned int Precision>
1296 int i, cnt = v1.GetLength();
1297 const ampf<Precision> *p1 = v1.GetData();
1298 const ampf<Precision> *p2 = v2.GetData();
1299 mpfr_record *r =
NULL;
1300 mpfr_record *t =
NULL;
1305 mpfr_set_ui(r->value, 0, GMP_RNDN);
1306 for(
i=0;
i<cnt;
i++)
1308 mpfr_mul(t->value, p1->getReadPtr(), p2->getReadPtr(), GMP_RNDN);
1309 mpfr_add(r->value, r->value, t->value, GMP_RNDN);
1326 template<
unsigned int Precision>
1330 int i, cnt = vDst.GetLength();
1335 for(
i=0;
i<cnt;
i++)
1338 pDst += vDst.GetStep();
1339 pSrc += vSrc.GetStep();
1343 template<
unsigned int Precision>
1347 int i, cnt = vDst.GetLength();
1350 for(
i=0;
i<cnt;
i++)
1354 mpfr_neg(
v,
v, GMP_RNDN);
1355 pDst += vDst.GetStep();
1356 pSrc += vSrc.GetStep();
1360 template<
unsigned int Precision,
class T2>
1364 int i, cnt = vDst.GetLength();
1368 for(
i=0;
i<cnt;
i++)
1373 pDst += vDst.GetStep();
1374 pSrc += vSrc.GetStep();
1378 template<
unsigned int Precision>
1382 int i, cnt = vDst.GetLength();
1385 for(
i=0;
i<cnt;
i++)
1389 mpfr_add(
v,
v, vs, GMP_RNDN);
1390 pDst += vDst.GetStep();
1391 pSrc += vSrc.GetStep();
1395 template<
unsigned int Precision,
class T2>
1399 int i, cnt = vDst.GetLength();
1403 for(
i=0;
i<cnt;
i++)
1407 mpfr_mul(tmp.
getWritePtr(), a.getReadPtr(), vs, GMP_RNDN);
1409 pDst += vDst.GetStep();
1410 pSrc += vSrc.GetStep();
1414 template<
unsigned int Precision>
1418 int i, cnt = vDst.GetLength();
1421 for(
i=0;
i<cnt;
i++)
1425 mpfr_sub(
v,
v, vs, GMP_RNDN);
1426 pDst += vDst.GetStep();
1427 pSrc += vSrc.GetStep();
1431 template<
unsigned int Precision,
class T2>
1437 template<
unsigned int Precision,
class T2>
1440 int i, cnt = vDst.GetLength();
1443 for(
i=0;
i<cnt;
i++)
1447 pDst += vDst.GetStep();
#define __AMP_BINARY_OPF(type)
#define __AMP_BINARY_OPI(type)
ampf & operator/=(const T &v)
ampf & operator-=(const T &v)
static const ampf getAlgoPascalEpsilon()
void InitializeAsSLong(signed long v)
void InitializeAsULong(unsigned long v)
static const ampf getUlp256()
bool isNegativeNumber() const
void InitializeAsDouble(long double v)
ampf & operator+=(const T &v)
static const ampf getAlgoPascalMaxNumber()
static const ampf getRandom()
bool isPositiveNumber() const
void InitializeAsString(const char *s)
mpfr_srcptr getReadPtr() const
static const ampf getUlp512()
ampf & operator=(long double v)
static const ampf getUlp()
std::string toHex() const
ampf & operator*=(const T &v)
static const ampf getMinNumber()
bool isFiniteNumber() const
ampf(const ampf< Precision2 > &r)
std::string toDec() const
ampf(const std::string &s)
static const ampf getMaxNumber()
static const ampf getAlgoPascalMinNumber()
campf & operator=(long double v)
campf(const ampf< Precision > &_x)
campf(const ampf< Precision > &_x, const ampf< Precision > &_y)
campf(const campf< Prec2 > &z)
void initialize(int Precision)
mpfr_reference & operator=(const mpfr_reference &r)
mpfr_srcptr getReadPtr() const
static gmp_randstate_t * getRandState()
static void deleteMpfr(mpfr_record *ref)
static mpfr_record * newMpfr(unsigned int Precision)
static mpfr_record_ptr & getList(unsigned int Precision)
static void make_assertion(bool bClause)
const CanonicalForm int s
const CanonicalForm int const CFList const Variable & y
const Variable & v
< [in] a sqrfree bivariate poly
campf< Precision > & operator-=(campf< Precision > &lhs, const campf< Precision > &rhs)
campf< Precision > & operator*=(campf< Precision > &lhs, const campf< Precision > &rhs)
const ampf< Precision > abs(const ampf< Precision > &x)
const ampf< Precision > cos(const ampf< Precision > &x)
const ampf< Precision > halfpi()
campf< Precision > & operator/=(campf< Precision > &lhs, const campf< Precision > &rhs)
const signed long floor(const ampf< Precision > &x)
const bool operator>(const ampf< Precision > &op1, const ampf< Precision > &op2)
const ampf< Precision > operator-(const ampf< Precision > &op1)
void vAdd(ap::raw_vector< ampf< Precision > > vDst, ap::const_raw_vector< ampf< Precision > > vSrc)
const signed long ceil(const ampf< Precision > &x)
const ampf< Precision > abscomplex(const campf< Precision > &z)
const ampf< Precision > operator/(const ampf< Precision > &op1, const ampf< Precision > &op2)
const ampf< Precision > cosh(const ampf< Precision > &x)
const ampf< Precision > ldexp2(const ampf< Precision > &x, mp_exp_t exponent)
const ampf< Precision > maximum(const ampf< Precision > &x, const ampf< Precision > &y)
const ampf< Precision > exp(const ampf< Precision > &x)
const ampf< Precision > sqrt(const ampf< Precision > &x)
const campf< Precision > conj(const campf< Precision > &z)
const ampf< Precision > twopi()
const bool operator>=(const ampf< Precision > &op1, const ampf< Precision > &op2)
void vMoveNeg(ap::raw_vector< ampf< Precision > > vDst, ap::const_raw_vector< ampf< Precision > > vSrc)
const ampf< Precision > atan2(const ampf< Precision > &y, const ampf< Precision > &x)
const campf< Precision > csqr(const campf< Precision > &z)
const ampf< Precision > log2(const ampf< Precision > &x)
const bool operator<=(const ampf< Precision > &op1, const ampf< Precision > &op2)
const ampf< Precision > operator+(const ampf< Precision > &op1)
const bool operator!=(const ampf< Precision > &op1, const ampf< Precision > &op2)
void vMove(ap::raw_vector< ampf< Precision > > vDst, ap::const_raw_vector< ampf< Precision > > vSrc)
const ampf< Precision > log10(const ampf< Precision > &x)
const ampf< Precision > asin(const ampf< Precision > &x)
const bool operator<(const ampf< Precision > &op1, const ampf< Precision > &op2)
const ampf< Precision > pow(const ampf< Precision > &x, const ampf< Precision > &y)
campf< Precision > & operator+=(campf< Precision > &lhs, const campf< Precision > &rhs)
const ampf< Precision > tanh(const ampf< Precision > &x)
const ampf< Precision > frexp2(const ampf< Precision > &x, mp_exp_t *exponent)
void vSub(ap::raw_vector< ampf< Precision > > vDst, ap::const_raw_vector< ampf< Precision > > vSrc)
const ampf< Precision > atan(const ampf< Precision > &x)
void vMul(ap::raw_vector< ampf< Precision > > vDst, T2 alpha)
const int sign(const ampf< Precision > &x)
const ampf< Precision > sin(const ampf< Precision > &x)
mpfr_record * mpfr_record_ptr
const ampf< Precision > sqr(const ampf< Precision > &x)
const ampf< Precision > minimum(const ampf< Precision > &x, const ampf< Precision > &y)
const ampf< Precision > sinh(const ampf< Precision > &x)
const ampf< Precision > operator*(const ampf< Precision > &op1, const ampf< Precision > &op2)
const signed long trunc(const ampf< Precision > &x)
const ampf< Precision > frac(const ampf< Precision > &x)
const bool operator==(const ampf< Precision > &op1, const ampf< Precision > &op2)
const ampf< Precision > acos(const ampf< Precision > &x)
const ampf< Precision > tan(const ampf< Precision > &x)
const signed long round(const ampf< Precision > &x)
const ampf< Precision > log(const ampf< Precision > &x)