[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

More single precision



PureBytes Links

Trading Reference Links

For the doubters about how easy it is to trip over single precision,
here's a lame one for you. As we all know, EL expresses year 2000 dates
in the form 100mmdd. I wanted to write a file with yyyymmdd dates that
Excel could read so I did...

value1 = 19000000 + date;
fileappend("d:\temp.txt", numtostr(value1,0), + blah, blah...);

Excel choked on a few of the dates when I opened the file and I realized
that TS blew the addition and gave me illegal dates. Here are a few...

20000300
20000132
19990832
19990400
19990300
19981200
19980900
19971032
19970400
19970332

So, I had to assume that none of the date calcs were correct because of
single precision rounding errors. I had to rewrite the code to write
mm/dd/yyyy dates to the file to be sure they were right. TS can handle
1900 + year(date) so I got it done with a few extra lines of code.
Sheesh, what an unnecessary pain in the butt.

-- 
  Dennis