Subject: binomial calculation wrong?
Date: Thursday 29 December 2011, 15:39:03
From: "Michael Dambmann" <mic...@dambmann.de>
To: themp...@gmail.com
<html><head></head><body bgcolor='#FFFFFF' style='font-size:10pt;background-color:#FFFFFF;font-family:Verdana, Arial, sans-serif;'>Dear mpir team,<br/>
<br/>
I have played around with the binomial calculation.<br/>
The attached .cpp file is created with vs2010 and win7 64 bit.<br/>
<br/>
The resulting calculation seams to be not correct.<br/>
e.g.:<br/>
<br/>
Normal Calculation : n=57 k=25 results in 9929472283517787 <== correct value<br/>
MPIR calculation : n=57 k=25 results in 9929472283517786 <== wrong value<br/>
<br/>
I could track it down to the function:<br/>
<p>
<font face="Consolas" size="2"><font face="Consolas" size="2">mpz_get_d(result);</font></font></p>
<br/>
which will modify the outgoing value.<br/>
Any idea why this happens?<br/>
<br/>
<br/>
Best regards,<br/>
Michael Dambmann<br/>
<br/>
<br/>
<br/></body></html>
-----------------------------------------