iota and BigInt

Russel Winder via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 22 09:12:17 PST 2015


Using reduce for factorial, seems to require iota, not a bad things per
se, with ulongs:

	reduce!"a*b"(1, iota(1, n + 1))

works fine. Now switch to BigInt:

	reduce!"a*b"(one, iota(one, n + one))

fails to compile, one and n + one are of different types. Problem is
that one is immutable but n + one is not. I can't remember how to create
an immutable value as an expression so:

	immutable BigInt v = n + one;
	reduce!"a*b"(one, iota(one, v))

now I get an error telling me that I can't use iota because BigInt is
not a float or an integer. Is this a known bug? Yes it is:
https://issues.dlang.org/show_bug.cgi?id=6447

Does anyone know how to fix this 3.5 year old bug that is a blocker for
doing anything with factorial and Fibonacci Series.?

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150122/dced8d9d/attachment-0001.sig>


More information about the Digitalmars-d-learn mailing list