From p.murrell at auckland.ac.nz  Mon Oct 13 01:39:21 2003
From: p.murrell at auckland.ac.nz (p.murrell@auckland.ac.nz)
Date: Mon Oct 13 01:38:28 2003
Subject: [Rd] zapsmall with all values small (PR#4554)
Message-ID: <200310122339.h9CNdL0P024293@pubhealth.ku.dk>

Hi

If all values are small, zapsmall does not zap.

For example ...

 > zapsmall(1e-24)
[1] 1e-24
 > zapsmall(1e-24, digits=3)
[1] 1e-24

Problem appears to be in calculation of digits ...

     mx <- max(abs(x[!ina]))
     digits = if (mx > 0)
                max(0, digits - log10(mx))
              else
                digits

If all values are small, mx is very small, log10(mx) is "large" but 
negative, digits - log10(mx) is very large, so no rounding occurs.

Paul
--please do not edit the information below--

Version:
  platform = i686-pc-linux-gnu
  arch = i686
  os = linux-gnu
  system = i686, linux-gnu
  status = Under development (unstable)
  major = 1
  minor = 9.0
  year = 2003
  month = 10
  day = 12
  language = R

Search Path:
  .GlobalEnv, package:gridBase, package:methods, package:ctest, 
package:mva, package:modreg, package:nls, package:ts, package:lattice, 
package:grid, package:graphicsQC, Autoloads, package:base

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/


[Rd] zapsmall with all values small (PR#4554)
p.murrell@auckland.ac.nz