search for: is_continous_evenly_spac

Displaying 7 results from an estimated 7 matches for "is_continous_evenly_spac".

2018 Aug 30
4
compairing doubles
Dear all, I a bit unsure, whether this qualifies as a bug, but it is definitly a strange behaviour. That why I wanted to discuss it. With the following function, I want to test for evenly space numbers, starting from anywhere. .is_continous_evenly_spaced <- function(n){ if(length(n) < 2) return(FALSE) n <- n[order(n)] n <- n - min(n) step <- n[2] - n[1] test <- seq(from = min(n), to = max(n), by = step) if(length(n) == length(test) && all(n == test)){ return(TRUE) } return(FALSE) } > .is_cont...
2018 Aug 31
3
compairing doubles
Agreed that's it's rounding error, and all.equal would be the way to go. I wouldn't call it a bug, it's simply part of working with floating point numbers, any language has the same issue. And while we're at it, I think the function can be a lot shorter: .is_continous_evenly_spaced <- function(n){ length(n)>1 && isTRUE(all.equal(n[order(n)], seq(from=min(n), to=max(n), length.out = length(n)))) } Cheers, Emil El vie., 31 ago. 2018 a las 15:10, Felix Ernst (<felix.gm.ernst at outlook.com>) escribi?: > > Dear all, > &gt...
2018 Aug 31
2
compairing doubles
...#39;s it's rounding error, and all.equal would be the way to go. >> I wouldn't call it a bug, it's simply part of working with floating point numbers, any language has the same issue. >> >> And while we're at it, I think the function can be a lot shorter: >> .is_continous_evenly_spaced <- function(n){ >> length(n)>1 && isTRUE(all.equal(n[order(n)], seq(from=min(n), to=max(n), length.out = length(n)))) >> } >> >> Cheers, Emil >> >> El vie., 31 ago. 2018 a las 15:10, Felix Ernst >> (<felix.gm.ernst at outlook.co...
2018 Aug 31
0
compairing doubles
...greed that's it's rounding error, and all.equal would be the way to go. > I wouldn't call it a bug, it's simply part of working with floating point > numbers, any language has the same issue. > > And while we're at it, I think the function can be a lot shorter: > .is_continous_evenly_spaced <- function(n){ > length(n)>1 && isTRUE(all.equal(n[order(n)], seq(from=min(n), to=max(n), > length.out = length(n)))) > } > > Cheers, Emil > > El vie., 31 ago. 2018 a las 15:10, Felix Ernst > (<felix.gm.ernst at outlook.com>) escribi?: >...
2018 Aug 31
0
compairing doubles
...rror, and all.equal would be the way to go. > >> I wouldn't call it a bug, it's simply part of working with floating > point numbers, any language has the same issue. > >> > >> And while we're at it, I think the function can be a lot shorter: > >> .is_continous_evenly_spaced <- function(n){ > >> length(n)>1 && isTRUE(all.equal(n[order(n)], seq(from=min(n), > to=max(n), length.out = length(n)))) > >> } > >> > >> Cheers, Emil > >> > >> El vie., 31 ago. 2018 a las 15:10, Felix Ernst > >&g...
2018 Aug 31
0
compairing doubles
...t at outlook.com>) escribi?: > > Dear all, > > I a bit unsure, whether this qualifies as a bug, but it is definitly a strange behaviour. That why I wanted to discuss it. > > With the following function, I want to test for evenly space numbers, starting from anywhere. > > .is_continous_evenly_spaced <- function(n){ > if(length(n) < 2) return(FALSE) > n <- n[order(n)] > n <- n - min(n) > step <- n[2] - n[1] > test <- seq(from = min(n), to = max(n), by = step) > if(length(n) == length(test) && > all(n == test)){ > return(TR...
2018 Aug 31
2
compairing doubles
...error, and all.equal would be the way to go. >>>> I wouldn't call it a bug, it's simply part of working with floating >> point numbers, any language has the same issue. >>>> And while we're at it, I think the function can be a lot shorter: >>>> .is_continous_evenly_spaced <- function(n){ >>>> length(n)>1 && isTRUE(all.equal(n[order(n)], seq(from=min(n), >> to=max(n), length.out = length(n)))) >>>> } >>>> >>>> Cheers, Emil >>>> >>>> El vie., 31 ago. 2018 a las 15:10,...