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


Groups > comp.lang.python > #38075

Re: Floating point calculation problem

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!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.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'append': 0.07; 'python': 0.09; 'highlighting': 0.09; 'integer,': 0.09; 'porting': 0.09; 'snippet': 0.09; 'sat,': 0.15; '2.7.3': 0.16; 'ah,': 0.16; 'comparison.': 0.16; 'easier.': 0.16; 'eval': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'solver': 0.16; 'wrote:': 0.17; 'thanks,': 0.18; 'input': 0.18; '(or': 0.18; 'feb': 0.19; 'trying': 0.21; 'subject:problem': 0.22; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'wrote': 0.26; 'message-id:@mail.gmail.com': 0.27; 'post': 0.28; 'decimal': 0.29; 'routine': 0.29; 'probably': 0.29; "i'm": 0.29; 'that.': 0.30; 'code': 0.31; 'point': 0.31; 'mac': 0.32; 'running': 0.32; 'problem': 0.33; 'to:addr:python-list': 0.33; 'that,': 0.34; "can't": 0.34; 'received:google.com': 0.34; 'along': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'but': 0.36; "i'll": 0.36; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'speak': 0.38; 'to:addr:python.org': 0.39; 'think': 0.40; 'your': 0.60; 'different': 0.63; 'appreciation': 0.65; 'obvious': 0.71; '2013': 0.84; 'demonstrates': 0.84; 'difference.': 0.84; 'understood.': 0.84; 'pc,': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=LxD3dV5dbgEZ/LJ4pgbWKh42JKZRtkICAEm94jeJLP0=; b=xRE6ETb/9PUiPbn2hYwxwIlnZ38a/zE3gQN7QAit1iGzG/GxgOcCIBqzKf9VXx/HHl Qu/CS4it19FAQ5+oliB6iYrbddZdJ0WN33Y5MTJMvM95XHVHHN0XI1zzA/OFMSGScj6R t6/S31JxCqgvzp3MY9Hye+8sAbRry+GbGaeTigp9+xwcE69kwBCQi4825nfbNJWHSNfv yc19QF5npTnl+wffWCUhYlI9YyZVuXvGgU91lyjzNcVx0LEGp9grfFnueHHAg+HFS9wo Z+5DOBZa1YmyEDF7Do6lq809Iv6ufzt6lDkWQwxKD8EM5Qf2N/NMZsVolQR/pJ2Uyth8 ARJA==
MIME-Version 1.0
X-Received by 10.224.44.197 with SMTP id b5mr15993667qaf.65.1359806326368; Sat, 02 Feb 2013 03:58:46 -0800 (PST)
In-Reply-To <keiujd$o71$1@dont-email.me>
References <keipl5$kif$1@dont-email.me> <mailman.1289.1359801291.2939.python-list@python.org> <keisev$7v1$1@dont-email.me> <mailman.1291.1359804020.2939.python-list@python.org> <keitk2$hln$1@dont-email.me> <mailman.1292.1359805138.2939.python-list@python.org> <keiujd$o71$1@dont-email.me>
Date Sat, 2 Feb 2013 22:58:46 +1100
Subject Re: Floating point calculation problem
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1293.1359806334.2939.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1359806334 news.xs4all.nl 6907 [2001:888:2000:d::a6]:39808
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38075

Show key headers only | View raw


On Sat, Feb 2, 2013 at 10:51 PM, Schizoid Man <schiz_man@21stcentury.com> wrote:
>> If your input has no decimal point in it, eval (or input) will return
>> an integer, not a float. Other than that, I can't see any obvious
>> reason for there to be a difference. Can you put together a simple
>> script that demonstrates the problem and post it, along with the exact
>> input that you're giving it, and the different outputs?
>
>
> Understood. I'm trying to learn Python by porting an ODE solver I wrote over
> from C#, so what I'll do is break down the routine and append a small code
> snippet highlighting the difference.

Thanks, I think I can speak for all of us in expressing appreciation
for that effort! It makes the job so much easier.

> I know this is probably redundant but Python 2.7.3 is running on a Mac and
> 3.3.0 on a PC, so it's not exactly an apples-v-apples comparison.

Ah, there may well be something in that. Definitely post the code and
outputs; chances are someone'll spot the difference.

ChrisA

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


Thread

Floating point calculation problem "Schizoid Man" <schiz_man@21stcentury.com> - 2013-02-02 10:27 +0000
  Re: Floating point calculation problem Chris Angelico <rosuav@gmail.com> - 2013-02-02 21:34 +1100
    Re: Floating point calculation problem "Schizoid Man" <schiz_man@21stcentury.com> - 2013-02-02 11:14 +0000
      Re: Floating point calculation problem Chris Angelico <rosuav@gmail.com> - 2013-02-02 22:20 +1100
        Re: Floating point calculation problem "Schizoid Man" <schiz_man@21stcentury.com> - 2013-02-02 11:34 +0000
          Re: Floating point calculation problem Chris Angelico <rosuav@gmail.com> - 2013-02-02 22:38 +1100
            Re: Floating point calculation problem "Schizoid Man" <schiz_man@21stcentury.com> - 2013-02-02 11:51 +0000
              Re: Floating point calculation problem Chris Angelico <rosuav@gmail.com> - 2013-02-02 22:58 +1100
                Re: Floating point calculation problem "Schizoid Man" <schiz_man@21stcentury.com> - 2013-02-02 15:48 +0000
                Re: Floating point calculation problem "Schizoid Man" <schiz_man@21stcentury.com> - 2013-02-02 15:54 +0000
                Re: Floating point calculation problem Chris Angelico <rosuav@gmail.com> - 2013-02-03 03:00 +1100
                Re: Floating point calculation problem Michael Torrie <torriem@gmail.com> - 2013-02-02 11:19 -0700
                Re: Floating point calculation problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-03 12:25 +1100
                Re: Floating point calculation problem Dave Angel <d@davea.name> - 2013-02-02 21:20 -0500
                Re: Floating point calculation problem Michael Torrie <torriem@gmail.com> - 2013-02-02 21:22 -0700
              Re: Floating point calculation problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-02 23:11 +1100
      Re: Floating point calculation problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-02 22:45 +1100
        Re: Floating point calculation problem "Schizoid Man" <schiz_man@21stcentury.com> - 2013-02-02 11:50 +0000
  Re: Floating point calculation problem Chris Rebert <clp2@rebertia.com> - 2013-02-02 02:47 -0800
  Re: Floating point calculation problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-02 23:05 +1100

csiph-web