Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #66357

Re: Question on using FP numbers in python 2

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'debugging': 0.07; 'subject:Question': 0.07; 'subject:using': 0.09; 'cc:addr:python- list': 0.11; 'python': 0.11; 'bug': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'garbage': 0.16; 'segfault': 0.16; 'subject:python': 0.16; 'sat,': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'code.': 0.18; 'feb': 0.22; 'otherwise,': 0.22; 'cc:addr:python.org': 0.22; 'instance,': 0.24; 'issue,': 0.24; "shouldn't": 0.24; 'cc:2**0': 0.24; 'sort': 0.25; "i've": 0.25; '15,': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'decimal': 0.31; 'occurs': 0.31; 'subject:numbers': 0.31; 'there.': 0.32; 'probably': 0.32; 'run': 0.32; "i'd": 0.34; 'something': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'pm,': 0.38; 'anything': 0.39; 'worry': 0.60; 'hope': 0.61; 'first': 0.61; 'between': 0.67; 'to:none': 0.92; 'technique': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=ENSK9UE41KvqpQ+7b/nXDpVNBbeMVOOy3YmJCGcDaAw=; b=IuQgM/klqMI1F2Ls6spHNO4vWQw2gtNVxfqqiYVwrdRJKDYfDkC7snjLZayW9RjEQG a9WucC0ETGHoSQ7w28P/9Hob75/LV/yhQSYtwcAUZPEFy0g2oC+RB7phg++IpvxDOzr3 u0P72FgBe0vv9uHTZ8sl5iVSeRXkchxQ99kV9QQSXEyY6ro+oL4N/7AIHYqiafXmQiH/ 5k8USeDSXAj+2w2UzUdl2dfFnODw8zCeqCXFZWrIzoWR7PhKAbOEPDnQqhgrTcZoYMI6 MSpw31+PX5CEzU4lRPphkpsu5D5lRiWvVqBgZ6geifzBDw9uTvI37twkfh4VDVXtIn6k M0og==
MIME-Version 1.0
X-Received by 10.68.129.5 with SMTP id ns5mr13061749pbb.147.1392435583919; Fri, 14 Feb 2014 19:39:43 -0800 (PST)
In-Reply-To <201402142225.59647.gheskett@wdtv.com>
References <201402142225.59647.gheskett@wdtv.com>
Date Sat, 15 Feb 2014 14:39:43 +1100
Subject Re: Question on using FP numbers in python 2
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.6956.1392435587.18130.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1392435587 news.xs4all.nl 2856 [2001:888:2000:d::a6]:47130
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:66357

Show key headers only | View raw


On Sat, Feb 15, 2014 at 2:25 PM, Gene Heskett <gheskett@wdtv.com> wrote:
> Is there something I can search for and fix in some python code that is
> giving me bogus answers that get good only when there is a valid digit to
> the left of the decimal point?
>

Interesting. I'd look for anything that mixes very large and very
small numbers, first off. Otherwise, just follow the standard
debugging technique of stripping code out of your program and seeing
if the problem's still there. Continue until you have the barest
minimum, and hope hope hope that it's a Bohr bug and not a Heisenbug!

If it really is a floating point issue, you probably don't have to
worry about, for instance, a segfault that happens when a garbage
collection run occurs between this statement and that statement...
yes, I've had to deal with that sort of thing! (Turned out to be a
refcount bug in C code. When the gc ran, something got disposed of
that shouldn't have.)

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Question on using FP numbers in python 2 Chris Angelico <rosuav@gmail.com> - 2014-02-15 14:39 +1100

csiph-web