summaryrefslogtreecommitdiffstats
path: root/doc/DoubleObj.3
blob: 164d4c9abf715f29a60dd386bf730d33b0e41d64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
'\"
'\" 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 <tcl.h>\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