## Tcl9.0.3/Tk9.0.3 Documentation > Tcl Commands > fpclassify

### Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API

  NAME
    fpclassify — Tcl 値の浮動小数の分類 Floating point number classification of Tcl values
  構文 SYNOPSIS
  説明 DESCRIPTION
    zero
    subnormal
    normal
    infinite
    nan
  用例 EXAMPLE
  SEE ALSO
  KEYWORDS
  STANDARDS
  COPYRIGHT

### NAME

fpclassify — Tcl 値の浮動小数の分類 Floating point number classification of Tcl values

### 構文 SYNOPSIS

package require tcl 9.0

fpclassify value

### 説明 DESCRIPTION

fpclassify 命令は浮動小数 value を採り､それを記述する次の文字列の内の一つを返す｡ The fpclassify command takes a floating point number, value, and returns one of the following strings that describe it:

zero
  value は浮動小数の零｡ value is a floating point zero.

subnormal
  value は漸近的アンダーフロー｡ value is the result of a gradual underflow.

normal
  value は通常の浮動小数(零､疑似通常､無限､非数 以外)｡ value is an ordinary floating-point number (not zero, subnormal, infinite, nor NaN).

infinite
  value は浮動小数の無限｡ value is a floating-point infinity.

nan
  value は非-数 である｡ value is Not-a-Number.

もし value が浮動小数値でなく､且つそれに変換できない場合 fpclassify 命令は不都合を返す｡ The fpclassify command throws an error if value is not a floating-point value and cannot be converted to one.

### 用例 EXAMPLE

これは､計算の結果が数的に安全か否かを如何に確認するかを示す｡(註意すべきは､数的不都合からは護らない; 表示上の問題への対応である) This shows how to check whether the result of a computation is numerically safe or not. (Note however that it does not guard against numerical errors; just against representational problems.)

    set value [command-that-computes-a-value]
    switch [fpclassify $value] {
        normal - zero {
            puts "Result is $value"
        }
        infinite {
            puts "Result is infinite"
        }
        subnormal {
            puts "Result is $value - WARNING! precision lost"
        }
        nan {
            puts "Computation completely failed"
        }
    }

### SEE ALSO

expr, mathfunc

### KEYWORDS

floating point

### STANDARDS

This command depends on the fpclassify() C macro conforming to “ISO C99” (i.e., to ISO/IEC 9899:1999).

### COPYRIGHT

Copyright © 2018 Kevin B. Kenny <kennykb@acm.org>. All rights reserved
Copyright © 2018 Kevin B. Kenny <kennykb(at)acm.org>. All rights reserved
Copyright © 2019 Donal Fellows