Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #101173
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Trailing zeros of 100! |
| Date | Sun, 3 Jan 2016 08:57:36 +1100 |
| Lines | 27 |
| Message-ID | <mailman.184.1451771860.11925.python-list@python.org> (permalink) |
| References | <52ccbc4b-616b-4186-8802-97aaa5b0d9af@googlegroups.com> <CAHzaPEOzP+DZDHOV7s1tDA0AUNhFdBUJKZWCJ5W9F8ec6aH-JA@mail.gmail.com> <mailman.162.1451745109.11925.python-list@python.org> <n68s1t$ke9$1@news.albasani.net> <mailman.172.1451753180.11925.python-list@python.org> <n68vgc$qi6$1@news.albasani.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de EkENQHKtoW6v50GUuDspwAmYWw6Q9d3ZVlAHGzcMoDLg== |
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'float': 0.05; 'cc:addr:python-list': 0.09; 'integer,': 0.09; 'rounding': 0.09; 'work"': 0.09; 'jan': 0.11; '"should': 0.16; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'multiples': 0.16; 'nearest': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'rounding.': 0.16; 'test".': 0.16; 'thereabouts.': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'trying': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'van': 0.26; 'message- id:@mail.gmail.com': 0.27; '(maybe': 0.29; 'normally': 0.30; 'operations': 0.31; "can't": 0.32; 'point': 0.33; 'worked': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'should': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'expect': 0.37; 'received:209': 0.38; 'log': 0.38; 'represent': 0.38; 'end': 0.39; 'why': 0.39; 'test': 0.39; 'does': 0.39; 'your': 0.60; 'between': 0.65; 'sound': 0.72; '"yes,': 0.84; '17:09': 0.84; 'calculations': 0.84; 'chrisa': 0.84; 'to:none': 0.91 |
| 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=RkXziwOVO/CIBYuOS11rM1NHSGFkCl0d3tGwTBKduco=; b=uNwD/5VsKW7hI0EnlQSeM2dN4T6BqY8crrEmgDvPBiqT1LcPjo6wP/cpwdzk57MfrZ fN6Q5ApuEIsh4pY27cZG+wWJEWXGy8w1uSV3VSUakjBAYH3klM843A1QGvQvc95HkWnV CGaeb/pcutxUfxIgaByYAAcqBfD80KMuk15N3XRxVic9zzTrBadzqgoCgFW77IxcU3Gt YK/LVIQxJJWgvB5gwnMROsypozS34mWV0Z+d72IARrL5MrjuQAf/WqMbFke2KqrwhbXE 3REqkgKwwlo5vgLe2rc5+4pE8qJ6932jICBcogvwg+WB8Km6gyXGi3hTKSylo5WOm+FJ fS4g== |
| X-Received | by 10.107.40.76 with SMTP id o73mr14667359ioo.157.1451771856849; Sat, 02 Jan 2016 13:57:36 -0800 (PST) |
| In-Reply-To | <n68vgc$qi6$1@news.albasani.net> |
| 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> |
| Xref | csiph.com comp.lang.python:101173 |
Show key headers only | View raw
On Sun, Jan 3, 2016 at 3:56 AM, Robin Koch <robin.koch@t-online.de> wrote: > Am 02.01.2016 um 17:09 schrieb Tony van der Hoff: >> >> On 02/01/16 16:57, Robin Koch wrote: >>> >>> sum([int(0.2**k*n) for k in range(1, int(log(n, 5))+1)]) >> >> >> But did you actually test it? > > > Yes, should work for n >= 1. > > Why do you ask? Your "should work" does not sound good as a response to "actually test". Normally I would expect the response to be "Yes, and it worked for me" (maybe with a log of an interactive session). Floating point can't represent every integer, and above 2**53 you end up able to represent only those which are multiples of ever-increasing powers of two; 100! is between 2**524 and 2**525, so any float operations are going to be rounding off to the nearest 2**471 or thereabouts. That's... a lot of rounding. That's like trying to calculate whether pi is rational, but basing your calculations on the approximation 3.14. :) ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Trailing zeros of 100! katye2007@gmail.com - 2016-01-02 03:49 -0800
Re: Trailing zeros of 100! David <bouncingcats@gmail.com> - 2016-01-02 23:19 +1100
Re: Trailing zeros of 100! katye2007@gmail.com - 2016-01-02 04:34 -0800
Re: Trailing zeros of 100! Vlastimil Brom <vlastimil.brom@gmail.com> - 2016-01-02 13:44 +0100
Re: Trailing zeros of 100! "yehudak ." <katye2007@gmail.com> - 2016-01-02 15:14 +0200
Re: Trailing zeros of 100! Robin Koch <robin.koch@t-online.de> - 2016-01-02 16:57 +0100
Re: Trailing zeros of 100! Tony van der Hoff <tony@vanderhoff.org> - 2016-01-02 17:09 +0100
Re: Trailing zeros of 100! Robin Koch <robin.koch@t-online.de> - 2016-01-02 17:56 +0100
Re: Trailing zeros of 100! Bernardo Sulzbach <mafagafogigante@gmail.com> - 2016-01-02 15:24 -0200
Re: Trailing zeros of 100! Chris Angelico <rosuav@gmail.com> - 2016-01-03 08:57 +1100
Re: Trailing zeros of 100! Robin Koch <robin.koch@t-online.de> - 2016-01-03 01:02 +0100
Re: Trailing zeros of 100! Ben Finney <ben+python@benfinney.id.au> - 2016-01-03 11:20 +1100
Re: Trailing zeros of 100! srinivas devaki <mr.eightnoteight@gmail.com> - 2016-01-03 07:16 +0530
Re: Trailing zeros of 100! Tony van der Hoff <tony@vanderhoff.org> - 2016-01-03 11:53 +0100
Re: Trailing zeros of 100! Joel Goldstick <joel.goldstick@gmail.com> - 2016-01-02 09:57 -0500
Re: Trailing zeros of 100! Vlastimil Brom <vlastimil.brom@gmail.com> - 2016-01-02 16:24 +0100
Re: Trailing zeros of 100! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-01-02 15:30 +0000
Re: Trailing zeros of 100! Robin Koch <robin.koch@t-online.de> - 2016-01-02 16:54 +0100
Re: Trailing zeros of 100! Peter Otten <__peter__@web.de> - 2016-01-02 18:18 +0100
Re: Trailing zeros of 100! Tim Chase <python.list@tim.thechases.com> - 2016-01-02 10:33 -0600
Re: Trailing zeros of 100! "yehudak ." <katye2007@gmail.com> - 2016-01-02 19:34 +0200
Re: Trailing zeros of 100! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-01-02 17:44 +0000
Re: Trailing zeros of 100! Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-03 00:36 +0100
Re: Trailing zeros of 100! Serhiy Storchaka <storchaka@gmail.com> - 2016-01-02 20:28 +0200
Re: Trailing zeros of 100! Vlastimil Brom <vlastimil.brom@gmail.com> - 2016-01-02 19:29 +0100
Re: Trailing zeros of 100! "yehudak ." <katye2007@gmail.com> - 2016-01-02 22:02 +0200
Re: Trailing zeros of 100! "yehudak ." <katye2007@gmail.com> - 2016-01-02 22:09 +0200
Re: Trailing zeros of 100! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-01-02 21:25 +0000
Re: Trailing zeros of 100! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-01-02 21:26 +0000
csiph-web