<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.math.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.is-nan.php',
    1 => 'is_nan',
    2 => '判断浮点数是否是否为 NAN',
  ),
  'up' => 
  array (
    0 => 'ref.math.php',
    1 => 'Math 函数',
  ),
  'prev' => 
  array (
    0 => 'function.is-infinite.php',
    1 => 'is_infinite',
  ),
  'next' => 
  array (
    0 => 'function.log.php',
    1 => 'log',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/math/functions/is-nan.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.is-nan" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">is_nan</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">is_nan</span> &mdash; <span class="dc-title">判断浮点数是否是否为 NAN</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.is-nan-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>is_nan</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.float.php" class="type float">float</a></span> <code class="parameter">$num</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   返回指定的 <code class="parameter">num</code> 是否是 <strong><code><a href="math.constants.php#constant.nan">NAN</a></code></strong>（<q class="quote">非数值</q>）。
  </p>
  <p class="para">
   <strong><code><a href="math.constants.php#constant.nan">NAN</a></code></strong> 是从未定义的数学运算中返回的，例如传递的参数在函数的输入域之外的时候。平方根（<span class="function"><a href="function.sqrt.php" class="function">sqrt()</a></span>）仅对正数定义，传递负数将导致
   <strong><code><a href="math.constants.php#constant.nan">NAN</a></code></strong>。返回 <strong><code><a href="math.constants.php#constant.nan">NAN</a></code></strong> 的其它操作示例有 <strong><code><a href="math.constants.php#constant.inf">INF</a></code></strong> 除以 <strong><code><a href="math.constants.php#constant.inf">INF</a></code></strong>
   以及涉及现有 <strong><code><a href="math.constants.php#constant.nan">NAN</a></code></strong> 值的任何操作。
  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    尽管名字叫 <q class="quote">Not A Number</q>，但 <strong><code><a href="math.constants.php#constant.nan">NAN</a></code></strong> 是有效的 <span class="type"><a href="language.types.float.php" class="type float">float</a></span> 类型。
   </p>
  </p></blockquote>
  <div class="caution"><strong class="caution">警告</strong>
   <p class="para">
    <strong><code><a href="math.constants.php#constant.nan">NAN</a></code></strong> 不能与 <strong><code><a href="math.constants.php#constant.nan">NAN</a></code></strong> 进行比较。要检测浮点数是否是 <strong><code><a href="math.constants.php#constant.nan">NAN</a></code></strong>，必须使用
    <span class="function"><strong>is_nan()</strong></span>。使用 <code class="code">$float === NAN</code> 检测将不起作用。
   </p>
  </div>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.is-nan-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">num</code></dt>
     <dd>
      <p class="para">
       要检查的 <span class="type"><a href="language.types.float.php" class="type float">float</a></span>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.is-nan-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   如果 <code class="parameter">num</code> 是 <strong><code><a href="math.constants.php#constant.nan">NAN</a></code></strong>，返回 <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>，否则返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.is-nan-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 <span class="function"><strong>is_nan()</strong></span> 示例</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$nan </span><span style="color: #007700">= </span><span style="color: #0000BB">sqrt</span><span style="color: #007700">(-</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$nan</span><span style="color: #007700">, </span><span style="color: #0000BB">is_nan</span><span style="color: #007700">(</span><span style="color: #0000BB">$nan</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>以上示例会输出：</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">float(NAN)
bool(true)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.is-nan-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.is-finite.php" class="function" rel="rdfs-seeAlso">is_finite()</a> - 判断浮点数是否是有效的有限值</span></li>
    <li><span class="function"><a href="function.is-infinite.php" class="function" rel="rdfs-seeAlso">is_infinite()</a> - 判断浮点数是否为无限值</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>