ropensci / BaseSet

Provides classes for working with sets
https://docs.ropensci.org/BaseSet
Other
10 stars 3 forks source link

Numeric precision problems #30

Open llrs opened 4 years ago

llrs commented 4 years ago

Related to *_size being slow and related to #29 (which aims to reduce the time of calculation) of the set size.

Using this function we can calculate the number of combinations:

combn_pos <- function(x) {
    y0 <- seq(from = 0, to = x, by = 1)
    y <- choose(x, y0)
    names(y) <- as.character(y0)
    y
}
y <- combn_pos(1030)
y[!is.infinite(y)]

Up to 499 elements out of 1030 it is possible to calculate the number of combinations. Or y3 <- combn_pos(1029) and we don't have Inf and we can calculate the combinations for up to 514 elements. More than this is only Inf.

llrs commented 4 years ago

Also multiplying 729 numbers between 0 and 1 seems to make the result 0 (the opposite case than the issue above). It seems that we can arrive to the floating precision problems quickly with this method