floor() function and mathematical integers - the Scheme approach

Dennis E. Hamilton orcmid at email.com
Thu May 17 14:38:52 EDT 2001


Thanks to the lead from Greg Ewing, I see that Scheme has an approach that
is along the lines I favor.  It is defined in section 6.2 of the Revised**5
Report on the Algorithmic Language Scheme.

	http://www.schemers.org/Documents/Standards/#ieee1178

I am very interested in how this works out in practice as an aid to people
working with numbers.  I resonate very strongly with the motivation for the
Scheme approach and the care with which implementation and representation of
abstractions (i.e., mathematical entities) are addressed.

For the specific case of floor():  In Scheme if the operand is noted as
inexact, the result will be also. If the operand is noted to be exact, the
result will be so long as it can be represented exactly.  My sense is that
most Schemes can always represent the exact result.  There is also provision
for exceptions to be thrown, when the implementation isn't comprehensive
enough to handle some cases.

This strikes me as very valuable for maintaining user confidence and also
allowing people to work their way into the intricacies of numerical
computation one toe at a time.

-- Dennis

-----Original Message-----
From: python-list-admin at python.org
[mailto:python-list-admin at python.org]On Behalf Of Tim Peters
Sent: Wednesday, May 16, 2001 18:41
To: Python-list
Subject: RE: floor() function and mathematical integers

[ ... ]

Remains unclear to me:  can you define precisely what it is you think
floor()
should do?  Feel free to assume 754 arithmetic.  BTW, note that Python isn't
making up its own meaning for floor(); math.floor() inherits the function of
the same name from the platform C library, and the C std mandates its
behavior.  When explaining why it returns "large" floats unchanged, I was
explaining why the C committee chose to do that.  Indeed, I don't know of
any
language that defines floor() in any other way.

fighting-the-universe-is-a-low-success-hobby<wink>-ly y'rs  - tim






More information about the Python-list mailing list