## Tcl8.6.17/Tk8.6.17 Documentation > Tcl C API > PrintDbl

### 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
    Tcl_PrintDouble — 浮動少数値から文字列への変換　 Convert floating value to string
  SYNOPSIS
    #include <tcl.h>
    Tcl_PrintDouble(interp, value, dst)
  引数 ARGUMENTS
    Tcl_Interp *interp (入力in)
    double value (入力in)
    char *dst (出力out)
  説明 DESCRIPTION
  KEYWORDS

### NAME

Tcl_PrintDouble — 浮動少数値から文字列への変換　 Convert floating value to string

### SYNOPSIS

#include <tcl.h>
Tcl_PrintDouble(interp, value, dst)

### 引数 ARGUMENTS

Tcl_Interp *interp (入力in)
  Tcl 8.0 以前では､この解釈実行機能内の tcl_precision 変数が変換を制御していた｡Tcl 8.0 それ以後は､この引数は無視され､変換は､現在解釈実行機能と共有さてている tcl_precision 変数によって制御される｡　 Before Tcl 8.0, the tcl_precision variable in this interpreter controlled the conversion. As of Tcl 8.0, this argument is ignored and the conversion is controlled by the tcl_precision variable that is now shared by all interpreters.

double value (入力in)
  変換されるべき浮動少数点値｡　 Floating-point value to be converted.

char *dst (出力out)
  文字列表現値valueを保存する場所｡少なくとも､貯蔵のTCL_DOUBLE_SPACE 文字を有してなければならない｡　 Where to store the string representing value. Must have at least TCL_DOUBLE_SPACE characters of storage.

### 説明 DESCRIPTION

Tcl_PrintDouble は値 value を表現する文字列を生成し､記憶域内の dst によって与えられる位置に保存する｡それは文字列を生成するために特別な捩れのある %g 書式を使う: 文字列は “.” か “e” を必ず含みそれにより整数とは異なる様に見える｡ここで %g は小数点のない整数を生成し､ Tcl_PrintDouble は “.0” を付ける｡ Tcl_PrintDouble generates a string that represents the value of value and stores it in memory at the location given by dst. It uses %g format to generate the string, with one special twist: the string is guaranteed to contain either a “.” or an “e” so that it does not look like an integer. Where %g would generate an integer with no decimal point, Tcl_PrintDouble adds “.0”.

tcl_precision が非零の場合､結果は有効数字の精度を有する｡もし値が零(省略時設定)の場合､与えられた文字列が表す同じ数を Tcl_NewDoubleObj が生成する方法で表現するに必要な最小の数字を有する｡変換の為に偶数化への IEEE 意味論の丸めを適用する｡ If the tcl_precision value is non-zero, the result will have precisely that many digits of significance. If the value is zero (the default), the result will have the fewest digits needed to represent the number in such a way that Tcl_NewDoubleObj will generate the same number when presented with the given string. IEEE semantics of rounding to even apply to the conversion.

### KEYWORDS

conversion, double-precision, floating-point, string
Copyright © 1989-1993 The Regents of the University of California.
Copyright © 1994-1997 Sun Microsystems, Inc.