0

I have two mpz_t type variables containing large integers and I need one divided by the other as a double. I know that this double will be <1, but I can't find a way to do this. Also, is it normal for mpz functions to use huge amounts of memory? I played around with mpz_cdiv_qr a bit but the memory ballooned rapidly (was fine once i cleared all the variables after, but still). In other parts of the code I readily use mpz mulitplyers but have no memory issues (or at least, if i do they're smaller than the others i'm already aware of!)

Thanks! -Z

Nick
  • 25,026
  • 7
  • 51
  • 83
zylatis
  • 448
  • 3
  • 14
  • Convert your 2 variables to double (mpz_get_d) and divide those... (of course you'll have memory issues if you have leaks in your program) – Marc Glisse Nov 27 '13 at 15:53
  • If the integers are too large to be converted to double but their quotient isn't, the easiest may be to use mpf_t as an intermediate. – Marc Glisse Nov 27 '13 at 15:54

0 Answers0