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

    From Stefan Ram@3:633/280.2 to All on Sat Dec 14 20:08:57 2024
    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



    --- MBSE BBS v1.0.8.4 (Linux-x86_64)
    * Origin: Stefan Ram (3:633/280.2@fidonet)