On Tue, Apr 11, 2017 at 3:43 PM, Alan Gauld via Tutor <tutor@python.org> wrote: > On 11/04/17 19:44, Mats Wichmann wrote: > >> import decimal >> >> Pi_Number = >> str(decimal.Decimal(3.14159265358979323846264338327950288419716939)) >> > > Unfortunately that doesn't work either: > >>>> " " + str(decimal.Decimal( > ... 3.14159265358979323846264338327950288419716939)) > ' 3.141592653589793115997963468544185161590576171875' >>>> > > Notice the output is both longer and has completely different > numbers in the last half of the result.
I have not used the decimal module (until tonight). I just now played around with it some, but cannot get it to do an exact conversion of the number under discussion to a string using str(). I notice that the module has the methods to_eng_string() and to_sci_string(), but I see no substitute for str() listed. Surely there is some way to use the decimal module to get the desired conversion to a string? I have to retire for the evening and will try to figure this out tomorrow. Cheers! boB _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor