On 09-Oct-11 00:46:58, Carl Witthoft wrote: > > On 10/8/11 6:11 PM, (Ted Harding) wrote: > >> Carl Witthoft's serendipitous discovery is a nice example >> of how secrets can be guessed by wondering "what if ... ?". >> So probably you don;t need to tell the secrets. >> >> Taking the "negative digits" to their logical extreme: >> >> round(654.321,2) >> # [1] 654.32 >> round(654.321,1) >> # [1] 654.3 >> round(654.321,0) >> # [1] 654 >> round(654.321,-1) >> # [1] 650 >> round(654.321,-2) >> # [1] 700 >> round(654.321,-3) >> # [1] 1000 >> round(654.321,-4) >> # [1] 0 >> >> which is what you'd logically expect (but is it what you >> would intuitively expect?). >> > Oh, oh, somebody's going all metaphysical on us.
Nor should one forget the rounding rules (not OS-dependent in this case, I think ... ?): round(5000,-4) # [1] 0 round(15000,-4) # [1] 20000 Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <ted.hard...@wlandres.net> Fax-to-email: +44 (0)870 094 0861 Date: 09-Oct-11 Time: 08:59:58 ------------------------------ XFMail ------------------------------ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.