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: 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: References: Date: Sat, 2 Feb 2013 22:58:46 +1100 Subject: Re: Floating point calculation problem From: Chris Angelico 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Sat, Feb 2, 2013 at 10:51 PM, Schizoid Man 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