Bug in Decimal??

Mark H Harris harrismh777 at gmail.com
Thu May 15 17:26:07 EDT 2014


On 5/15/14 3:45 PM, pleasedontspam at isp.com wrote:
> Please take a deeper look at my second post. Try the same but this time
> set the precision to 4000, 8000 or whatever you need to convince yourself
> there's no error propagation, yet there's a 4 in the middle that shouldn't

> be there. See for yourself!
> I've tested on all platforms I know of and confirmed it. The wrong digit
> occurs in the middle of the number. Propagation error would have a bad digit
> near the end, and garbage after that. Here there's a perfect sequence of
> numbers, but with one single digit changed in the middle of the number.
> No error propagation in a series expansion can do that.
>
> I generated a table of 1000 numbers, one correctly generated and one with
> mpdecimal. Then I did a diff of both files and it's horrible. The difference
> is all over the place, sometimes as high as digit 500 (out of 2000). Almost
> every result has the bad digit somewhere. The bad digit moves around a lot,
> from about position 500 to 2000. All other digits are correct, and in a 2000
> digit sequence is hard to spot the difference (I used the visual diff tool
> that comes with TortoiseSVN or TortoiseGit). I think there's a bad pointer
> or something that's rounding the wrong digit.
> You cannot possibly have 1999 correct digits and only 1 changed on every
> number if it was propagation error.

> I'll follow up directly with the author of mpdecimal, as this is somewhat
> serious on a language that's so widely used as python.
>
> But please test it and confirm, am I seeing ghost digits?
>

I don't believe it. I've been running converging series to hudreds of 
thousands of decimal places (not only on different platforms, but on 
different BigFloat systmes, Jullia, BC, Decimal with pdeclib) and I'm 
not seeing the 'middle of the number' error you are talking about. I ran 
π to over 100,000+ digits and compared between BC and Python Decimal 
with pilib pdeclib and both compared correct;  also compared correct to 
the on-line standard.  Soooo... not sure ...

I can work on this some this weekend (comparing between Julia BigFloat 
and Python Decimal with pdeclib and see. I'm very skeptical at this point.

marcus



More information about the Python-list mailing list