[Issue 8784] std.bigint.BigInt.infinity

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 9 05:25:51 PDT 2012


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



--- Comment #3 from Don <clugdbug at yahoo.com.au> 2012-10-09 05:01:47 PDT ---
(In reply to comment #2)
> (In reply to comment #1)
> 
> > But for BigInt, it's a huge price to pay.
> 
> OK. I have templated code that works with integral types, and uses T.max (or
> T.infinty if T is a floating point). To make it work with bigints I have to use
> a huge_bigint_val or to change the code.

I think it's reasonable to have to change the code. Whenever you use T.max, you
are explicitly using a type with finite representation size. Floating point has
both a T.max and a T.infinity, both of which have different semantics to
integer.max.

Actually I find it difficult to think of non-trivial algorithms which work
correctly even just for built-in integers and built-in floating point. There
isn't much common semantics.

Eg, even sum() needs special treatment. 
sum([real.max, real.max, -real.max, -real.max, 7.0]) == 7.0, not infinity or
NaN.

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