the t_atom -> Tcl_Obj converasion happens in tcl_class.c using the pdatom_to_tcl function (defined in tcl_typemap.c) since pd has only one numeric type (float), the conversion is as follows:
switch (input->a_type) { [...] case A_FLOAT: { tcl_t_atom[0] = Tcl_NewStringObj("float", -1); tcl_t_atom[1] = Tcl_NewDoubleObj(input->a_w.w_float); break; [...]
so, it gets converted to a [internal] double in tcl (hence, any number appears as a floating point number, integers as well). note that in tcl, in addition to DoubleObj, there are IntObj, LongObj, WideIntObj. would you use those? or what you propose? actually there is no formatting involved, 1.0 it's just how a float appears by default in tcl e.g. when you print it.
Il 12/11/2011 06:27, Hans-Christoph Steiner ha scritto:
Just playing around with tclpd, pd::strip_selector makes working with the lists nice and easy in Tcl. One thing though: floats are rendered with trailing zeros, so [float 1( is rendered as {float 1.0} in tclpd. tclpd should really use [format %g $arg] to format the floats so that they are the same format as Pd. Pd uses printf("%g", arg).
.hc
"Making boring techno music is really easy with modern tools, but with live coding, boring techno is much harder." - Chris McCormick