andrea.capodicasa@albacom.it
2003-Aug-18 16:21 UTC
[Rd] round.POSIXt sometimes crashes R (PR#3763)
Full_Name: andrea capodicasa Version: 1.7.0 OS: w2k sp3 Submission from: (NULL) (212.17.194.154) Hi all, the problem is when you try to round.Posix an empty vector of dates Please give a look to this code:> data=seq(ISOdate(2001,1,1),by="day",length=3) > data[1] "2001-01-01 13:00:00 ora solare Europa occidentale" [2] "2001-01-02 13:00:00 ora solare Europa occidentale" [3] "2001-01-03 13:00:00 ora solare Europa occidentale" this works:> non.crasha=round(data[c(F,F,T)],"day") > non.crasha[1] "2001-01-04" this (subsetting data with an empty set) crashes R on w2k crasha=round(data[c(F,F,F)],"day") these are infos about my R> R.version_ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 1 minor 7.0 year 2003 month 04 day 16 language R --- TIA Andrea Capodicasa
maechler@stat.math.ethz.ch
2003-Aug-18 17:35 UTC
[Rd] round.POSIXt sometimes crashes R (PR#3763)
Grazie mille, Andrea, for the bug report!>>>>> "AndreaC" == andrea capodicasa <andrea.capodicasa@albacom.it> >>>>> on Mon, 18 Aug 2003 16:21:45 +0200 (MET DST) writes:AndreaC> Full_Name: andrea capodicasa Version: 1.7.0 OS: w2k AndreaC> sp3 Submission from: (NULL) (212.17.194.154) AndreaC> Hi all, the problem is when you try to round.Posix AndreaC> an empty vector of dates I can confirm the problem on Linux, using a much newer version of R (R-devel of today). A bit shorter version:> round(ISOdate(2001,1,1)[0], "day")Process R gleitkomma-Ausnahme at Mon Aug 18 17:23:44 2003 ^^^^^^^^^^^^^^^^^^^ ( = locale-translation of "floating point exception" ) -------------- The same for Linux and Solaris: Using "R -d gdb" and "bt" (= backtrace) after the error reveals (gdb) bt #0 0xfefbee9c in .rem () from /usr/lib/libc.so.1 #1 0x0004e4b4 in do_formatPOSIXlt (call=0xebc9c8, op=0xebc9c8, args=0xed2fb8, env=0x1) at ../../../R/src/main/datetime.c:565 ...... ....... ----------------- There's an obvious way to fix this bug on the R- (as opposed to C-) level, and I'd probably just do it. However, I wonder if the logic in the above C code is okay.. Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <><