[25] | 1 | '\" |
---|
| 2 | '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. |
---|
| 3 | '\" |
---|
| 4 | '\" See the file "license.terms" for information on usage and redistribution |
---|
| 5 | '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
| 6 | '\" |
---|
| 7 | '\" RCS: @(#) $Id: DoubleObj.3,v 1.4 2006/04/25 17:15:25 dgp Exp $ |
---|
| 8 | '\" |
---|
| 9 | .so man.macros |
---|
| 10 | .TH Tcl_DoubleObj 3 8.0 Tcl "Tcl Library Procedures" |
---|
| 11 | .BS |
---|
| 12 | .SH NAME |
---|
| 13 | Tcl_NewDoubleObj, Tcl_SetDoubleObj, Tcl_GetDoubleFromObj \- manipulate Tcl objects as floating-point values |
---|
| 14 | .SH SYNOPSIS |
---|
| 15 | .nf |
---|
| 16 | \fB#include <tcl.h>\fR |
---|
| 17 | .sp |
---|
| 18 | Tcl_Obj * |
---|
| 19 | \fBTcl_NewDoubleObj\fR(\fIdoubleValue\fR) |
---|
| 20 | .sp |
---|
| 21 | \fBTcl_SetDoubleObj\fR(\fIobjPtr, doubleValue\fR) |
---|
| 22 | .sp |
---|
| 23 | int |
---|
| 24 | \fBTcl_GetDoubleFromObj\fR(\fIinterp, objPtr, doublePtr\fR) |
---|
| 25 | .SH ARGUMENTS |
---|
| 26 | .AS Tcl_Interp doubleValue in/out |
---|
| 27 | .AP double doubleValue in |
---|
| 28 | A double-precision floating-point value used to initialize or set a Tcl object. |
---|
| 29 | .AP Tcl_Obj *objPtr in/out |
---|
| 30 | For \fBTcl_SetDoubleObj\fR, this points to the object in which to store a |
---|
| 31 | double value. |
---|
| 32 | For \fBTcl_GetDoubleFromObj\fR, this refers to the object |
---|
| 33 | from which to retrieve a double value. |
---|
| 34 | .AP Tcl_Interp *interp in/out |
---|
| 35 | When non-NULL, an error message is left here when double value retrieval fails. |
---|
| 36 | .AP double *doublePtr out |
---|
| 37 | Points to place to store the double value obtained from \fIobjPtr\fR. |
---|
| 38 | .BE |
---|
| 39 | |
---|
| 40 | .SH DESCRIPTION |
---|
| 41 | .PP |
---|
| 42 | These procedures are used to create, modify, and read Tcl objects that |
---|
| 43 | hold double-precision floating-point values. |
---|
| 44 | .PP |
---|
| 45 | \fBTcl_NewDoubleObj\fR creates and returns a new Tcl object initialized to |
---|
| 46 | the double value \fIdoubleValue\fR. The returned Tcl object is unshared. |
---|
| 47 | .PP |
---|
| 48 | \fBTcl_SetDoubleObj\fR sets the value of an existing Tcl object pointed to |
---|
| 49 | by \fIobjPtr\fR to the double value \fIdoubleValue\fR. The \fIobjPtr\fR |
---|
| 50 | argument must point to an unshared Tcl object. Any attempt to set the value |
---|
| 51 | of a shared Tcl object violates Tcl's copy-on-write policy. Any existing |
---|
| 52 | string representation or internal representation in the unshared Tcl object |
---|
| 53 | will be freed as a consequence of setting the new value. |
---|
| 54 | .PP |
---|
| 55 | \fBTcl_GetDoubleFromObj\fR attempts to retreive a double value from the |
---|
| 56 | Tcl object \fIobjPtr\fR. If the attempt succeeds, then \fBTCL_OK\fR is |
---|
| 57 | returned, and the double value is written to the storage pointed to by |
---|
| 58 | \fIdoublePtr\fR. If the attempt fails, then \fBTCL_ERROR\fR is returned, |
---|
| 59 | and if \fIinterp\fR is non-NULL, an error message is left in \fIinterp\fR. |
---|
| 60 | The \fBTcl_ObjType\fR of \fIobjPtr\fR may be changed to make subsequent |
---|
| 61 | calls to \fBTcl_GetDoubleFromObj\fR more efficient. |
---|
| 62 | '\" TODO: add discussion of treatment of NaN value |
---|
| 63 | .SH "SEE ALSO" |
---|
| 64 | Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult |
---|
| 65 | .SH KEYWORDS |
---|
| 66 | double, double object, double type, internal representation, object, object type, string representation |
---|