1Tcl_DoubleObj(3) Tcl Library Procedures Tcl_DoubleObj(3)
2
3
4
5______________________________________________________________________________
6
8 Tcl_NewDoubleObj, Tcl_SetDoubleObj, Tcl_GetDoubleFromObj - manipulate
9 Tcl values 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 value.
26
27 Tcl_Obj *objPtr (in/out) For Tcl_SetDoubleObj, this points
28 to the value in which to store a
29 double value. For Tcl_GetDouble‐
30 FromObj, this refers to the value
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 values that
45 hold double-precision floating-point values.
46
47 Tcl_NewDoubleObj creates and returns a new Tcl value initialized to the
48 double value doubleValue. The returned Tcl value is unshared.
49
50 Tcl_SetDoubleObj sets the value of an existing Tcl value pointed to by
51 objPtr to the double value doubleValue. The objPtr argument must point
52 to an unshared Tcl value. Any attempt to set the value of a shared Tcl
53 value violates Tcl's copy-on-write policy. Any existing string repre‐
54 sentation or internal representation in the unshared Tcl value will be
55 freed as a consequence of setting the new value.
56
57 Tcl_GetDoubleFromObj attempts to retrieve a double value from the Tcl
58 value 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 value, double type, internal representation, value,
70 value type, string representation
71
72
73
74Tcl 8.0 Tcl_DoubleObj(3)