[Rd] round.POSIXt sometimes crashes R (PR#3763)

maechler at stat.math.ethz.ch maechler at stat.math.ethz.ch
Mon Aug 18 18:35:34 MEST 2003

Grazie mille, Andrea,
for the bug report!

>>>>> "AndreaC" == andrea capodicasa <andrea.capodicasa at 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) (

    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 at 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			<><

More information about the R-devel mailing list