Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx02.iad01.newshosting.com!newshosting.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.078 X-Spam-Evidence: '*H*': 0.85; '*S*': 0.00; 'python': 0.08; 'binary': 0.13; 'wrote:': 0.15; 'abhishek': 0.16; 'two.': 0.16; 'cc:addr :python-list': 0.16; 'pm,': 0.16; 'int': 0.19; 'cc:2**0': 0.21; 'cc:no real name:2**0': 0.22; "doesn't": 0.22; 'header:In-Reply- To:1': 0.22; 'numeric': 0.23; 'string': 0.26; 'cc:addr:python.org': 0.30; 'precision': 0.30; 'types.': 0.30; 'header:User-Agent:1': 0.34; '...': 0.34; 'received:192': 0.38; 'subject:: ': 0.38; 'two': 0.38; 'received:192.168.1': 0.39; 'data': 0.39; 'either': 0.39; 'might': 0.39; 'back': 0.63; 'header :Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'forth': 0.77; '02:59': 0.84; 'complex,': 0.84; 'limitations,': 0.84 Date: Wed, 03 Aug 2011 15:15:56 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11 MIME-Version: 1.0 To: Abhishek Jain Subject: Re: Equality check References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:BqkOTtGf+Sq6fOypa/XRnEWFLauBeTzdH1HOC6zZJBZ /c4FA21DS/XYoTfF8KVeGXyDDE/8CWeU0R5niMGq+OV/ur0o4t qySl2N/6ttjhE5YTEx7ZJD773lo6kg+aES+m4eSm+dM3C9JSq0 zt8Z928+gT/4DqDeMsgbnaSNfzNj6b8epd5TgI6kfmhxV47qtX jzGkX5M6z98LrtTeXD4Ng== Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: davea@ieee.org 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1312399277 news.xs4all.nl 23946 [2001:888:2000:d::a6]:40289 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10823 On 01/-10/-28163 02:59 PM, Abhishek Jain wrote: > How to check equality of two nos. in python > Python doesn't have numbers, it has various numeric data types. If all you're concerned with are int types, then just use the obvous: if a == b: dosomething.... If one or both might be floats, you have to deal with the likelihood that one or both may have quantization error, either caused by computational approximations, precision limitations, or conversion back and forth between string and internal binary representation. If one is in Decimal, you have to mostly deal with the first two. If one is complex, ... DaveA