Deutsch English Français Italiano |
<bug-20241214100538@ram.dialup.fu-berlin.de> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!npeer.as286.net!npeer-ng0.as286.net!fu-berlin.de!uni-berlin.de!not-for-mail From: ram@zedat.fu-berlin.de (Stefan Ram) Newsgroups: comp.lang.python Subject: Re: Division-bug in a beginner's script Date: 14 Dec 2024 09:08:57 GMT Organization: Stefan Ram Lines: 28 Expires: 1 Jan 2026 11:59:58 GMT Message-ID: <bug-20241214100538@ram.dialup.fu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de 60yIatMUSIDVKPwsIGBSkAooZO3Uc0U8tJxlWAJteL9rf0 Cancel-Lock: sha1:M6mPM5UZfDA9URE7CI9lpIccJwQ= sha256:WbPfsfDhkUqMpUdb9rA/66MTUv38js8xKMChSByd9f8= X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved. Distribution through any means other than regular usenet channels is forbidden. It is forbidden to publish this article in the Web, to change URIs of this article into links, and to transfer the body without this notice, but quotations of parts in other Usenet posts are allowed. X-No-Archive: Yes Archive: no X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some services to mirror the article in the web. But the article may be kept on a Usenet archive server with only NNTP access. X-No-Html: yes Content-Language: en-US Bytes: 1924 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