Also note that one can use toupper in place of as.character
in which case no other changes are required.
On Sun, May 17, 2009 at 5:07 PM, Ted Harding
wrote:
> Thanks, Jim. While that is still in hex, I find I can get the binary
> represntation using Gabor's gsubfn() function, provided the A-F isw
Thanks, Jim. While that is still in hex, I find I can get the binary
represntation using Gabor's gsubfn() function, provided the A-F isw
changed to a-f in setting up his 'binary.digits', and the output is
explicitly cast to character:
gsubfn("[0-9a-f]", binary.digits,
as.character(writeBin(
Many thankis, Gabor! That looks both interesting and powerful.
Indeed, it seems to implement with one stroke what I had been
thinking of implementing piecemeal.
Best wishes,
Ted.
On 17-May-09 17:48:00, Gabor Grothendieck wrote:
> gsubfn of the gsubfn package is like gsub but can take a function,
>
Are you looking for how the floating point is represented in the IEEE-754
format? If so, you can use writeBin:
> writeBin(pi,raw(),endian='big')
[1] 40 09 21 fb 54 44 2d 18
On Sun, May 17, 2009 at 1:23 PM, Ted Harding
wrote:
> I am interested in studying the binary representation of numerics
>
gsubfn of the gsubfn package is like gsub but can take a function,
list or proto object
as the replacement instead of a character string and with a list it
can be used to
readily turn hex to binary:
> library(gsubfn)
> binary.digits <-
+ list("0"= "", "1"= "0001", "2"= "0010", "3"= "0011",
+
I am interested in studying the binary representation of numerics
(doubles) in R, so am looking for possibilities of output of the
internal binary representations. sprintf() with format "a" or "A"
is halfway there:
sprintf("%A",pi)
# [1] "0X1.921FB54442D18P+1"
but it is in hex.
The following
6 matches
Mail list logo