Re: [R] Passing Inf from R to C using .C("myLibC"...

From: Duncan Murdoch <>
Date: Thu, 24 Apr 2008 09:36:20 -0400

On 4/24/2008 9:01 AM, Ardia David wrote:
> Dear all,
> How can I pass '-Inf' and 'Inf' values from R to C code using the
> function '.C(...)'. When running my code, I get an error since C does
> not recognize -Inf and Inf values. Of course, I could use instead a very
> low (or high) number, but I was wondering whether a more elegant
> solution exists. Thanks for your help.

C doesn't have any problem, but many C functions do, so .C by default prevents you from doing this. However, if you know that it is safe, use the NAOK arg to .C and special values will get through. (The name NAOK may not suggest it also means Inf is okay, but the docs do clearly say that.)

Duncan Murdoch mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 24 Apr 2008 - 14:25:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Apr 2008 - 15:00:31 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive