Optimizing a bigint fibonacci

Biotronic simen.kjaras at gmail.com
Wed Dec 6 10:30:13 UTC 2017


On Wednesday, 6 December 2017 at 10:16:16 UTC, helxi wrote:
> On Wednesday, 6 December 2017 at 10:00:48 UTC, Biotronic wrote:
>>         AliasSeq!(a, b) = tuple(
>>             a * (2*b - a),
>>             a*a + b*b);
>>
>> [...]
>
> Nice. But why the AliasSeq?

Just playing around a bit. The alternative is to assign to a 
temporary:

    auto c = a * (2*b - a);
    b = a*a + b*b;'
    a = c;

The resulting behavior is the same, and apart from the cludgy 
names I kinda like doing (a,b) = (c,d).

--
   Biotronic


More information about the Digitalmars-d-learn mailing list