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