Displaying 20 results from an estimated 20000 matches similar to: "Modification-proposal for %% (modulo) when supplied with double"
2018 Sep 11
1
Modification-proposal for %% (modulo) when supplied with double
Duncan, I think Emil realizes that the floating point format isn't
able to represent certain numbers, that's why he is suggesting this
change rather than complaining about our arithmetic being broken.
However, I agree with you that we should not adopt his proposal. It
would not make things more "user friendly" for people. Everyone has a
different application and a different use
2018 Sep 11
0
Modification-proposal for %% (modulo) when supplied with double
On 11/09/2018 11:23 AM, Emil Bode wrote:
> Hi all,
>
>
>
> Could we modify the "%%" (modulo)-operator to include some tolerance for rounding-errors when supplied with doubles?
>
> It's not much work (patch supplied on the bottom), and I don't think it would break anything, only if you were really interested in analysing rounding differences.
>
>
2018 Aug 31
2
compairing doubles
El vie., 31 ago. 2018 a las 16:00, Mark van der Loo
(<mark.vanderloo at gmail.com>) escribi?:
>
> how about
>
> is_evenly_spaced <- function(x,...) all.equal(diff(sort(x)),...)
This doesn't work, because
1. all.equal does *not* return FALSE. Use of isTRUE or identical(.,
TRUE) is required if you want a boolean.
2. all.equal compares two objects, not elements in a vector.
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),
2008 Feb 18
2
Number of digits of a value for problem 7.31 RFAQ
Hello dear R users!
I did not find a function which gives information about the number of
digits of a value shown by R.
Do you know one?
I need it to solve the problem (see RFAQ 7.31)that 0.2==0.2+0.1-0.1 FALSE
The solution suggested in RFAQ is to use isTRUE(all.equal(0.2,0.2+0.1-0.1))
But if I want to compare inequality:
0.2<=0.2 +0.1-0.1 TRUE
but 0.2<=0.2 +0.1-0.1 FALSE
bad!
but in
2006 Mar 16
1
lme4/Matrix: Call to .Call("mer_update_y"...) and LMEoptimize gives unexpected side effect...
Dear all
I want to compute Monte Carlo p-values in lmer-models based on sampled data sets. To speed up calculations, I've tried to use internal functions from the Matrix package (as suggested ealier on the list by Doug Bates).
So I did:
fm2 <- lmer(resistance ~ ET + position + (1|Grp), Semiconductor,method='ML')
simdata<-simulate(fm2,nsim=1)
ynew <- simdata[,1]
mer
2009 Mar 24
4
Error in FrF2 example on Mac OS
Dear all,
I just noticed that the 0.9 update for FrF2 did not work out for Mac OS due
to an error in an example that ran without error on all other platforms. I
do not find any reason for this. In the past, umlauts or tab characters have
sometimes been an issue, but I didn't find any of these. The function
definition is
FrF2(nruns = NULL, nfactors = NULL, factor.names = if
2018 Sep 03
2
compairing doubles
Maybe a new Operator could be defined for a fast and easy double
Comparison: `~~`
`~~` <- function (e1, e2) all.equal(e1, e2)
And document it properly.
2005 Oct 21
1
The behavior of match function
> x<-1:10
> y<-x+1e-20
> x
[1] 1 2 3 4 5 6 7 8 9 10
> y
[1] 1 2 3 4 5 6 7 8 9 10
> identical(x,y)
[1] FALSE
> match(x,y)
[1] 1 2 3 4 5 6 7 8 9 10
What's the principle the function use to determine if x match y?
Thank you!
2005-10-21
------
Deparment of Sociology
Fudan University
My new mail addres is ronggui.huang at gmail.com
2005 Aug 29
5
Testing if all elements are equal in a vector/matrix
Is there a canonical way to check if all elements of a vector or matrix are
the same? Solutions below work, but look hackish to me.
> x <- rep(1, 10)
> all(x == x[1]) # == operator does not provide for small differences
[1] TRUE
> isTRUE(all.equal(x, rep(x[1], length(x)))) # ugly
[1] TRUE
Best,
Vincent
--
Vincent Goulet, Associate Professor
??cole d'actuariat
2007 Sep 03
3
When 1+2 != 3 (PR#9895)
Full_Name: Marco Vicentini, University of Verona
Version: 2.4.1 & 2.5.1
OS: OsX & WinXP
Submission from: (NULL) (157.27.253.46)
When I proceed to test the following equation 1 + 2 == 3, I obviously obtain the
value TRUE. But when I tryed to do the same using real number (i.e. 0.1 + 0.2 ==
0.3) I obtained an unusual FALSE.
In the online help there are some tricks for this problem. It
2014 Nov 10
2
[LLVMdev] About inlining the modulo function in ARM architecture
Hi all,
Sorry for bothering those not interested. I found that ARM backend will
insert a modulo function
(like __modsi3) instead of the modulo instruction. I wonder how we can
inline the modulo function
into the program. Is there any OPTION we can use in the opt or llc?
Thanks,
Ray
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Feb 03
2
all.equal() and which()
Please excuse the lack of a complete dataset here, if its needed I'll be
happy to provide it.
Can anyone show me how to rewrite this?
Browse[1]> time(data)[24210:24220]
[1] 24.209 24.210 24.211 24.212 24.213 24.214 24.215 24.216 24.217
[10] 24.218 24.219
Browse[1]> which(time(data)==24.211)
numeric(0)
I'm assuming its an eps fault but
which(all.equal(time(data),24.211))
dosnt
2013 Jan 23
2
[LLVMdev] Order of optimization: modulo scheduling & register allocation
I was reading about the order of optimizations in the code generation stage
here:
http://llvm.org/docs/CodeGenerator.html#the-high-level-design-of-the-code-generator
This is the part that's interesting to me:
3. SSA-based Machine Code
Optimizations<http://llvm.org/docs/CodeGenerator.html#ssa-based-machine-code-optimizations>—
This optional stage consists of a series of machine-code
2020 Jan 10
2
SUGGESTION: Settings to disable forked processing in R, e.g. parallel::mclapply()
I'd like to pick up this thread started on 2019-04-11
(https://hypatia.math.ethz.ch/pipermail/r-devel/2019-April/077632.html).
Modulo all the other suggestions in this thread, would my proposal of
being able to disable forked processing via an option or an
environment variable make sense? I've prototyped a working patch that
works like:
> options(fork.allowed = FALSE)
>
2013 Dec 09
0
[LLVMdev] [cfe-dev] ARM EABI and modulo
On Mon, Dec 09, 2013 at 03:11:45PM +0100, Joerg Sonnenberger wrote:
> On Mon, Dec 09, 2013 at 01:58:29PM +0000, Renato Golin wrote:
> > I can see the error, and it's just a bad selection of choices. I was
> > wrong in assuming that the "eabi" at the end would always force it:
> >
> > $ clang -target arm-elf-eabi -S mod.c -o - | grep mod
> > .file
2018 Aug 31
0
compairing doubles
Ah, my bad, you're right of course.
sum(abs(diff(diff( sort(x))))) < eps
for some reasonable eps then, would do as a oneliner, or
all(abs(diff(diff(sort(x)))) < eps)
or
max(abs(diff(diff(sort(x))))) < eps
-Mark
Op vr 31 aug. 2018 om 16:14 schreef I?aki Ucar <iucar at fedoraproject.org>:
> El vie., 31 ago. 2018 a las 16:00, Mark van der Loo
> (<mark.vanderloo at
2018 Aug 31
0
compairing doubles
how about
is_evenly_spaced <- function(x,...) all.equal(diff(sort(x)),...)
(use ellipsis to set tolerance if necessary)
Op vr 31 aug. 2018 om 15:46 schreef Emil Bode <emil.bode at dans.knaw.nl>:
> 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
2013 Dec 09
3
[LLVMdev] [cfe-dev] ARM EABI and modulo
On Mon, Dec 09, 2013 at 01:58:29PM +0000, Renato Golin wrote:
> I can see the error, and it's just a bad selection of choices. I was
> wrong in assuming that the "eabi" at the end would always force it:
>
> $ clang -target arm-elf-eabi -S mod.c -o - | grep mod
> .file "mod.c"
> bl __modsi3
> bl __umodsi3
I was discussing this with Tim on IRC and he
2013 Jan 24
0
[LLVMdev] Order of optimization: modulo scheduling & register allocation
On Jan 23, 2013, at 3:45 PM, ryan baird <ryanrbaird at gmail.com> wrote:
> I was reading about the order of optimizations in the code generation stage here: http://llvm.org/docs/CodeGenerator.html#the-high-level-design-of-the-code-generator
>
> This is the part that's interesting to me:
>
> 3. SSA-based Machine Code Optimizations — This optional stage consists of a