[Issue 8784] std.bigint.BigInt.infinity

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 9 03:33:48 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8784


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug at yahoo.com.au
         Resolution|                            |INVALID


--- Comment #1 from Don <clugdbug at yahoo.com.au> 2012-10-09 03:09:45 PDT ---
For floating point numbers of limited size, you need infinity for overflow, and
you can possibly also follow IEEE in generating it for division by zero.
It's more a necessary evil than a desirable feature.

But for BigInt it is quite different. There is no BigInt operation which
results in an overflow, and division by zero is an error. And infinity is a
really, really annoying special case, both in terms of implementation (where it
has a performance penalty) and from the user's side. You have to sacrifice some
important guarantees, eg
    assert(x + 1 != x);
is not always true for any type which includes infinity.
That sacrifice doesn't happen for IEEE floating point, since already
   x + 1 == x
for any large number such as real.max / 2, due to reduced precision.
But for BigInt, it's a huge price to pay.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list