complex numbers in library function (PR#1737)

alex.deckmyn@oma.be alex.deckmyn@oma.be
Wed, 3 Jul 2002 14:25:59 +0200 (MET DST)


Full_Name: Alex Deckmyn
Version: 1.5.1
OS: Linux Mandrake 7.0
Submission from: (NULL) (193.190.63.62)


A short function in a library contains the complex number -2i :

phihat <- function(x)
  {
x+ (-2i)
  }


If i read the source file with source("phihat") this works fine. If I include it
as
 a function in a library and read it with library(test), the function is still 
read corectly, but when I print it out it shows as

> phihat
function (x)
{
    x + (-0+2i)
}

Internally R still uses (-2i) though:
> phihat(0)
[1] 0-2i

The problem only seems to occur when the function is part of a library. 
When I read the same function via source:

> source("~/software/R-libs/test/R/test")
> phihat
function(x)
  {
x+ (-2i)
  }

Usually I work in emacs using ESS. When I edit the function phihat (Ctrl-C
Ctrl-d)
 I get the bad representation and after reloading the function (ctrl-c ctrl-l) 
the function has changed. quite a dangerous bug, I think, though I admit my
Linux 
version is quite old.


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._