comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » character class conversions
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
character class conversions [message #56328] Wed, 10 October 2007 14:29
jkj is currently offline  jkj
Messages: 48
Registered: April 2007
Member
Hi,

I found a resolution to my obstacle but the initial problem makes me
want to raise a question. I have two date/times expressed as
YYYYMMDDHHMMSS and wanted to find the mid-point date/time, initially
dividing their sum by "2.", giving me a double:

% set btime "19000101000000"
19000101000000
% set etime "21001231235959"
21001231235959
% set mid_time [expr {($btime + $etime) / 2.}]
2.0000666118e+13

...what I should have done was divide by "2"
% set mid_time [expr ($btime + $etime) / 2]
20000666117979

...but I never did come to grips with how to convert the double to an
integer and type-casting does not appear to be a friendly piece of
Tcl? I found one post related to type-casting and it was rather
involved with the poster providing five separate functions... isn't
there a simple way to take "2.0000666118e+13" and convert it to the
string "20000666117979"?

I notice that
"string is double $mid_time" returns true for the double and
"string is alnum $mid_time" returns true for the integer,
so it seems reasonable to think that Tcl provides some way of
converting from the character class double to alnum - am I overlooking
something simple?

Thanks,
-Kevin
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: envi_evf_define_add_record problem (possible output format/rounding issue)
Next Topic: Memory handling in IDL VM

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:40:41 PDT 2025

Total time taken to generate the page: 0.00507 seconds