@@ -30,47 +30,47 @@ ChudnovskyPiBS::ChudnovskyPiBS(unsigned long _digits)
3030 mpz_class twentyfour = 24 ;
3131 mpz_fdiv_q (intBigC3_OVER_24.get_mpz_t (), intBigC3_OVER_24.get_mpz_t (), twentyfour.get_mpz_t ());
3232 // intBigC3_OVER_24.get_str();
33- if (digits <= HUNDRED_MILLION)
34- {
33+ // if (digits <= HUNDRED_MILLION)
34+ // {
3535 mpz_ui_pow_ui (one_squared.get_mpz_t (), 10 , 2 *_digits);
3636 mpz_class thousandandfive__times__one_squared = 10005 * one_squared;
3737 mpz_sqrt (sqrtC.get_mpz_t (), thousandandfive__times__one_squared.get_mpz_t ());
3838 // std::cout << "Needed strlen:" << sqrtC.get_str().length() << std::endl;
39- }
40- else
41- {
42- mp_bitcnt_t prec = digits * log2l (10 ); // or is it 8 * (digits + 4)??
43- SHIFTER.set_prec (prec);
44- sqrtCF.set_prec (prec);
39+ // }
40+ // else
41+ // {
42+ // mp_bitcnt_t prec = digits * log2l(10); //or is it 8 * (digits + 4)??
43+ // SHIFTER.set_prec(prec);
44+ // sqrtCF.set_prec(prec);
4545
46- mpf_class ten = mpf_class (10 );
47- mpf_pow_ui (SHIFTER.get_mpf_t (), ten.get_mpf_t (), digits);
48- // std::cout << "Prec:" << SHIFTER.get_prec() << std::endl;
49- mpf_sqrt_ui (sqrtCF.get_mpf_t (),10005 );
50- // sqrtCF += 0.1 / SHIFTER;
51- sqrtCF *= SHIFTER;
52- mpf_trunc (sqrtCF.get_mpf_t (), sqrtCF.get_mpf_t ());
53- mp_exp_t exp = 0 ;
54- std::string tempMiddleWare = sqrtCF.get_str (exp, 10 , _digits + 4 );
55- // std::cout << "Gotten strlen:" << tempMiddleWare.length() << std::endl;
56- // std::cout << "Decimal pt location:" << exp << std::endl;
57- sqrtC = mpz_class (tempMiddleWare);
58- // sqrtC.get_str();
59- /*
60- ////ten = SHIFTER;
61- ////for (int i = 1; i < 10; i++) //this is basically doing (10^digits/10)^10 (by power rule, it becomes 10^digits)
62- //// SHIFTER *= ten;
63- ////std::cout << one_squared.get_str() << std::endl;
64- ////one_squared *= one_squared; //this makes it 10^(digits+digits) = 10^(2*digits) which is what we wanted.
65- ////mpz_class lol;
66- ////mpz_ui_pow_ui(lol.get_mpz_t(), 10, 2*_digits);
67- ////if (lol != one_squared)
68- ////{
69- //// std::cout << one_squared.get_str() << std::endl;
70- //// std::cout << lol.get_str() << std::endl;
71- ////}
72- */
73- }
46+ // mpf_class ten = mpf_class(10);
47+ // mpf_pow_ui(SHIFTER.get_mpf_t(), ten.get_mpf_t(), digits);
48+ // //std::cout << "Prec:" << SHIFTER.get_prec() << std::endl;
49+ // mpf_sqrt_ui(sqrtCF.get_mpf_t(),10005);
50+ // //sqrtCF += 0.1 / SHIFTER;
51+ // sqrtCF *= SHIFTER;
52+ // mpf_trunc(sqrtCF.get_mpf_t(), sqrtCF.get_mpf_t());
53+ // mp_exp_t exp = 0;
54+ // std::string tempMiddleWare = sqrtCF.get_str(exp, 10, _digits + 4);
55+ // //std::cout << "Gotten strlen:" << tempMiddleWare.length() << std::endl;
56+ // //std::cout << "Decimal pt location:" << exp << std::endl;
57+ // sqrtC = mpz_class(tempMiddleWare);
58+ // //sqrtC.get_str();
59+ // /*
60+ // ////ten = SHIFTER;
61+ // ////for (int i = 1; i < 10; i++) //this is basically doing (10^digits/10)^10 (by power rule, it becomes 10^digits)
62+ // //// SHIFTER *= ten;
63+ // ////std::cout << one_squared.get_str() << std::endl;
64+ // ////one_squared *= one_squared; //this makes it 10^(digits+digits) = 10^(2*digits) which is what we wanted.
65+ // ////mpz_class lol;
66+ // ////mpz_ui_pow_ui(lol.get_mpz_t(), 10, 2*_digits);
67+ // ////if (lol != one_squared)
68+ // ////{
69+ // //// std::cout << one_squared.get_str() << std::endl;
70+ // //// std::cout << lol.get_str() << std::endl;
71+ // ////}
72+ // */
73+ // }
7474}
7575
7676bsReturn ChudnovskyPiBS::bs (mpz_class a, mpz_class b) // clearly thread safe because nothing from outside the function is written to.
0 commit comments