1Tcl_PrintDouble(3)          Tcl Library Procedures          Tcl_PrintDouble(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tcl_PrintDouble - Convert floating value to string
9

SYNOPSIS

11       #include <tcl.h>
12
13       Tcl_PrintDouble(interp, value, dst)
14

ARGUMENTS

16       Tcl_Interp *interp (in)          Before   Tcl  8.0,  the  tcl_precision
17                                        variable  in  this  interpreter   con‐
18                                        trolled  the  conversion.   As  of Tcl
19                                        8.0, this argument is ignored and  the
20                                        conversion   is   controlled   by  the
21                                        tcl_precision  variable  that  is  now
22                                        shared by all interpreters.
23
24       double value (in)                Floating-point value to be converted.
25
26       char *dst (out)                  Where to store the string representing
27                                        value.  Must have  at  least  TCL_DOU‐
28                                        BLE_SPACE characters of storage.
29______________________________________________________________________________
30

DESCRIPTION

32       Tcl_PrintDouble  generates  a string that represents the value of value
33       and stores it in memory at the location given by dst.  It uses %g  for‐
34       mat to generate the string, with one special twist: the string is guar‐
35       anteed to contain either a “.”  or an “e” so that it does not look like
36       an  integer.  Where %g would generate an integer with no decimal point,
37       Tcl_PrintDouble adds “.0”.
38
39       If the tcl_precision value is non-zero, the result will have  precisely
40       that  many digits of significance.  If the value is zero (the default),
41       the result will have the fewest digits needed to represent  the  number
42       in  such a way that Tcl_NewDoubleObj will generate the same number when
43       presented with the given string.  IEEE semantics of  rounding  to  even
44       apply to the conversion.
45

KEYWORDS

47       conversion, double-precision, floating-point, string
48
49
50
51Tcl                                   8.0                   Tcl_PrintDouble(3)
Impressum