'\" '\" Copyright (c) 1996-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" RCS: @(#) $Id: DoubleObj.3,v 1.2 1998/09/14 18:39:48 stanton Exp $ '\" .so man.macros .TH Tcl_DoubleObj 3 8.0 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_NewDoubleObj, Tcl_SetDoubleObj, Tcl_GetDoubleFromObj \- manipulate Tcl objects as floating-point values .SH SYNOPSIS .nf \fB#include \fR .sp Tcl_Obj * \fBTcl_NewDoubleObj\fR(\fIdoubleValue\fR) .sp \fBTcl_SetDoubleObj\fR(\fIobjPtr, doubleValue\fR) .sp int \fBTcl_GetDoubleFromObj\fR(\fIinterp, objPtr, doublePtr\fR) .SH ARGUMENTS .AS Tcl_Interp doubleValue in/out .AP double doubleValue in A double-precision floating point value used to initialize or set a double object. .AP Tcl_Obj *objPtr in/out For \fBTcl_SetDoubleObj\fR, this points to the object to be converted to double type. For \fBTcl_GetDoubleFromObj\fR, this refers to the object from which to get a double value; if \fIobjPtr\fR does not already point to a double object, an attempt will be made to convert it to one. .AP Tcl_Interp *interp in/out If an error occurs during conversion, an error message is left in the interpreter's result object unless \fIinterp\fR is NULL. .AP double *doublePtr out Points to place to store the double value obtained from \fIobjPtr\fR. .BE .SH DESCRIPTION .PP These procedures are used to create, modify, and read double Tcl objects from C code. \fBTcl_NewDoubleObj\fR and \fBTcl_SetDoubleObj\fR will create a new object of double type or modify an existing object to have double type. Both of these procedures set the object to have the double-precision floating point value given by \fIdoubleValue\fR; \fBTcl_NewDoubleObj\fR returns a pointer to a newly created object with reference count zero. Both procedures set the object's type to be double and assign the double value to the object's internal representation \fIdoubleValue\fR member. \fBTcl_SetDoubleObj\fR invalidates any old string representation and, if the object is not already a double object, frees any old internal representation. .PP \fBTcl_GetDoubleFromObj\fR attempts to return a double value from the Tcl object \fIobjPtr\fR. If the object is not already a double object, it will attempt to convert it to one. If an error occurs during conversion, it returns \fBTCL_ERROR\fR and leaves an error message in the interpreter's result object unless \fIinterp\fR is NULL. Otherwise, it returns \fBTCL_OK\fR and stores the double value in the address given by \fIdoublePtr\fR. If the object is not already a double object, the conversion will free any old internal representation. .SH "SEE ALSO" Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult .SH KEYWORDS double, double object, double type, internal representation, object, object type, string representation