similar to: sqrt(-x) vs. -x^0.5

Displaying 20 results from an estimated 7000 matches similar to: "sqrt(-x) vs. -x^0.5"

2005 Nov 20
1
Problems getting Gravity to run
Hi, I'm having difficulties getting the news reader, Gravity, running reliably. Gravity installed okay, and I ran it for a single session. During that test, the following messages appeared many times: fixme:richedit:RichEditANSIWndProc EM_CHARFROMPOS: stub fixme:richedit:RichEditANSIWndProc EM_LINEFROMCHAR: stub fixme:richedit:RichEditANSIWndProc EM_LINEINDEX: stub
2013 Apr 23
0
[LLVMdev] Optimize away sqrt in simple cases?
On Apr 23, 2013, at 3:33 PM, Christoph Grenz <christophg+llvm at grenz-bonn.de> wrote: > Hello, > > Am Dienstag, 23. April 2013, 13:26:19 schrieb Owen Anderson: >> That's a pretty seriously unsafe floating point optimization. It could be >> done in fast-math mode, but I doubt we currently do it. > > I just saw this thread and wonder why it's
2009 Jun 26
1
gradient fill of a grid.polygon
Dear list, Following a recent enquiry, I've been playing with the idea of creating a colour gradient for a polygon, using the Grid package. The idea is to draw a number of stripes of different colours, using the grid.clip function. Below is my current attempt at this, library(grid) rotate.polygon <- function(g, angle=0){ # utility function, works fine matR <- matrix(c(cos(angle),
2005 Jan 08
1
Connection problems and weird WinSock warnings...
Hiya, I've posted this 'enigma' on the newsgroup : http://groups-beta.google.com/group/comp.emulators.ms-windows.wine/browse_thread/thread/57dcb7531ebfb529/65018c77a5e58651#65018c77a5e58651 The answers were pretty rare so I post the problem here, too. " I'm getting connection problems with an application run under Wine which isn't acting like that under a native Windows
2010 Jun 26
1
boot with strata: strata argument ignored?
Hello All. I must be missing the really obvious here: mm <- function(d, i) median(d[i]) b1 <- boot(gravity$g, mm, R = 1000) b1 b2 <- boot(gravity$g, mm, R = 1000, strata = gravity$series) b2 Both b1 and b2 seem to have done (almost) the same thing, but it looks like the strata argument in b2 has been ignored. However, str(b1) vs str(b2) does show that the strata have been noted
2013 Apr 24
5
[LLVMdev] Optimize away sqrt in simple cases?
> This is not true. The mathematically correct result for sqrt might not be a representable value in floating point, so rounding may occur between the two steps. In that case, pow2(sqrt(x)) != x. > > --Owen I think what Christoph is saying is that x will always be at least as accurate as pow2(sqrt(x)), so it's only unsafe in so far as one's code is actually depending on an
2013 Apr 24
0
[LLVMdev] Optimize away sqrt in simple cases?
On Apr 23, 2013, at 7:15 PM, Stephen Lin <swlin at post.harvard.edu> wrote: >> This is not true. The mathematically correct result for sqrt might not be a representable value in floating point, so rounding may occur between the two steps. In that case, pow2(sqrt(x)) != x. > > I think what Christoph is saying is that x will always be at least as > accurate as pow2(sqrt(x)),
2017 Mar 17
3
Support for user defined unary functions
I agree there is no reason they _need_ to be the same precedence, but I think SPECIALS are already have the proper precedence for both unary and binary calls. Namely higher than all the binary operators (except for `:`), but lower than the other unary operators. Even if we gave unary specials their own precedence I think it would end up in the same place. `%l%` <- function(x) tail(x, n =
2017 Mar 16
4
Support for user defined unary functions
R has long supported user defined binary (infix) functions, defined with `%fun%`. A one line change [1] to R's grammar allows users to define unary (prefix) functions in the same manner. `%chr%` <- function(x) as.character(x) `%identical%` <- function(x, y) identical(x, y) %chr% 100 #> [1] "100" %chr% 100 %identical% "100" #> [1] TRUE
2011 Dec 16
3
[LLVMdev] llvm/clang test failures on powerpc-darwin8
Hi, Thanks for the quick reply again. > On Thu, Dec 15, 2011 at 1:17 PM, David Fang <fang at csl.cornell.edu> wrote: >> Hi, >> >> I've bootstrapped llvm/clang from svn-trunk on powerpc-darwin8 (g++-4.0.1), and >> have the following test results to share. >> Summary below, full log at: >>
2017 Mar 17
2
Support for user defined unary functions
>After off list discussions with Jonathan Carrol and with >Michael Lawrence I think it's doable, unambiguous, >and even imo pretty intuitive for an "unquote" operator. For those of us who are not CS/Lisp mavens, what is an "unquote" operator? Can you expression quoting and unquoting in R syntax and show a few examples where is is useful, intuitive, and fits in to
2017 Mar 17
2
Support for user defined unary functions
Your example x = 5 exp = parse(text="f(uq(x)) + y +z") # expression: f(uq(x)) +y + z do_unquote(expr) # -> the language object f(5) + y + z could be done with the following wrapper for bquote my_do_unquote <- function(language, envir = parent.frame()) { if (is.expression(language)) { # bquote does not go into expressions, only calls
2017 Mar 17
2
Support for user defined unary functions
The unquoting discussion is IMHO separate from this proposal and as you noted probably better served by a native operator with different precedence. I think the main benefit to providing user defined prefix operators is it allows package authors to experiment with operator ideas and gauge community interest. The current situation means any novel unary semantics either need to co-opt existing
2017 Mar 16
2
Support for user defined unary functions
I guess this would establish a separate "namespace" of symbolic prefix operators, %*% being an example in the infix case. So you could have stuff like %?%, but for non-symbolic (spelled out stuff like %foo%), it's hard to see the advantage vs. foo(x). Those examples you mention should probably be addressed (eventually) in the core language, and it looks like people are already able
2017 Mar 16
2
Support for user defined unary functions
Gabe, The unary functions have the same precedence as normal SPECIALS (although the new unary forms take precedence over binary SPECIALS). So they are lower precedence than unary + and -. Yes, both of your examples are valid with this patch, here are the results and quoted forms to see the precedence. `%chr%` <- function(x) as.character(x) `%identical%` <- function(x, y)
2008 Mar 13
2
Making custom unary operators in R
Hello, Is there a way to define a custom unary operator in R (other than making a class and 'overloading' the normal unary operators in R)? The documentation seems to suggest that only custom binary operators are possible with the ``%abc%``construct but I was wondering whether any one has done so. None of the RSiteSearch or RSeek queries I posed suggested that this question had
2017 Mar 16
2
Support for user defined unary functions
Martin, Jim can speak directly to his motivations; I don't claim to be able to do so. That said, I suspect this is related to a conversation on twitter about wanting an infix "unquote" operator in the context of the non-standard evaluation framework Hadley Wickham and Lionel Henry (and possibly others) are working on. They're currently using !!! and !! for things related to
2005 Jan 07
1
Creating unary operators
Is it correct (by its lack of mention in the R-Language Definition Manual) that it is impossible to create a user-defined unary operator? Ex: (This doesn't work, but it's an example of what I'm looking for) > "%PLUSONE%" <- function(x) x + 1 > %PLUSONE% 2 [1] 3 And if the above is impossible, am I limited to only the + - ~ ! unary operators for overloading? On
2007 May 07
3
like apply(x,1,sum), but using multiplication?
Hi, I need to multiply all columns in a matrix so something like apply(x,2,sum), but using multiplication should do. I have tried apply(x,2,"*") I know this must be trivial, but I get: Error in FUN(newX[, i], ...) : invalid unary operator The help for apply states that unary operators must be quoted. I tried single quotes too, with the same results. Thanks, -Jose -- Jose
2006 Jan 06
7
Multiplication (PR#8466)
hi - in version 2.1 the command >-2^2 gives -4 as the answer. (-2)^2 is evaluated correctly. Cheers, George Casella -- George Casella Phone: (352) 392-1941 Ext. 204 Distinguished Professor and Chair Cell: (352) 682-7210 Department of Statistics Fax: (352) 392-5175 University of Florida Email: casella at stat.ufl.edu P.O. Box 118545 Gainesville, FL