A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-November/018410.html below:

[Python-Dev] Re: Future division detection

[Python-Dev] Re: Future division detectionGreg Ewing greg@cosc.canterbury.ac.nz
Thu, 08 Nov 2001 12:29:24 +1300 (NZDT)
com-nospam@ccraig.org (Christopher A. Craig):

> I would like
> to have an rational cast back to a integer iff (1) the denominator is 1
> and (2) future division is active.
> 
> If I don't check (2) then I get the situation that if future division
> is inactive then `(rational('1/3')*3)/5` would yield 0 instead of
> 1/5.

I think what you're asking is impossible. Remember that "future
division is active" is a compile-time, per-module notion. Some
parts of the code may be doing old-style divisions and other
parts new-style divisions. In the above example, at the time when
you do the multiplication by 3, there is no way of knowing
what sort of division might be performed on the result at
some later time, maybe in another module where the
future division option was set differently.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4