<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="18" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[18]</anchor-end> <dfn>NaN</dfn> は、<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">数</anchor>ではない値です。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="19" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[19]</anchor-end> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">0除算</anchor>のような結果が定義されない<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">演算</anchor>の結果として使われたり、
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">数値</anchor>として解釈できない値を<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">数値型</anchor>に<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">型変換</anchor>した結果として使われたりします。</p><section><h1>値 <code class="JS" xml:lang="en">NaN</code> (JavaScript)</h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="1" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[1]</anchor-end></p><blockquote><p>The <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">primitive value</anchor> <DF xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:10:"><code xmlns="http://www.w3.org/1999/xhtml" class="JS" xml:lang="en">NaN</code></DF> represents the <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">set</anchor> of <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">IEEE Standard</anchor> 
&quot;<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">Not-a-Number</anchor>&quot; <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">values</anchor>. This <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">value</anchor> is a <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">member</anchor> of the <code class="JS" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">Number</anchor></code> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">type</anchor>.</p></blockquote><comment-p xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:10:"><cite xmlns="http://www.w3.org/1999/xhtml">ECMAScript Language Specification (HTML version)</cite> (<time xmlns="http://www.w3.org/1999/xhtml">2009-04-03 04:43:48 +09:00</time> 版) <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://bclary.com/2004/11/07/#a-4.3.23">http://bclary.com/2004/11/07/#a-4.3.23</anchor-external></comment-p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="2" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[2]</anchor-end><dl><dt>名前</dt><dd><code class="JS" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">NaN</anchor></code></dd><dt>型</dt><dd><code class="JS" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">Number</anchor></code></dd></dl></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="3" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[3]</anchor-end> <cite xml:lang="EN">XQuery 1.0 and XPath 2.0 Functions and Operators (Second Edition)</cite>
( (<time>2010-12-17 00:06:54 +09:00</time> 版))
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://www.w3.org/TR/2010/REC-xpath-functions-20101214/#numeric-types">http://www.w3.org/TR/2010/REC-xpath-functions-20101214/#numeric-types</anchor-external></p></section><section><h1><code>nan</code>, <code>-nan</code> (Perl)</h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="4" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[4]</anchor-end> <pre class="perl code">$ perl -MPOSIX -MDevel::Peek -e 'print Devel::Peek::Dump POSIX::fmod(12,0)'
SV = NV(0x1c3cca8) at 0x1c2c780
  REFCNT = 1
  FLAGS = (PADTMP,NOK,pNOK)
  NV = -nan</pre></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="5" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[5]</anchor-end> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">文字列化</anchor>すると Perl 5.22 では <code>NaN</code> ですが、
Perl 5.14 では <code>nan</code> でした。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="6" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[6]</anchor-end> <kbd>perl -MPOSIX -e 'print POSIX::fmod(12,0)'</kbd>
は Perl 5.14 では <code>-nan</code>、 5.22 では <code>NaN</code> になります。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="7" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[7]</anchor-end> <code>pack 'L', 0+'NaN'</code> は 5.22 以降は<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">例外</anchor>を<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">投げ</anchor>ます。
以前は 0 扱いでした。</p></section><section><h1>歴史</h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="8" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[8]</anchor-end> <cite xml:lang="en">Inline the infinite/NaN argument handling in 2d canvas methods</cite>
(<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">zcorpan</anchor>著, <time>2016-09-30 22:38:34 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/whatwg/html/commit/6f2c0e884e3a7974637514b04e62f7352b6e405d">https://github.com/whatwg/html/commit/6f2c0e884e3a7974637514b04e62f7352b6e405d</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="9" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[9]</anchor-end> <cite xml:lang="EN">XQuery 3.1: An XML Query Language</cite>
(<time>2017-03-20 09:23:33 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://www.w3.org/TR/2017/REC-xquery-31-20170321/#id-static-decimal-format-NaN">https://www.w3.org/TR/2017/REC-xquery-31-20170321/#id-static-decimal-format-NaN</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="10" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[10]</anchor-end> <cite xml:lang="EN">XML Path Language (XPath) 3.1</cite>
(<time>2017-03-20 09:18:04 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://www.w3.org/TR/2017/REC-xpath-31-20170321/#id-static-decimal-format-NaN">https://www.w3.org/TR/2017/REC-xpath-31-20170321/#id-static-decimal-format-NaN</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="11" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[11]</anchor-end> <cite xml:lang="EN">XPath and XQuery Functions and Operators 3.1</cite>
(<time>2017-03-21 16:02:06 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://www.w3.org/TR/2017/REC-xpath-functions-31-20170321/#op.numeric">https://www.w3.org/TR/2017/REC-xpath-functions-31-20170321/#op.numeric</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="12" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[12]</anchor-end> <cite xml:lang="en">Clarify that unrestricted doubles and floats include NaNs. (#393)</cite>
(<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">tobie</anchor>著, <time>2017-07-30 21:58:17 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/heycam/webidl/commit/44d0f24f4ef6632bf49dcf1650ff0d3c64778943">https://github.com/heycam/webidl/commit/44d0f24f4ef6632bf49dcf1650ff0d3c64778943</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="13" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[13]</anchor-end> <cite xml:lang="en">29240 – Clarify whether NaN is allowed in float/double types</cite>
(<time>2017-07-31 12:02:32 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://www.w3.org/Bugs/Public/show_bug.cgi?id=29240">https://www.w3.org/Bugs/Public/show_bug.cgi?id=29240</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="14" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[14]</anchor-end> <cite xml:lang="en">Clarify that unrestricted doubles and floats include NaNs. by tobie · Pull Request #393 · heycam/webidl</cite>
(<time>2017-07-31 12:02:39 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/heycam/webidl/pull/393">https://github.com/heycam/webidl/pull/393</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="15" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[15]</anchor-end> <cite xml:lang="en">Do nothing for NaN in setTransform(transform)/addPath(b, transform)</cite>
(<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">zcorpan</anchor>著, <time>2017-09-26 18:01:42 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/whatwg/html/commit/5b19b37c6c6d12f0526afc258686206550ac415c">https://github.com/whatwg/html/commit/5b19b37c6c6d12f0526afc258686206550ac415c</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="16" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[16]</anchor-end> <cite xml:lang="en">Canvas 2d context setTransform() functionality is unclear when argument contains NaN · Issue #2845 · whatwg/html</cite>
(<time>2017-09-27 15:55:25 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/whatwg/html/issues/2845">https://github.com/whatwg/html/issues/2845</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="17" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[17]</anchor-end> <cite xml:lang="en">Do nothing for NaN in setTransform(transform)/addPath(b, transform) by zcorpan · Pull Request #2975 · whatwg/html</cite>
(<time>2017-09-27 15:56:26 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/whatwg/html/pull/2975">https://github.com/whatwg/html/pull/2975</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="20" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[20]</anchor-end> <cite>JavaScript で CPU が Intel かどうかを判定する(ついでに JIT を検知する)</cite>, <time>2023-01-11T02:41:12.000Z</time>, <time>2023-01-12T02:48:45.103Z</time> <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://nmi.jp/2023-01-11-Detecting-Intel-Arch-in-JavaScript">http://nmi.jp/2023-01-11-Detecting-Intel-Arch-in-JavaScript</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="21" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[21]</anchor-end> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">fingerprinting vector</anchor></p></section></body></html>