Tk Library Source Code

View Ticket
Login
Ticket UUID: 1261101
Title: Allow easy comparisons with 0 (zero)
Type: RFE Version: None
Submitter: escargo Created on: 2005-08-16 16:32:41
Subsystem: math :: bignum Assigned To: sarnold75
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2005-08-30 23:33:12
Resolution: Closed By: sarnold75
    Closed on: 2005-08-30 16:33:12
Description:
In ::math::bignum, most of the comparison functions
(except for iszero) require two bignums as inputs.
However, there are many cases where the comparison is
between 0 and some number.

Right now, you need to make a bignum of 0 to do the
comparison. It should be possible to special case the
comparisons so that the comparison is against the
literal 0 would be permitted.

Another possibility would be to predefine two useful
numbers as bignum constants: 0 and 1. With those two
predefined, a lot of tests would be able to avoid
having to create them. (Other powers of two (2^1, 2^2,
2^3, ...2^64) would be potentially useful as well, but
perhaps less worth the overhead.)
User Comments: sarnold75 added on 2005-08-28 00:52:29:
Logged In: YES 
user_id=1160227

The two constants '0' and '1' have been defined in each
high-level proc.
The test suite was improved with new tests, including tests
not devoted to this evolution. (division, modulo, remainder...)

A hook (_treat) was created to handle the constants :
   _treat var ?var ...?

Replace each variable named 'var' by the internal
representation if it is equal to one of the constants : '0'
or '1'. If the variable is already in internal repr, nothing
is done.

Please close this feature request, or tell the issues, if
they are some.

andreas_kupries added on 2005-08-23 23:53:11:
Logged In: YES 
user_id=75003

Assigned to creator/maintainer