Re: [Rd] Strange number produced by dnorm

2007-04-09 Thread Tong Wang
Having a hard time picking up C :( Thanks a lot for all your time . tong - Original Message - From: Peter Dalgaard <[EMAIL PROTECTED]> Date: Wednesday, April 4, 2007 12:44 am Subject: Re: [Rd] Strange number produced by dnorm To: Tong Wang <[EMAIL PROTECTED]> Cc: R-de

Re: [Rd] Strange number produced by dnorm

2007-04-04 Thread Peter Dalgaard
Tong Wang wrote: > Hi All, > I just started to learn compiling C codes for R usage, and got a problem > when I was playing with my 'hello world' code. > > #include > #include > #include > > SEXP test( ) { > double x; > x=dnorm(1.0,0.0,1.0,1); > printf(" x value is: %d \n",x);

Re: [Rd] Strange number produced by dnorm

2007-04-04 Thread Prof Brian Ripley
On Tue, 3 Apr 2007, Tong Wang wrote: > Hi All, >I just started to learn compiling C codes for R usage, and got a > problem when I was playing with my 'hello world' code. > > #include > #include > #include > > SEXP test( ) { > double x; > x=dnorm(1.0,0.0,1.0,1); > printf(" x value is: %

Re: [Rd] Strange number produced by dnorm

2007-04-04 Thread Martin Becker
Hi, I think the only thing that's wrong is "%d" in your printf statement, shouldn't it be "%f"? ("%d" is used for decimal (integer) numbers, "%f" for float (double) numbers) Regards, Martin Tong Wang wrote: > Hi All, > I just started to learn compiling C codes for R usage, and got a pro