[GiDlist] formatting in tcl

Moderator: GiD Team

Post Reply
Andreas Friedberg

[GiDlist] formatting in tcl

Post by Andreas Friedberg »

Hi Enrique,

your advice about the renumbering of nodes was very useful.
I have a question about specifying a certain format for floating point and integer values in tcl. I would like to prescribe floating point and integer format for certain values that I need to write into a file. I need also to transform certain integer values into floating point values and vice versa. I tried to figure out the tcl command for these operations, but I couldn't find any except the command format which is used for strings.
What tcl command allows these operations?

thanks for your response,

Andreas Friedberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20030205/da7b0eb7/attachment.htm
Enrique Escolano

[GiDlist] formatting in tcl

Post by Enrique Escolano »

The tcl command is format, the format string is any valid C printf format. for example:
format "%lf" 3.5
3.5 must be a float
to truncate a float to a integer use expr to evaluate a mathematical expression:
expr int(3.5)

Enrique
----- Original Message -----
From: Andreas Friedberg
To: GiD mailinglist
Sent: Wednesday, February 05, 2003 9:33 PM
Subject: [GiDlist] formatting in tcl


Hi Enrique,

your advice about the renumbering of nodes was very useful.
I have a question about specifying a certain format for floating point and integer values in tcl. I would like to prescribe floating point and integer format for certain values that I need to write into a file. I need also to transform certain integer values into floating point values and vice versa. I tried to figure out the tcl command for these operations, but I couldn't find any except the command format which is used for strings.
What tcl command allows these operations?

thanks for your response,

Andreas Friedberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20030205/62ce93b7/attachment.htm
Miguel A. de Riera Pasenau

[GiDlist] formatting in tcl

Post by Miguel A. de Riera Pasenau »

to get a real value from an integer:

for expresions:

set int_value 1234
set res [ expr log( double( $int_value))]

for format, you can do this too:

format "%f" $int_value

miguel

--------------------------------------------------------------------------------
Miguel A. de Riera Pasenau miguel at cimne.upc.es http://gid.cimne.upc.es
Post Reply