Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #33455
| Path | csiph.com!aioe.org!news.mb-net.net!open-news-network.org!.POSTED!not-for-mail |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: x === x |
| Date | Wed, 31 May 2017 21:03:06 +0200 |
| Organization | PointedEars Software (PES) |
| Lines | 65 |
| Message-ID | <5183822.MhkbZ0Pkbq@PointedEars.de> (permalink) |
| References | <JavaScript-20170530123255@ram.dialup.fu-berlin.de> <2563985.e9J7NaK4W3@PointedEars.de> <42992d96-86e3-4224-b011-5cb32f610a83@googlegroups.com> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| NNTP-Posting-Host | 47.229.197.178.dynamic.wless.zhbmb00p-cgnat.res.cust.swisscom.ch |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | 8Bit |
| X-Trace | gwaiyur.mb-net.net 1496257387 5782 178.197.229.47 (31 May 2017 19:03:07 GMT) |
| X-Complaints-To | abuse@open-news-network.org |
| NNTP-Posting-Date | Wed, 31 May 2017 19:03:07 +0000 (UTC) |
| User-Agent | KNode/4.14.2 |
| X-Face | %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v |
| 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== |
| Xref | csiph.com comp.lang.javascript:33455 |
Show key headers only | View raw
Dr J R Stockton wrote:
> […] Thomas 'PointedEars' Lahn wrote:
>> This should be obvious even to you: The return values of consecutive
>> calls of Math.random() may be, but are not supposed to be, equal. After
>> all, the method is supposed to generate *random* numbers.
>
> Standard ECMA-262, 6th Edition / June 2015, HTML, includes a
> rather woolly "definition" :-
That may be so, however the current Edition is the 7th (ECMAScript 2016).
> […]
>> > NaN === NaN
>>
>> This evaluating to “false” is due to the implementation of the ECMAScript
>> Number type as a type of IEEE 754 “double-precision” floating-point
>> values.
>
> I think not. IEEE 754 provides that a large number of 64-bit
> patterns represent NaN, and I think it provides that all of
> the patterns have the same arithmetic value. […]
IEEE 754-1985 (at least) and (probably) IEEE 754-2008 (too) basically
specify that (the) NaN (values) is/are not equal to any other floating-point
value. That is, “In the syntax of C, the predicate x != y is True but all
others, x < y , x <= y , x == y , x >= y and x > y, are False whenever x or
y or both are NaN” [1].
That is one reason why ECMAScript 2015 (6th Ed.) introduced
Object.is(NaN, NaN) === true
<http://www.ecma-international.org/ecma-262/6.0/#sec-object.is>
<http://www.ecma-international.org/ecma-262/7.0/#sec-object.is>
(I thought that would be common knowledge around here.)
> The indistinguishability and inequality of NaNs in JavaScript
> results from a choice taken by ECMA or by its relevant
> predecessors.
You are very likely mistaken there.
_________
[1] Kahan, William. "IEEE standard 754 for binary floating-point
arithmetic." Lecture Notes on the Status of IEEE 754.94720-1776 (1996):
11.
<http://li.mit.edu/Archive/Activities/Archive/CourseWork/Ju_Li/MITCourses/18.335/Doc/IEEE754/ieee754.pdf>
[Et al. I would rather have referred to the section of the standard
itself, but its text is not freely available from the original
publisher:
<http://ieeexplore.ieee.org/document/4610935/?part=1>
I think it is a disgrace for organizations like the IEEE and ISO
to publish an industry standard and then hide it behind a paywall
*despite* having a paying membership already. Kudos to organizations
like Ecma International, ISOC, and the W3C, that are not doing this.]
--
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: x === x Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-30 16:21 +0200
Re: x === x John G Harris <niam@jghnorth.org.uk.invalid> - 2017-05-30 19:16 +0100
Re: x === x Dr J R Stockton <J.R.Stockton@physics.org> - 2017-05-31 08:39 -0700
Re: x === x Stefan Weiss <krewecherl@gmail.com> - 2017-05-31 18:08 +0200
Re: x === x Dr J R Stockton <reply1700@merlyn.demon.co.uk.invalid> - 2017-06-02 22:27 +0100
Re: x === x Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-31 21:03 +0200
Re: x === x Dr J R Stockton <reply1700@merlyn.demon.co.uk.invalid> - 2017-06-02 22:12 +0100
Re: x === x Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-31 21:09 +0200
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-01 01:58 +0100
Re: x === x Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-06-01 05:01 +0200
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-01 14:44 +0100
Re: x === x Dr J R Stockton <reply1700@merlyn.demon.co.uk.invalid> - 2017-06-02 21:15 +0100
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-01 14:17 +0100
Re: x === x Julio Di Egidio <julio@diegidio.name> - 2017-06-01 00:10 -0700
Re: x === x Dr J R Stockton <reply1700@merlyn.demon.co.uk.invalid> - 2017-06-02 22:16 +0100
csiph-web