Re: [Rd] as.numeric(levels(factor(x))) may be a decreasing sequence

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Fri, 29 May 2009 15:22:35 +0200

>>>>> "PS" == Petr Savicky <savicky_at_cs.cas.cz> >>>>> on Thu, 28 May 2009 09:36:48 +0200 writes:

    PS> On Wed, May 27, 2009 at 10:51:38PM +0200, Martin Maechler wrote:
>> I have very slightly modified the changes (to get rid of -Wall
>> warnings) and also exported the function as Rf_dropTrailing0(),
>> and tested the result with 'make check-all' .

    PS> Thank you very much for considering the patch. -Wall indeed requires to add 
    PS> parentheses
    PS> warning: suggest parentheses around comparison in operand of &
    PS> warning: suggest parentheses around assignment used as truth value

    PS> If there are also other changes, i would like to ask you to make your modification     PS> available, mainly due to a possible further discussion.

    PS> Let me also suggest a modification of my original proposal. It contains a cycle
    PS> while (*(replace++) = *(p++)) {
    PS> ;
    PS> }
    PS> If the number has no trailing zeros, but contains an exponent, this cycle
    PS> shifts the exponent by 0 positions, which means that it copies each of its
    PS> characters to itself. This may be eliminated as follows
    PS> if (replace != p) {
    PS>    while (*(replace++) = *(p++)) {
    PS>       ;
    PS>    }
    PS> }

yes, that's a simple improvement, thank you. Martin



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 29 May 2009 - 13:25:26 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 29 May 2009 - 14:34:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive