您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ BigInt函数代码示例

51自学网 2021-06-01 19:54:59
  C++
这篇教程C++ BigInt函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中BigInt函数的典型用法代码示例。如果您正苦于以下问题:C++ BigInt函数的具体用法?C++ BigInt怎么用?C++ BigInt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了BigInt函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ToIntegerVec

VecT<BigInt,2> ToIntegerVec(Vec2i a){    VecT<BigInt,2> ret;    ret[0] = BigInt(a[0]);    ret[1] = BigInt(a[1]);    return ret;}
开发者ID:lievenvanderheide,项目名称:matter,代码行数:7,


示例2: divOperator

static void divOperator(const BigInt& left, const BigInt& right, BigInt& qNum, BigInt& remain){	if (left.size == right.size) {		if (left >= right) {			qNum = BigInt(1);			remain = left - right;			while(remain >= right) {			    remain = remain - right;			    ++qNum.v[0];			}		}		else {			qNum = BigInt(1);			remain = left;		}	}	else {		BigInt t10("10");		remain = BigInt(1);		vector<short> num;		for(int i = 0; i < left.size; ++i) {			char t = left.v[i] + '0';			remain = remain * t10 + BigInt(t);			short s  = 0;			while(remain >= right) {				remain = remain - right;				++s;			}			num.push_back(s);		}		qNum.v = num;		qNum.size = num.size();		rmBeginZero(qNum);	}}
开发者ID:clearlylin,项目名称:Algorithm,代码行数:35,


示例3: BigInt

const BigInt operator *(const BigInt& amount1, const BigInt& amount2){    if(amount1==0 || amount2==0) return BigInt();    int i,j,carry;    int *sum = new int[amount1.length + amount2.length];    int *digit1 = amount1.digit, *digit2 = amount2.digit;    for(i = 0 ;i < amount1.length+amount2.length; i++) // initialize        sum[i] = 0;    for(i = amount1.length-1; i >= 0; i--)    {        carry = 0;        for(j = amount2.length-1; j >= 0; j--){            sum[i+j+1] += carry + digit1[i]*digit2[j];            carry = sum[i+j+1] / 10;            sum[i+j+1] %= 10;        }        sum[i+j+1] += carry;    }    if(amount1.sign == amount2.sign)        return BigInt(sum, amount1.length + amount2.length, 0);    else        return BigInt(sum, amount1.length + amount2.length, 1);}
开发者ID:Yuki23329626,项目名称:BigComplex,代码行数:25,


示例4: BigInt

void SendToAddressTest::testSend(){    GethSimulator & geth = _context.getGeth();    _context.getKeyStore().registerAccount("0x0000000000000000000000000000000000000000", "asdasd123");    geth.setBalance("0x0000000000000000000000000000000000000000", BigInt("1000000000000000000"));    QString from = "0x0000000000000000000000000000000000000000";    QString to = "0x0000000000000000000000000000000000000001";    QVariantMap request;    request.insert("from", from);    request.insert("to", to);    request.insert("amount", "100000000000000000");    request.insert("password", "asdasd123");    QVariant result = _command(request);    QString txid = result.toString();    QVERIFY(geth.getBalance("0x0000000000000000000000000000000000000001") == BigInt("100000000000000000"));    QVERIFY(geth.getBalance("0x0000000000000000000000000000000000000000") == BigInt("900000000000000000"));    QJsonObject transaction = _context.getDataBase().getTransactions().get(txid.toStdString().c_str());    QCOMPARE(transaction["hash"].toString(), txid);    QCOMPARE(transaction["from"].toString(), from);    QCOMPARE(transaction["to"].toString(), to);    QCOMPARE(transaction["amount"].toString(), QString("100000000000000000"));}
开发者ID:BitProfile,项目名称:Xeth,代码行数:26,


示例5: mk_smt_bool

smt_asttsmt_convt::overflow_cast(const expr2tc &expr){  // If in integer mode, this is completely pointless. Return false.  if (int_encoding)    return mk_smt_bool(false);  const overflow_cast2t &ocast = to_overflow_cast2t(expr);  unsigned int width = ocast.operand->type->get_width();  unsigned int bits = ocast.bits;  smt_sortt boolsort = boolean_sort;  if (ocast.bits >= width || ocast.bits == 0) {    std::cerr << "SMT conversion: overflow-typecast got wrong number of bits"              << std::endl;    abort();  }  // Basically: if it's positive in the first place, ensure all the top bits  // are zero. If neg, then all the top are 1's /and/ the next bit, so that  // it's considered negative in the next interpretation.  constant_int2tc zero(ocast.operand->type, BigInt(0));  lessthan2tc isnegexpr(ocast.operand, zero);  smt_astt isneg = convert_ast(isnegexpr);  smt_astt orig_val = convert_ast(ocast.operand);  // Difference bits  unsigned int pos_zero_bits = width - bits;  unsigned int neg_one_bits = (width - bits) + 1;  smt_sortt pos_zero_bits_sort =    mk_sort(SMT_SORT_BV, pos_zero_bits, false);  smt_sortt neg_one_bits_sort =    mk_sort(SMT_SORT_BV, neg_one_bits, false);  smt_astt pos_bits = mk_smt_bvint(BigInt(0), false, pos_zero_bits);  smt_astt neg_bits = mk_smt_bvint(BigInt((1 << neg_one_bits) - 1),                                         false, neg_one_bits);  smt_astt pos_sel = mk_extract(orig_val, width - 1,                                      width - pos_zero_bits,                                      pos_zero_bits_sort);  smt_astt neg_sel = mk_extract(orig_val, width - 1,                                      width - neg_one_bits,                                      neg_one_bits_sort);  smt_astt pos_eq = mk_func_app(boolsort, SMT_FUNC_EQ, pos_bits, pos_sel);  smt_astt neg_eq = mk_func_app(boolsort, SMT_FUNC_EQ, neg_bits, neg_sel);  // isneg -> neg_eq, !isneg -> pos_eq  smt_astt notisneg = mk_func_app(boolsort, SMT_FUNC_NOT, &isneg, 1);  smt_astt c1 = mk_func_app(boolsort, SMT_FUNC_IMPLIES, isneg, neg_eq);  smt_astt c2 = mk_func_app(boolsort, SMT_FUNC_IMPLIES, notisneg, pos_eq);  smt_astt nooverflow = mk_func_app(boolsort, SMT_FUNC_AND, c1, c2);  return mk_func_app(boolsort, SMT_FUNC_NOT, &nooverflow, 1);}
开发者ID:ericksonalves,项目名称:esbmc,代码行数:58,


示例6: BigInt

BigInt BigInt::PowN(BigInt a, BigInt N){	if (N == BigInt("0"))		return BigInt("1");	if (N % 2 == 1)		return PowN(a, N - 1)* a;	else {		BigInt b = PowN(a, N / 2);		return b*b;	}}
开发者ID:VictorLadyzhets,项目名称:Big-Integer,代码行数:11,


示例7: main

// ------------------------------------------------------------int main(int ac, char *av[]) {    BigInt i1("9999999998");    BigInt i2("0000000001");    BigInt i3("0000000001");    BigInt i4;    cout << "i1: " << i1 << endl         << "i2: " << i2 << endl         << "i3: " << i3 << endl         << "i4: " << i4 << endl         << endl;    try {        cout << "Copy c'tor test (i5 = i3):" << endl;        BigInt i5 = i3;        cout << "i5=" << i5 << endl;        cout << "Copy assignment test (i4 = i3):" << endl;        i4 = i3;        cout << "i4=" << i4 << endl << endl;        cout << "Move c'tor test (i6 = std::move(BigInt(/"0000000015/"))):" << endl;        BigInt i6 = std::move(BigInt("0000000015"));        cout << "i6=" << i6 << endl;        cout << "Move assignment test (i5 = BigInt(/"0000000010/"):" << endl;        i5 = BigInt("0000000010");        cout << "i5=" << i5 << endl << endl;        cout << "Equality operators:" << endl             << "i1 == i2: expected=0: " << (i1 == i2) << endl             << "i1 != i3: expected=1: " << (i1 != i3) << endl             << "i2 == i3: expected=1: " << (i2 == i3) << endl             << endl;        cout << "Less-than operator:" << endl             << "i2 < i1: expected=1: " << (i2 < i1) << endl             << "i1 < i3: expected=0: " << (i1 < i3) << endl             << "i2 < i3: expected=0: " << (i2 < i3) << endl             << endl;        cout << "Addition operator:" << endl             << "i1 + i2: expected=9999999999: " << (i1 + i2) << endl             << "i2 + i3 + i4: expected=0000000003: " << (i2 + i3 + i4) << endl;        cout << "i1 + i2 + i3: expected=overflow: " << (i1 + i3 + i3) << endl             << endl;    }    catch (const exception &e) {        cout << e.what() << endl;    }    return 0;}
开发者ID:matthynes,项目名称:CS2510,代码行数:52,


示例8: RSASetData

/*****************************************************************************  Function:	void RSASetData(BYTE* data, WORD len, RSA_DATA_FORMAT format)  Summary:	Indicates the data to be encrypted or decrypted.  Description:	Call this function to indicate what data is to be encrypted or decrypted.	This function ensures that the data is PKCS #1 padded for encryption	operations, and also normalizes the data to little-endian format	so that it will be compatible with the BigInt libraries.  Precondition:	RSA has already been initialized and RSABeginUsage has returned TRUE.  Parameters:	data - The data to be encrypted or decrypted	len - The length of data	format - One of the RSA_DATA_FORMAT constants indicating the endian-ness			 of the input data.  Return Values:  	None    Remarks:  	For decryption operations, the calculation is done in place.  Thererore,   	the endian-ness of the input data may be modified by this function.    	Encryption operations may expand the input, so separate memory is   	allocated for the operation in that case.  ***************************************************************************/void RSASetData(BYTE* data, WORD len, RSA_DATA_FORMAT format){	#if defined(STACK_USE_RSA_ENCRYPT)	if(smRSA == SM_RSA_ENCRYPT_START)	{		// Initialize the BigInt wrappers		BigInt(&X, (BIGINT_DATA_TYPE*)rsaData, len/sizeof(BIGINT_DATA_TYPE));				// Copy in the data		memcpy((void*)rsaData, (void*)data, len);			// For big-endian, swap the data		if(format == RSA_BIG_ENDIAN)			BigIntSwapEndianness(&X);				// Resize the big int to full size		BigInt(&X, (BIGINT_DATA_TYPE*)rsaData, keyLength/sizeof(BIGINT_DATA_TYPE));				// Pad the input data according to PKCS #1 Block 2		if(len < keyLength-4)		{			rsaData[len++] = 0x00;			while(len < keyLength-2)			{				do				{					rsaData[len] = RandomGet();				} while(rsaData[len] == 0x00u);				len++;			}			rsaData[len++] = 0x02;			rsaData[len++] = 0x00;		}	}	#endif		#if defined(STACK_USE_RSA_DECRYPT)	if(smRSA == SM_RSA_DECRYPT_START)	{		BigInt(&X, (BIGINT_DATA_TYPE*)data, len/sizeof(BIGINT_DATA_TYPE));				// Correct and save endianness		outputFormat = format;		if(outputFormat == RSA_BIG_ENDIAN)			BigIntSwapEndianness(&X);	}	#endif}
开发者ID:AllanMar,项目名称:i2ceth,代码行数:79,


示例9: generate_number

BigInt generate_number(Seed &s, GeneratorParams &params) {  unsigned int v = params.first;  unsigned int w = params.second;  std::vector<unsigned char> h;  // step 2  BigInt tmp = s.sha1();  // step 3  std::vector<unsigned char> h0 = (std::vector<unsigned char>) tmp.right_bits(w);  h.insert(h.end(), h0.begin(), h0.end()); //step 6  // step 4  BigInt z = s;  BigInt _2_e_160 = BigInt(2).pow(160);  for(unsigned int i = 1; i < v + 1; i++) {                // step 5    BigInt zi = z;    zi += i;    Seed si = (zi) % _2_e_160;              // step 5.1    std::vector<unsigned char> hi = si.sha1();// step 5.2    h.insert(h.end(), hi.begin(), hi.end());  // step 6  }  BigInt c = h;  return c;}
开发者ID:msramos,项目名称:ecc,代码行数:28,


示例10: RSASetN

void RSASetN(BYTE* data, RSA_DATA_FORMAT format){	BigInt(&N, (BIGINT_DATA_TYPE*)data, keyLength/sizeof(BIGINT_DATA_TYPE));		if(format == RSA_BIG_ENDIAN)		BigIntSwapEndianness(&N);}
开发者ID:AllanMar,项目名称:i2ceth,代码行数:7,


示例11: BigInt

BigInt operator*(const BigInt& left, const BigInt& right){	if (left.v[0] == 0 || right.v[0] == 0)		return BigInt(1);	int len = left.size + right.size;	BigInt r(len);	r.positive = left.positive == right.positive ? true : false;	const BigInt *lptr = &left, *rptr = &right;	if (right.size > left.size) {		lptr = &right;		rptr = &left;	}	int i = rptr->size - 1, l = lptr->size;	for(; i >= 0; --i) {		short t = rptr->v[i];		if (t) {			int k = len - rptr->size + i, j = lptr->size - 1;			int tmp, carry = 0;			while(j >= 0) {				tmp = t * lptr->v[j--] + carry + r.v[k];				carry = tmp / 10;				r.v[k--] = tmp % 10;			}			if (carry)				r.v[k] = carry;		}	}	rmBeginZero(r);	return r;}
开发者ID:clearlylin,项目名称:Algorithm,代码行数:32,


示例12: BigInt

/* * POST decrement operator */TIDorb::types::BigInt   TIDorb::types::BigInt::operator-- (int){    TIDorb::types::BigInt result = (*this);    (*this) = (*this) - BigInt(1);    _modified = true;    return result;}
开发者ID:AlvaroVega,项目名称:TIDorbC,代码行数:10,


示例13: overflow_error

// ------------------------------------------------------------BigInt BigInt::operator+(const BigInt &bi) const {    // Perform the addition in columns from LSB to MSB    int result[mySize];    int carry = 0;    for (int i = mySize - 1; i >= 0; --i) {        int add = myVec[i] + bi.myVec[i] + carry;        result[i] = add % 10;        carry = add / 10;    }    // At the end of the computation, if 'carry' is non-zero,    // it means we need another digit to store the result    // (aka, overflow)    if (carry > 0) {        overflow_error("overflow");    }    // Convert vector back to a string    ostringstream buf;    for (auto i: result) {        buf << i;    }    // And return a new BigInt based on the string    return BigInt(buf.str());}
开发者ID:matthynes,项目名称:CS2510,代码行数:27,


示例14: fractions

EPtr FunctionNumeric::apply_evaled(EPtr arguments, State &state) {    Number *value = Element::as_number(Pair::car(arguments));    if (! value) return state.error("first argument must be numeric");    Fractional v = value->value();    BigInt fractions(5);    Element *next = Pair::cdr(arguments);    if (next) {        Number *digits = Element::as_number(Pair::car(next));        if (! digits) return state.error("second argument must be numeric");        if (Pair::cdr(next)) return state.error("too many arguments");        if (digits->value().denominator() != BigInt(1)) return state.error("digits must be integer");        fractions = digits->value().numerator();    }    Fractional rounding(1, 2);    Fractional ten(10);    Fractional one(1);    Fractional zero(0);        for (Fractional i = fractions; zero < i; i = i - one) {        rounding = rounding / ten;    }    v = v + rounding;        std::ostringstream buffer;    Fractional fraction(0);    if (v.denominator() > BigInt(1)) {        BigInt rest = v.numerator() % v.denominator();        Fractional full = v - Fractional(rest, v.denominator(), v.isNegative());        buffer << full;        fraction = v - full;    } else {        buffer << v;        fraction = Fractional(0);    }    buffer << ".";        BigInt bi_one(1);    for (BigInt cur(0); cur < fractions; cur = cur + bi_one) {        fraction = fraction * ten;        BigInt rest = fraction.numerator() % fraction.denominator();        Fractional full = fraction - Fractional(rest, fraction.denominator(), fraction.isNegative());        buffer << full;        fraction = fraction - full;    }        return state.creator()->new_string(buffer.str());}
开发者ID:itmm,项目名称:myLisp,代码行数:47,


示例15: BigInt

void BigInt::operator *=(BigInt num){    if ((*this) == 1){        (*this) = num;        return;    }    if (num == 1){        return;    }    if ((*this) == 0 || num == 0){        (*this) = 0;        return;    }    BigInt result = BigInt(0);    std::deque<BigInt> rows;    int carry = 0;    int partResult = 0;    int index = 0;    for (auto multiplicant_digit = num._number.rbegin(); multiplicant_digit != num._number.rend(); multiplicant_digit++){        rows.push_back(BigInt(0));        rows.back()._number.pop_back();        for (int i = 0; i < index; i++){            rows.back()._number.push_back(0);        }        index++;        carry = 0;        for (auto multiplier_digit = _number.rbegin(); multiplier_digit != _number.rend(); multiplier_digit++){            partResult = (*multiplicant_digit) * (*multiplier_digit) + carry;            //std::cout <<(*multiplicant_digit) <<"*"<< (*multiplier_digit) <<"+"<<carry<<"="<<partResult<<std::endl;            if (partResult >= 10){                carry = (int)partResult / 10;                partResult %= 10;            } else {                carry = 0;            }            rows.back()._number.push_front(partResult);        }        if (carry > 0){            rows.back()._number.push_front(carry);        }    }    for (std::deque<BigInt>::iterator row = rows.begin(); row != rows.end(); row++){        result += (*row);    }    result._sign = _sign ^ num._sign ? SIGN_NEGATIVE : SIGN_POSITIVE;    (*this) = result;}
开发者ID:reynevan,项目名称:bigInt,代码行数:47,


示例16: if

BigInt& BigInt::operator/=(const BigInt& that){	if (that.isZero())		throw std::invalid_argument("division by zero");	else if (positive && *this < that)		return *this = zero;	bool signsDiffer = positive != that.positive;	BigInt dividend(*this);	BigInt divisor(that);	size_t shift = dividend.size() - divisor.size();	std::vector<bool> binaryDigits;	dividend.positive = divisor.positive = true;	divisor <<= shift;	while (divisor > dividend)	{		divisor >>= 1;		shift--;	}	while (shift)	{		if (divisor <= dividend)		{			dividend -= divisor;			binaryDigits.push_back(true);		}		else			binaryDigits.push_back(false);		--shift;		divisor >>= 1;	}	if (dividend >= divisor)	{		binaryDigits.push_back(true);		dividend -= divisor;	}	else		binaryDigits.push_back(false);	std::reverse(binaryDigits.begin(), binaryDigits.end());		*this = BigInt(BigInt::binaryToWords(binaryDigits), positive == that.positive);	if (signsDiffer && !dividend.isZero())		*this -= 1;	trim();	return *this;}
开发者ID:brennie,项目名称:arithmetic,代码行数:58,


示例17: makeFeeObject

QVariant EstimateProfileOperationCommand::estimateEditDetails(const QVariantMap &request){    if(!request.contains("uri"))    {        return makeFeeObject(BigInt(136000), request);    }    return makeFeeObject(estimateEdit(request["uri"].toString(), "details", "ipfs://QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"), request);}
开发者ID:BitProfile,项目名称:Xeth,代码行数:9,


示例18: RSAInit

/*****************************************************************************  Function:	void RSAInit(void)  Summary:	Initializes the RSA engine  Description:	Call this function once at boot to configure the memories for RSA	key storage and temporary processing space.  Precondition:	None  Parameters:	None  Returns:  	None  	  Remarks:	This function is called only one during lifetime of the application.  ***************************************************************************/void RSAInit(void){	#if defined(STACK_USE_RSA_DECRYPT)		BigIntROM(&P, (ROM BIGINT_DATA_TYPE*)SSL_P, RSA_PRIME_WORDS);		BigIntROM(&Q, (ROM BIGINT_DATA_TYPE*)SSL_Q, RSA_PRIME_WORDS);		BigIntROM(&dP, (ROM BIGINT_DATA_TYPE*)SSL_dP, RSA_PRIME_WORDS);		BigIntROM(&dQ, (ROM BIGINT_DATA_TYPE*)SSL_dQ, RSA_PRIME_WORDS);		BigIntROM(&qInv, (ROM BIGINT_DATA_TYPE*)SSL_qInv, RSA_PRIME_WORDS);	#endif		#if defined(STACK_USE_RSA_ENCRYPT)		BigInt(&E, (BIGINT_DATA_TYPE*)eData, sizeof(eData)/sizeof(BIGINT_DATA_TYPE));	#endif    BigInt(&tmp, (BIGINT_DATA_TYPE*)rsaTemp, sizeof(rsaTemp)/sizeof(BIGINT_DATA_TYPE));		smRSA = SM_RSA_IDLE;}
开发者ID:AllanMar,项目名称:i2ceth,代码行数:41,


示例19: exit

 Rational::Rational(BigInt newNumerator, BigInt newDenominator){     if(newDenominator == BigInt(0)){         cout << "Illegal denominator/n";         exit(1);     }     normalize(newNumerator, newDenominator);     numerator = newNumerator;     denominator = newDenominator; };
开发者ID:abcd40404,项目名称:OOP-project,代码行数:9,


示例20: Invalid_Argument

/** Generate a random integer within given range*/BigInt BigInt::random_integer(RandomNumberGenerator& rng,                              const BigInt& min, const BigInt& max)   {   BigInt range = max - min;   if(range <= 0)      throw Invalid_Argument("random_integer: invalid min/max values");   return (min + (BigInt(rng, range.bits() + 2) % range));   }
开发者ID:AlexNk,项目名称:botan,代码行数:13,


示例21: main

int main(){    BigInt fib0 = BigInt(1);    BigInt fib1 = BigInt(1);    BigInt fibTmp;    int numIteration = 2;    while (fib1.getNumDigits() < 1000)    {	fibTmp = fib1;	fib1 += fib0;	fib0 = fibTmp;	++numIteration;    }    std::cout << numIteration << ". term" << std::endl;    return 0;}
开发者ID:Marik23,项目名称:Euler,代码行数:19,


示例22: throwInvalidArgumentException

void BigRational::init(const BigInt &numerator, const BigInt &denominator) {  DEFINEMETHODNAME;  if(denominator.isZero()) {    throwInvalidArgumentException(method, _T("Denominator is zero"));  }  DigitPool *pool = getDigitPool();  if(numerator.isZero()) { // zero always 0/1    m_numerator   = pool->get0();    m_denominator = pool->get1();  } else {    const BigInt gcd = findGCD(BigInt(fabs(numerator)),BigInt(fabs(denominator)));    m_numerator   = numerator / gcd;    m_denominator = denominator / gcd;    if(denominator.isNegative()) { // Negative numbers are represented with negative numerator and positive denominator      m_numerator   = -m_numerator;      m_denominator = -m_denominator;    }  }}
开发者ID:JesperMikkelsen,项目名称:Big-Numbers,代码行数:20,


示例23: BigInt

Point ECDSA::Double(Point P) {  Point r;  BigInt numerator = BigInt(3) * (P.x ^ 2) + a;  numerator = ModP(numerator);  BigInt denominator = BigInt(2) * P.y;  denominator = ModP(denominator);  BigInt lambda = numerator * Inverse(denominator);  lambda = ModP(lambda);  r.x = (lambda ^ BigInt(2)) - (BigInt(2) * P.x);  r.x = ModP(r.x);  r.y = (lambda * (P.x - r.x)) - P.y;  r.y = ModP(r.y);  return r;}
开发者ID:raymond-w-ko,项目名称:mupbit,代码行数:20,


示例24: magn

const BigInt operator /(const BigInt& amount1, const BigInt& amount2){    // magn = magnificent;    BigInt quotient, magn(amount2), dividend(amount1), divisor(amount2);    dividend.sign = divisor.sign = 0;    if(dividend < divisor)        return BigInt(0);    if(dividend > divisor)        magn = magn.leftShift(dividend.length - divisor.length);    //if(dividend < magn)    //    magn = magn.rightShift(); // magn = magn/10;    if(dividend >= magn)        quotient.length = amount1.length - amount2.length + 1;    else{        quotient.length = amount1.length - amount2.length;        magn = magn.rightShift(); // magn = magn/10;    }    quotient.digit = new int[quotient.length];    for(int i = 0 ; i < quotient.length ; i++)        quotient.digit[i] = 0;    int index(0);    while(dividend >= divisor){        while(dividend >= magn)        {            quotient.digit[index]++;            dividend = dividend - magn;        }        magn = magn.rightShift();        index++;    }    if(amount1.getSign() == amount2.getSign())        return BigInt( quotient.digit , quotient.length, quotient.sign);    else        return BigInt( quotient.digit , quotient.length, !quotient.sign);}
开发者ID:Yuki23329626,项目名称:BigComplex,代码行数:41,


示例25: toString

//left shift base Decimalconst BigInt BigInt::leftShift(size_t n)const{    if( n == 0 ) return *this;    std::string str = toString();    if( str.size() == 1 && str[0] == '0')        return *this;    str.insert(str.end(), n, '0');    return BigInt(str);}
开发者ID:luotuo44,项目名称:BigInt,代码行数:13,


示例26: BigInt

BigInt EstimateProfileOperationCommand::estimateEdit(const QString &uri, const QString &key, const QString &value){    BitProfileStore::Iterator it = _store.find(uri);    if(it==_store.end())    {        return BigInt(0);    }    BitProfile::ProfileAdministrator admin = BitProfile::ProfileAdministrator::FromDescriptor(_provider, *it);    return _estimator.estimateEdit(admin, key.toStdString(), value.toStdString());}
开发者ID:BitProfile,项目名称:Xeth,代码行数:12,



注:本文中的BigInt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ BigShort函数代码示例
C++ BiffStructurePtr函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。