Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#206 Allow easy comparisons with 0 (zero)

closed
sarnold75
5
2005-08-30
2005-08-16
No

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.)

Discussion

  • Logged In: YES
    user_id=75003

    Assigned to creator/maintainer

     
    • labels: --> math :: bignum
    • assigned_to: nobody --> sarnold75
     
  • sarnold75
    sarnold75
    2005-08-27

    • status: open --> pending
     
  • sarnold75
    sarnold75
    2005-08-27

    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.

     
  • sarnold75
    sarnold75
    2005-08-30

    • status: pending --> closed