Path: csiph.com!aioe.org!news.mb-net.net!open-news-network.org!.POSTED.38.237.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Measuring time (was: Random numbers) Date: Mon, 30 Oct 2017 13:00:29 +0100 Organization: PointedEars Software (PES) Lines: 89 Message-ID: <5322825.lOV4Wx5bFT@PointedEars.de> References: <2345791.k3LOHGUjKi@PointedEars.de> <2876676.AJdgDx1Vlc@PointedEars.de> <8f442f26-987b-4482-bf5f-775856a0a3b8@googlegroups.com> <5883795.4vTCxPXJkl@PointedEars.de> <7b7114cd-8e1a-49f3-b69f-9a23e95d280c@googlegroups.com> <4045820.LvFx2qVVIh@PointedEars.de> <5089967.DvuYhMxLoT@PointedEars.de> <17d154a1-bc7d-402c-8656-9c48d69d6816@googlegroups.com> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit Injection-Info: gwaiyur.mb-net.net; posting-host="38.237.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch:178.197.237.38"; logging-data="24094"; mail-complaints-to="abuse@open-news-network.org" User-Agent: KNode/4.14.2 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== Cancel-Lock: sha1:T8+ivvTYrvcd77BubUeGkQOJTpY= X-User-ID: U2FsdGVkX187eFR5qinDQmibCz3qDUGUfcoM/503sw5pXTX582vOkg== X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. On Sunday, 29 October 2017 16:56:30 UTC, Thomas 'PointedEars' Lahn wrote: >> Dr J R Stockton wrote: >> > there was no 1900-02-29. >> >> | -> new Date(0, 0, 1) >> | <- Mon Jan 01 1900 00:00:00 GMT+0100 (CET) >> | >> | -> new Date(0, 1, 29) >> | <- Thu Mar 01 1900 00:00:00 GMT+0100 (CET) > > I prefer to rely on common knowledge of the Gregorian Reform; > IIRC, the 4/100/400-year rules were printed on the back > cover of school exercise books in my day. > > But I suggest that section 9 of > is more > authoritative than relying on software. ISTM that you have not read my posting(s) carefully enough. The implementation confirms your claim that there was no 1900-02-29 CE, which disproves your claim that >>> There is only one such date; there was no 1900-02-29. in reply to my >> AFAICS, the result for [new Date(0, 1, N)] is only wrong (not as >> specified) if N < 366 and one expects a date that is not in 1900 CE. which I have explained how it was meant. >> > But the following code yields merely 59 :- >> > S = "" >> > for (N=1 ; N<400 ; N++) { >> > D1 = new Date(0e3, 0, N).getDate() >> > D2 = new Date(2e3, 0, N).getDate() >> >> Undeclared variable, unwise identifiers. > > Irrelevant; single-use code, not saved to disc. Examples posted here should meeet the minimum standards of recommendable ECMAScript code. >> > S += "+" + +(D1==D2) } >> >> An Array instance is a lot more efficient for this: > > No; it would take longer to type, It would not. > and I had wanted to see S in its full glory before completion. You do not have to see it as a *string* value. > Execution was effectively instantaneous. Addition is available directly as I showed, and indirectly through the Array.prototype.reduce() method. There is no need for inefficient concatenation or evil eval() [tm]. var a = Array.apply(null, {length: 10}).map((e, i) => i); /* [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] */ console.log(a); var notGauss = a.reduce((accu, e) => accu + e); /* 45 */ console.log(notGauss); >> > In a normal year, January+February is 59 days; the rest are wrong. >> I do not see your point. > > Then think more deeply. Likewise. > Looking at S may help you. It would not. -- PointedEars FAQ: | | Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.