Origins of the D Programming Language

Steven Schveighoffer schveiguy at gmail.com
Fri Dec 7 16:01:33 UTC 2018


On 12/7/18 8:28 AM, mate wrote:
> On Friday, 7 December 2018 at 10:34:54 UTC, Nicholas Wilson wrote:
>> On Friday, 7 December 2018 at 10:08:04 UTC, Dmitry Olshansky wrote:
>>> On Friday, 30 November 2018 at 19:34:58 UTC, Andrei Alexandrescu wrote:
>>>> [...]
>>>
>>> Maybe already pointed out in the thread but just in case
>>>
>>> line 449 has bogus factorial implementation:
>>>
>>> foreach (i; 0 .. n) result *= i;
>>>
>>> should probably be
>>>
>>> foreach (i; 1 .. n) result *= i;
>>
>> It has, it also bought up the need for unit tests(!) ;)
> 
> Indeed, because it should be:
> foreach (i; 2 .. n+1) result *= i;

Funny, it was pointed out that the error was an "off by one", but there 
were really 2 errors that were off by one.

Get the unittests done already! ;)

-Steve


More information about the Digitalmars-d mailing list