Re: [R] exactly representable numbers

From: Robin Hankin <r.hankin_at_noc.soton.ac.uk>
Date: Mon 11 Sep 2006 - 15:01:21 GMT

Hi Duncan

[snip]

On 11 Sep 2006, at 12:12, Duncan Murdoch wrote:

> Here's my version: not tested too much.
>
> f <- function(x) {
> u <- x
> l <- 0
> mid <- u/2
> while (l < mid && mid < u) {
> if (x < x + mid) u <- mid
> else l <- mid
> mid <- (l + u)/2
> }
> u
> }
>

thanks for this. Wouldn't it be a good idea to have some function that returns "the smallest exactly representable number strictly greater than x"?

Or does this exist already?

Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK

  tel 023-8059-7743



R-help@stat.math.ethz.ch 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. Received on Tue Sep 12 01:06:14 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 11 Sep 2006 - 16:30:31 GMT.

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