1Tcl_DoubleObj(3) Tcl Library Procedures Tcl_DoubleObj(3)
2
3
4
5______________________________________________________________________________
6
8 Tcl_NewDoubleObj, Tcl_SetDoubleObj, Tcl_GetDoubleFromObj - manipulate
9 Tcl objects as floating-point values
10
12 #include <tcl.h>
13
14 Tcl_Obj *
15 Tcl_NewDoubleObj(doubleValue)
16
17 Tcl_SetDoubleObj(objPtr, doubleValue)
18
19 int
20 Tcl_GetDoubleFromObj(interp, objPtr, doublePtr)
21
23 double doubleValue (in) A double-precision floating point
24 value used to initialize or set a
25 double object.
26
27 Tcl_Obj *objPtr (in/out) For Tcl_SetDoubleObj, this points
28 to the object to be converted to
29 double type. For Tcl_GetDouble‐
30 FromObj, this refers to the object
31 from which to get a double value;
32 if objPtr does not already point
33 to a double object, an attempt
34 will be made to convert it to one.
35
36 Tcl_Interp *interp (in/out) If an error occurs during conver‐
37 sion, an error message is left in
38 the interpreter's result object
39 unless interp is NULL.
40
41 double *doublePtr (out) Points to place to store the dou‐
42 ble value obtained from objPtr.
43_________________________________________________________________
44
45
47 These procedures are used to create, modify, and read double Tcl
48 objects from C code. Tcl_NewDoubleObj and Tcl_SetDoubleObj will create
49 a new object of double type or modify an existing object to have double
50 type. Both of these procedures set the object to have the double-pre‐
51 cision floating point value given by doubleValue; Tcl_NewDoubleObj
52 returns a pointer to a newly created object with reference count zero.
53 Both procedures set the object's type to be double and assign the dou‐
54 ble value to the object's internal representation doubleValue member.
55 Tcl_SetDoubleObj invalidates any old string representation and, if the
56 object is not already a double object, frees any old internal represen‐
57 tation.
58
59 Tcl_GetDoubleFromObj attempts to return a double value from the Tcl
60 object objPtr. If the object is not already a double object, it will
61 attempt to convert it to one. If an error occurs during conversion, it
62 returns TCL_ERROR and leaves an error message in the interpreter's
63 result object unless interp is NULL. Otherwise, it returns TCL_OK and
64 stores the double value in the address given by doublePtr. If the
65 object is not already a double object, the conversion will free any old
66 internal representation.
67
68
70 Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult
71
72
74 double, double object, double type, internal representation, object,
75 object type, string representation
76
77
78
79Tcl 8.0 Tcl_DoubleObj(3)