• Re: Division-bug in a beginner's script

    From ram@ram@zedat.fu-berlin.de (Stefan Ram) to comp.lang.python on Sat Dec 14 09:08:57 2024
    From Newsgroup: comp.lang.python

    Martin Ruppert <ruppert@hs-worms.de> wrote or quoted:
    z=.4
    nen=7

    You need:

    z = ".4"
    nen = "7"

    . Here's an script:

    import decimal

    z=0.4
    nen=7
    decimal.getcontext().prec=60 print(decimal.Decimal(z)/decimal.Decimal(nen),end=' ');print(f"decimal: {z}/{nen}")

    z='0.4'
    nen='7'
    decimal.getcontext().prec=60 print(decimal.Decimal(z)/decimal.Decimal(nen),end=' ');print(f"decimal: {z}/{nen}")

    . Before you go off half-cocked and start throwing shade about
    a Python library in your subject line, maybe you oughta hit
    the books and get your ducks in a row first


    --- Synchronet 3.20a-Linux NewsLink 1.114