[scilab-Users] Datevec Problem in scilab

Mike Page Mike at Page-One.Waitrose.com
Mon Mar 19 10:59:20 CET 2012


Hi,

AFAIK, datenum uses the integer part for the date and the fractional part
for the time.  There are rounding errors and limited precision which make
your result very slightly inaccurate.  datevec gives the number of seconds
as a fraction, so if you are sure your values are all whole numbers of
seconds, you can do some rounding like:

-->int(datevec(datenum(2010,4,6,1,0,0) + (0.5/24/60/60)))
 ans  =

    2010.    4.    6.    1.    0.    0.

But if your times have fractions of a second, then you can never represent
them to infinite precision...

HTH,
Mike.


-----Original Message-----
From: gourish [mailto:gourish2k at gmail.com]
Sent: 19 March 2012 08:41
To: users at lists.scilab.org
Subject: [scilab-Users] Datevec Problem in scilab


hi,

i had run the following instruction in scilab

"*datevec(datenum(2010,4,6,1,0,0))*"
which gives the result as "*ans = 2010. 4. 6. 0. 59. 59.999997*" instead of
"*ans = 2010. 4. 6. 1. 0. 0.*"

is there any solution for the problem?

Thanks,
Gourish


--
View this message in context:
http://mailinglists.scilab.org/Datevec-Problem-in-scilab-tp3838494p3838494.h
tml
Sent from the Scilab users - Mailing Lists Archives mailing list archive at
Nabble.com.

--
To unsubscribe from this mailing-list, please send an empty mail to
users-unsubscribe at lists.scilab.org
To check the archives of this mailing list, see
http://mailinglists.scilab.org/




More information about the users mailing list