1Tcl_PrintDouble(3) Tcl Library Procedures Tcl_PrintDouble(3)
2
3
4
5______________________________________________________________________________
6
8 Tcl_PrintDouble - Convert floating value to string
9
11 #include <tcl.h>
12
13 Tcl_PrintDouble(interp, value, dst)
14
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
31
33 Tcl_PrintDouble generates a string that represents the value of value
34 and stores it in memory at the location given by dst. It uses %g for‐
35 mat to generate the string, with one special twist: the string is guar‐
36 anteed to contain either a “.” or an “e” so that it does not look like
37 an integer. Where %g would generate an integer with no decimal point,
38 Tcl_PrintDouble adds “.0”. │
39
40 If the tcl_precision value is non-zero, the result will have precisely │
41 that many digits of significance. If the value is zero (the default), │
42 the result will have the fewest digits needed to represent the number │
43 in such a way that Tcl_NewDoubleObj will generate the same number when │
44 presented with the given string. IEEE semantics of rounding to even │
45 apply to the conversion.
46
47
49 conversion, double-precision, floating-point, string
50
51
52
53Tcl 8.0 Tcl_PrintDouble(3)