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


Groups > comp.lang.python > #89854

Re: Converting 5.223701009526849e-05 to 5e-05

Path csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!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.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; ';-)': 0.03; 'integral': 0.09; 'string;': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'stored': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'simplest': 0.16; 'storing': 0.16; 'subject:Converting': 0.16; 'types,': 0.16; 'wrote:': 0.18; 'library': 0.18; 'bit': 0.19; "python's": 0.19; '(the': 0.22; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'integer': 0.24; 'cc:2**0': 0.24; 'mention': 0.26; 'values': 0.27; 'header:In- Reply-To:1': 0.27; 'point': 0.28; 'thus': 0.29; 'absolute': 0.30; 'bigger': 0.30; 'message-id:@mail.gmail.com': 0.30; 'bunch': 0.31; 'lot.': 0.31; 'maybe': 0.34; 'received:google.com': 0.35; 'there': 0.35; 'are,': 0.36; 'doing': 0.36; 'should': 0.36; 'two': 0.37; 'being': 0.38; 'whatever': 0.38; 'pm,': 0.38; 'how': 0.40; 'first': 0.61; 'name': 0.63; 'more': 0.64; 'different': 0.65; 'capable': 0.67; 'dollar': 0.74; '2015': 0.84; 'amazed': 0.84; 'complex,': 0.84; 'rexx,': 0.84; 'to:none': 0.92
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=jYPGQ6I9/TCMTmyT3VXoegr7cGMv44roZx06pEte1Eg=; b=JyVjkJYUmddRCLc//AhT8HV3Qqk61usafiwUJ/csyNi9GGpw3KhaygcTxKayoXhEkG fEGcvZB0eauPwDHK4v2IyhF8DfdWG9f7zN/KkHeDugeIZVPXKwE2+yXXfjWgzl8DIko5 5ujh//vPp//zp05mKg4sy/cfl9Ig3LdYPMOCW6j3ZOfrcrfFR6d3EIc417439YTeCoQh d43KHdS3xLIvwvT5BdQsLuoX1/qRl683EJP3rREnbu4y8n1l/G7pZHxujiZhA7lfCj4s nTkZdi6Ixx5zUG+gMsmP8NuwRa7SAU0VoLnU3QEHp/1WEEv4j2JEiL7iNwy/0OgpIaCw 7h+g==
MIME-Version 1.0
X-Received by 10.107.160.202 with SMTP id j193mr22261962ioe.43.1430650645834; Sun, 03 May 2015 03:57:25 -0700 (PDT)
In-Reply-To <87egmykmhe.fsf@Equus.decebal.nl>
References <87vbgakrlr.fsf@Equus.decebal.nl> <mailman.52.1430642455.12865.python-list@python.org> <87mw1mkoc5.fsf@Equus.decebal.nl> <mailman.59.1430646707.12865.python-list@python.org> <87egmykmhe.fsf@Equus.decebal.nl>
Date Sun, 3 May 2015 20:57:25 +1000
Subject Re: Converting 5.223701009526849e-05 to 5e-05
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.20+
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.61.1430650648.12865.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1430650648 news.xs4all.nl 2850 [2001:888:2000:d::a6]:54236
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:89854

Show key headers only | View raw


On Sun, May 3, 2015 at 8:02 PM, Cecil Westerhof <Cecil@decebal.nl> wrote:
>>> If the absolute value is bigger as 0 and smaller as 1, it should be
>>> a float. ;-)
>>
>> Or maybe a fractions.Fraction, or a decimal.Decimal, or a complex,
>> or maybe a RXSTRING or a Gmp.mpf! There's more than one way to store
>> a number...
>
> Oops. :'-(
> I still have to learn a lot.

We all do :) Not all of those are Python types, incidentally. The
first three are, although 'complex' is a bit of a cheat (a complex
number is stored as two floats, so a complex with an imag of 0 is
virtually identical to a straight float); RXSTRING is the one and only
data type in REXX, and is (as the name suggests) stored as a string;
and Gmp.mpf is Pike's data type for a floating-point value stored
using the GNU Multiprecision library (gmp), and is thus capable of
arbitrary precision storage just like Python's own integer type. And
of course, the old fogeys among us know a bunch more ways to store
floating point values - not to mention all the ways of storing *fixed*
point values (the simplest being to just store an integer with the
number of hundredths of whatever it is you have - eg storing a dollar
amount as an integral number of cents). You'd be amazed how many
different ways there are of doing the same thing!

ChrisA

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


Thread

Converting 5.223701009526849e-05 to 5e-05 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-03 10:11 +0200
  Re: Converting 5.223701009526849e-05 to 5e-05 Ben Finney <ben+python@benfinney.id.au> - 2015-05-03 18:40 +1000
    Re: Converting 5.223701009526849e-05 to 5e-05 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-03 11:22 +0200
      Re: Converting 5.223701009526849e-05 to 5e-05 Chris Angelico <rosuav@gmail.com> - 2015-05-03 19:51 +1000
        Re: Converting 5.223701009526849e-05 to 5e-05 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-03 12:02 +0200
          Re: Converting 5.223701009526849e-05 to 5e-05 Chris Angelico <rosuav@gmail.com> - 2015-05-03 20:57 +1000
      Re: Converting 5.223701009526849e-05 to 5e-05 Dave Angel <davea@davea.name> - 2015-05-03 07:34 -0400
  Re: Converting 5.223701009526849e-05 to 5e-05 Ben Finney <ben+python@benfinney.id.au> - 2015-05-03 18:48 +1000
    Re: Converting 5.223701009526849e-05 to 5e-05 Alexander Blinne <news@blinne.net> - 2015-05-07 10:00 +0200

csiph-web