Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #40277
| Path | csiph.com!weretis.net!feeder8.news.weretis.net!news.mb-net.net!open-news-network.org!.POSTED.178.197.216.189!not-for-mail |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Decimal numeric string to hexadecimal numeric string? |
| Date | Thu, 01 Jul 2021 12:43:53 +0200 |
| Organization | PointedEars Software (PES) |
| Lines | 85 |
| Message-ID | <7969540.pbqncKrJha@PointedEars.de> (permalink) |
| References | <d210bffe-abab-448a-b36b-e1b27f3e25c0n@googlegroups.com> <233183ba-98dc-47d5-84f6-bd3beef1e793n@googlegroups.com> <db65730d-8ad2-478f-938b-b8398d62cdadn@googlegroups.com> <87fsxegmpj.fsf@bsb.me.uk> <20837730.9tcgPO3Tcr@PointedEars.de> <0d312dec-5b2c-4a8b-9bb0-fe0c1fd867f9n@googlegroups.com> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | 8Bit |
| Injection-Info | gwaiyur.mb-net.net; posting-host="178.197.216.189"; logging-data="9755"; mail-complaints-to="abuse@open-news-network.org" |
| User-Agent | KNode/4.14.10 |
| Cancel-Lock | sha1:FldLylVTLrMtNyLTHlNMQwRwgAc= |
| 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== |
| X-User-ID | U2FsdGVkX19ajDe0i4AENemgcD5Wa0FKhyI4CbzTLlMu5UMEXcaldA== |
| 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 |
| Xref | csiph.com comp.lang.javascript:40277 |
Show key headers only | View raw
Michael Haufe (TNO) wrote:
> On Wednesday, June 30, 2021 at 5:51:16 PM UTC-5, Thomas 'PointedEars' Lahn
> wrote:
>> parseInt() should not be called without a radix value because then the
>> interpretation of the string depends on its prefix. This is a FAQ.
>
> The FAQ should be updated.
I am still waiting for, and am looking forward to, your pull requests
*shrug*
<https://github.com/PointedEars/FAQ-cljs>
> This now depends on the browser version.
Not really, see below.
> With the following:
>
> parseInt("070")
>
> I see these results:
>
> Brave (Chromium 91): 70
> Firefox : 89: 70
> IE 11: 70
> IE 10: 70
> IE 9: 70
> IE 8: 56
> IE 7: 56
> IE 5: 56
>
> <https://codepen.io/mlhaufe/pen/jOmERVg?editors=1000>
>
> (When testing on older browsers use the debug view)
The interpretation of octal string literals by parseInt() without “radix”
argument *always* depended on the "browser version", more precisely the
ECMAScript implementation supported, and the version of the script engine
used, by the runtime environment. That is *the* reason why the FAQ
recommends to specify the “radix” argument since time immemorial:
<http://PointedEars.de/scripts/faq/cljs/#parseIntBase>
Compare
<https://www.ecma-international.org/wp-content/uploads/ECMA-262_3rd_edition_december_1999.pdf#page=89>
with
<https://www.ecma-international.org/wp-content/uploads/ECMA-262_5th_edition_december_2009.pdf#page=114>
Microsoft Internet Explorer/MSHTML 5.0 through 8.0 support/use Microsoft
JScript 5.0 through 5.8.x which implement ECMAScript Ed. 3/5.x¹; whereas
IE/MSHTML 9 and 10 support/use JScript 9.0 and 10.0.x, which implement
ECMAScript Ed. 5.x.
The latest version of Firefox supports Mozilla JavaScript 78 and later
(I have only Firefox 78 here), and uses a recent version of Mozilla
SpiderMonkey, which implements ECMAScript 2020 or later.
Chromium 91 supports Google JavaScript 9.0.257.29 or later, and uses Google
V8, which implements ECMAScript 2020 or later.
So your results are unsurprising (but valuable²) to me. See also:
<http://PointedEars.de/es-matrix#version-info>
BTW, it is July in Europe now, so ECMAScript 2021 was "released" :-o
<https://262.ecma-international.org/>
_______
¹ Here we can see that an ECMAScript implementation does not always meet
what is unambiguously specified in the Edition that it claims to
implement.
² Strangely enough, I do not have a test case for that in the ECMAScript
Support Matrix yet: <http://PointedEars.de/es-matrix/?filter=parseInt>
--
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 | Find similar | Unroll thread
Decimal numeric string to hexadecimal numeric string? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-06-17 14:28 -0700
Re: Decimal numeric string to hexadecimal numeric string? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-06-17 21:38 -0700
Re: Decimal numeric string to hexadecimal numeric string? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-06-19 00:39 -0700
Re: Decimal numeric string to hexadecimal numeric string? Scott Sauyet <scott@sauyet.com> - 2021-06-18 05:59 -0700
Re: Decimal numeric string to hexadecimal numeric string? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-06-19 00:45 -0700
Re: Decimal numeric string to hexadecimal numeric string? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-06-19 11:42 +0100
Re: Decimal numeric string to hexadecimal numeric string? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-07-01 00:51 +0200
Re: Decimal numeric string to hexadecimal numeric string? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-06-30 17:39 -0700
Re: Decimal numeric string to hexadecimal numeric string? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-07-01 01:50 +0100
Re: Decimal numeric string to hexadecimal numeric string? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-07-01 12:46 +0200
Re: Decimal numeric string to hexadecimal numeric string? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-07-01 12:43 +0200
csiph-web