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 Tcl object.
26
27 Tcl_Obj *objPtr (in/out) For Tcl_SetDoubleObj, this points
28 to the object in which to store a
29 double value. For Tcl_GetDouble‐
30 FromObj, this refers to the object
31 from which to retrieve a double
32 value.
33
34 Tcl_Interp *interp (in/out) When non-NULL, an error message is
35 left here when double value
36 retrieval fails.
37
38 double *doublePtr (out) Points to place to store the dou‐
39 ble value obtained from objPtr.
40_________________________________________________________________
41
42
44 These procedures are used to create, modify, and read Tcl objects that
45 hold double-precision floating-point values.
46
47 Tcl_NewDoubleObj creates and returns a new Tcl object initialized to
48 the double value doubleValue. The returned Tcl object is unshared.
49
50 Tcl_SetDoubleObj sets the value of an existing Tcl object pointed to by
51 objPtr to the double value doubleValue. The objPtr argument must point
52 to an unshared Tcl object. Any attempt to set the value of a shared
53 Tcl object violates Tcl's copy-on-write policy. Any existing string
54 representation or internal representation in the unshared Tcl object
55 will be freed as a consequence of setting the new value.
56
57 Tcl_GetDoubleFromObj attempts to retreive a double value from the Tcl
58 object objPtr. If the attempt succeeds, then TCL_OK is returned, and
59 the double value is written to the storage pointed to by doublePtr. If
60 the attempt fails, then TCL_ERROR is returned, and if interp is non-
61 NULL, an error message is left in interp. The Tcl_ObjType of objPtr
62 may be changed to make subsequent calls to Tcl_GetDoubleFromObj more
63 efficient.
64
66 Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult
67
69 double, double object, double type, internal representation, object,
70 object type, string representation
71
72
73
74Tcl 8.0 Tcl_DoubleObj(3)