diff options
Diffstat (limited to 'doc/PrintDbl.3')
-rw-r--r-- | doc/PrintDbl.3 | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/doc/PrintDbl.3 b/doc/PrintDbl.3 index 75e7663..279b4d5 100644 --- a/doc/PrintDbl.3 +++ b/doc/PrintDbl.3 @@ -16,19 +16,17 @@ Tcl_PrintDouble \- Convert floating value to string .sp \fBTcl_PrintDouble\fR(\fIinterp, value, dst\fR) .SH ARGUMENTS -.AS Tcl_Interp *interp +.AS Tcl_Interp *interp out .AP Tcl_Interp *interp in -.VS Before Tcl 8.0, the \fBtcl_precision\fR variable in this interpreter controlled the conversion. As of Tcl 8.0, this argument is ignored and the conversion is controlled by the \fBtcl_precision\fR variable that is now shared by all interpreters. -.VE .AP double value in Floating-point value to be converted. .AP char *dst out -Where to store string representing \fIvalue\fR. Must have at -least TCL_DOUBLE_SPACE characters of storage. +Where to store the string representing \fIvalue\fR. Must have at +least \fBTCL_DOUBLE_SPACE\fR characters of storage. .BE .SH DESCRIPTION @@ -36,10 +34,22 @@ least TCL_DOUBLE_SPACE characters of storage. \fBTcl_PrintDouble\fR generates a string that represents the value of \fIvalue\fR and stores it in memory at the location given by \fIdst\fR. It uses \fB%g\fR format to generate the string, with one -special twist: the string is guaranteed to contain either -a ``.'' or an ``e'' so that it doesn't look like an integer. Where -\fB%g\fR would generate an integer with no decimal point, \fBTcl_PrintDouble\fR -adds ``.0''. +special twist: the string is guaranteed to contain either a +.QW . +or an +.QW e +so that it does not look like an integer. Where \fB%g\fR would +generate an integer with no decimal point, \fBTcl_PrintDouble\fR adds +.QW .0 . +.VS 8.5 +.PP +If the \fBtcl_precision\fR 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 \fBTcl_NewDoubleObj\fR +will generate the same number when presented with the given string. +IEEE semantics of rounding to even apply to the conversion. +.VE .SH KEYWORDS conversion, double-precision, floating-point, string |