Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!news2.euro.net!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.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'indicating': 0.05; 'python': 0.09; '22,': 0.09; '2.7.3': 0.16; 'build.': 0.16; 'equal.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'least,': 0.16; 'wrote:': 0.17; '(or': 0.18; 'windows': 0.19; 'feb': 0.19; 'skip:p 30': 0.20; '(on': 0.22; 'are.': 0.22; 'subject:problem': 0.22; 'header:In-Reply-To:1': 0.25; 'values': 0.26; 'am,': 0.27; 'first,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'run': 0.28; 'fri,': 0.30; 'code': 0.31; 'point': 0.31; 'mac': 0.32; 'int': 0.33; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'said,': 0.35; 'received:209.85.220': 0.35; 'sometimes': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'compare': 0.36; "wasn't": 0.36; 'should': 0.36; 'two': 0.37; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'there,': 0.38; 'to:addr:python.org': 0.39; 'your': 0.60; 'different': 0.63; '2013': 0.84; 'replicate': 0.84 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=RiRN+C2izfNQaHJEIVzG10Qkbb/CL6zuNALx8Kk3CNY=; b=BZvydvaqIM5BhJwxaGz2aov31pARq2FmEjYYDC9O/BJ+YlymnLDI2ng4y9VK6hcvC5 9YtyYw6xpebJfkpTZG8j8Sp5jDp4zScwy0GvNWWK+I5Dw335P4jIzVrPS3XnVzJUV3fU faU2+vYtDf7xQbVp/pVcC1jvsvfEtB8zuc0Q7NZPlz+4BzmiLKwEjAkOwZpgku8Rlnl+ OPa1ROD5xLouPF72LhHmkcb1cPVQBZUoWe3DVLzd+sdaJrV4jgnMNfqvJKFzvShaBX+3 X7xYpj/BpoiPotVQmTnR4O7eD+CWeBrj+3nIVV6bwawsF/VHegFtI56ZIucIDgxVu/ez alng== MIME-Version: 1.0 X-Received: by 10.52.29.209 with SMTP id m17mr23371475vdh.111.1361479560634; Thu, 21 Feb 2013 12:46:00 -0800 (PST) In-Reply-To: References: Date: Fri, 22 Feb 2013 07:46:00 +1100 Subject: Re: Confusing math 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: 1361479569 news.xs4all.nl 6917 [2001:888:2000:d::a6]:46870 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39455 On Fri, Feb 22, 2013 at 6:33 AM, Schizoid Man wrote: > Hi there, > > I run the following code in Python 3.3.0 (on a Windows 7 machine) and Python > 2.7.3 on a Mac and I get two different results: > > result1.append(math.pow(a,b)) > result2.append(a**b) First, are you aware that ** will return int (or sometimes long on 2.7.3), while math.pow() will return a float? That may tell you why you're seeing differences. That said, though, I wasn't able to replicate your result using 2.7.3 and 3.3.0 both on Windows - always 9183, indicating 618 of the powers are considered equal. But in theory, at least, what you're seeing is that 37 of them compare different in floating point on your Mac build. Something to consider: print(set(result1)-set(result2)) That should tell you what the extra values are. ChrisA