Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #101946
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Shiyao Ma <i@introo.me> |
| Newsgroups | comp.lang.python |
| Subject | How to simulate C style integer division? |
| Date | Thu, 21 Jan 2016 16:39:18 +0800 |
| Lines | 22 |
| Message-ID | <mailman.139.1453365561.15297.python-list@python.org> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de im1cTNsPIg5SNOce0chC8wo3eO49eHHS2AUZhXS+8+OA== |
| Return-Path | <i@introo.me> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.043 |
| X-Spam-Evidence | '*H*': 0.92; '*S*': 0.00; 'else:': 0.03; 'subject:How': 0.09; 'python3.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'simulate': 0.16; 'integer': 0.18; '>': 0.18; 'math': 0.20; 'import': 0.24; "i've": 0.25; 'message-id:@mail.gmail.com': 0.27; 'division': 0.29; 'way?': 0.29; 'received:google.com': 0.35; 'received:74.125.82': 0.35; 'too': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'hi,': 0.38; 'to:addr:python.org': 0.40; 'url:me': 0.64; '8bit%:100': 0.70; 'received:74.125.82.47': 0.84; 'skip:\xe5 40': 0.84; 'to:name:python': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=introo-me.20150623.gappssmtp.com; s=20150623; h=mime-version:date:message-id:subject:from:to:content-type; bh=+ddTMUXt2E+Yec/UXo6kHVOoG4NAsdQrkgVpxGgK01I=; b=fgWX/T8zf1rYpGnWMl65xsB8y1jUmVCBfuD5KqVJVM8FeQeO6dyjGK9VQOAgNAR/1D 0nmT1/m5KSeTsrnLTqKG1t/nvSTp1R1HioNDO/I/xb98NxcOkWeBgoz+55dU01wSsfbk nl9dnbcCy7mGkqBiPpj+n0tizjavnMOuCq+Kkdt+2g4gkOjchPY3c6heVfbhZyK0GuO6 3A6Qlr1WzzZWCn6ktXC70c4end14ad7wmuJ4TDrIUb66TQ4Z+YKE4lBgiK5Fgi7KFybS ReI6DmYWTwlRlSxhLXnnMbPxH9LlNk0asg3oO9irqvF7YoNGaDKK5jOshsJDTSZRwvZi w+ug== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=+ddTMUXt2E+Yec/UXo6kHVOoG4NAsdQrkgVpxGgK01I=; b=iTalwcCyISf/tIAyYDeOBWCjx4X/PLToXlRZiZA1XK5HvAK7fIUzzYhO6hbLV/Wq7j tCVuz5z8PMX/umiuaEwpJfs+s1vQd+VQVHer9x4xUnmqUw/C5uiIWpkVjzGQjfpsrnWy Rh32FeV/9/ZpNNlM5oiLuN5HnMsvuJybOG9bOUfH+l9ctqTmN/eJFWvTUbfe0mPcgKh+ UZaDWTSfEEopF6JYXTYQ+fenUPsIEZdcKTV/6ydON8CV0LwzVWNpo+onKa+gyOjroY5Y TwuDgjJxZeTiIGqNFoaBmmEksoyDnEWppgRhRvPszBmBwL1zEmRTqmFLSJauN3yBkT2N R4oQ== |
| X-Gm-Message-State | ALoCoQkTqL+Jz/ZykygIJKOcQv5FnxWYwi1vXJovx+PCMRvkj6+z/6IMkGaEzx2kbklgUePoGp9GXN8krHMWslCQUHn1hXNjRw== |
| X-Received | by 10.194.235.137 with SMTP id um9mr46528450wjc.146.1453365558827; Thu, 21 Jan 2016 00:39:18 -0800 (PST) |
| X-Originating-IP | [143.89.244.107] |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.20+ |
| 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:101946 |
Show key headers only | View raw
Hi, I wanna simulate C style integer division in Python3. So far what I've got is: # a, b = 3, 4 import math result = float(a) / b if result > 0: result = math.floor(result) else: result = math.ceil(result) I found it's too laborious. Any quick way? -- 吾輩は猫である。ホームーページはhttps://introo.me <http://introo.me>。
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
How to simulate C style integer division? Shiyao Ma <i@introo.me> - 2016-01-21 16:39 +0800
Re: How to simulate C style integer division? "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> - 2016-01-21 08:44 +0000
Re: How to simulate C style integer division? Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-01-21 10:59 +0200
Re: How to simulate C style integer division? Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-01-21 12:13 +0200
Re: How to simulate C style integer division? Grobu <snailcoder@retrosite.invalid> - 2016-01-22 02:59 +0100
Re: How to simulate C style integer division? Steven D'Aprano <steve@pearwood.info> - 2016-01-22 14:48 +1100
Re: How to simulate C style integer division? Grobu <snailcoder@retrosite.invalid> - 2016-01-23 13:04 +0100
Re: How to simulate C style integer division? Grobu <snailcoder@retrosite.invalid> - 2016-01-23 13:52 +0100
Re: How to simulate C style integer division? Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-01-23 17:07 +0200
Re: How to simulate C style integer division? Grobu <snailcoder@retrosite.invalid> - 2016-01-23 17:44 +0100
csiph-web