Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c    |    Meh, in C you gotta define EVERYTHING    |    243,242 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 243,239 of 243,242    |
|    Paul to David Brown    |
|    Re: srand(0)    |
|    23 Feb 26 15:24:20    |
   
   XPost: sci.math.num-analysis   
   From: nospam@needed.invalid   
      
   On Mon, 2/23/2026 2:06 PM, David Brown wrote:   
      
   >>>> (text version of PI) 100,000,022 bytes   
   >>>> PI-Binary.bin 41,524,121 bytes exponent   
   and limbs   
   >   
   > Weirdly (at least /I/ think it is weird), it is easier to calculate   
   hexadecimal digits of pi than decimal digits.   
      
   I computed the decimal representation and the hex representation   
   (by dumping the exponent and limbs), in the same run.   
      
   int mpf_out_raw (FILE *f, mpf_t X) {   
    int expt; mpz_t Z; size_t nz;   
    expt = X->_mp_exp;   
    fwrite(&expt, sizeof(int), 1, f);   
    nz = X->_mp_size;   
    Z->_mp_alloc = nz;   
    Z->_mp_size = nz;   
    Z->_mp_d = X->_mp_d;   
    return (mpz_out_raw(f, Z) + sizeof(int));   
   }   
      
   And that's called this way.   
      
    /* Open the destination file in binary write mode */   
    FILE *destination = fopen("PI-Binary.bin", "wb");   
    if (!destination) {   
    perror("Error opening PI-Binary.bin file");   
    } else {   
    mpf_out_raw(destination, qi); /* qi happens to hold 100 million digits of   
   PI */   
    fflush(destination);   
    fclose(destination);   
    }   
      
   You can do them in the same run.   
      
   The 7,7,7,7,7,7,7,7,2 sequence was detected in a 32 million digit run   
   of SuperPi 1.5 XS. The 100 million digit sequence is too large   
   for SuperPI, and pgmp-chudnovsky.c (with OpenMP) was   
   used for that, with a little extra code thrown in so I could get   
   the floating point storage in raw format. It takes a bit more   
   than one minute, to generate 100 million digits (16 cores). The   
   compression attempt was done on a single core, to ensure the best   
   attempt at compression with 7ZIP.   
      
   The order of the PI method O() used is covered here.   
      
   https://en.wikipedia.org/wiki/Chudnovsky_algorithm   
      
    Paul   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca