| 89620 |
deepayan |
1 |
% File src/library/utils/man/bitstring.Rd
|
|
|
2 |
% Part of the R package, https://www.R-project.org
|
|
|
3 |
% Copyright 2026 R Core Team
|
|
|
4 |
% Distributed under GPL 2 or later
|
|
|
5 |
|
|
|
6 |
\name{bitstring}
|
|
|
7 |
\title{Bit-level representation of R atomic vectors}
|
|
|
8 |
\alias{bitstring}
|
|
|
9 |
\alias{bitstring.default}
|
|
|
10 |
\alias{bitstring.raw}
|
|
|
11 |
\alias{bitstring.integer}
|
|
|
12 |
\alias{bitstring.numeric}
|
|
|
13 |
\alias{format.bitstring}
|
|
|
14 |
\alias{print.bitstring}
|
|
|
15 |
|
|
|
16 |
\usage{
|
|
|
17 |
|
|
|
18 |
bitstring(x)
|
|
|
19 |
|
|
|
20 |
\method{bitstring}{raw}(x)
|
|
|
21 |
\method{bitstring}{integer}(x)
|
|
|
22 |
\method{bitstring}{numeric}(x)
|
|
|
23 |
\method{bitstring}{default}(x)
|
|
|
24 |
|
|
|
25 |
\method{format}{bitstring}(x, sep = " ", ...)
|
|
|
26 |
\method{print}{bitstring}(x, ...)
|
|
|
27 |
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
\arguments{
|
|
|
31 |
|
|
|
32 |
\item{x}{ For \code{bitsring()}, an atomic R vector. Currently
|
|
|
33 |
integer, numeric, and raw vectors are supported.
|
|
|
34 |
|
|
|
35 |
For the \code{\link{format}} and \code{\link{print}} methods, an
|
|
|
36 |
object of class \code{"bitstring"}.
|
|
|
37 |
}
|
|
|
38 |
\item{sep}{ character string to be used as visual breakpoints between
|
|
|
39 |
sign bit, mantissa, and exponent, as appropriate.
|
|
|
40 |
}
|
|
|
41 |
\item{...}{ additional arguments for compatibility; ignored. }
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
\description{
|
|
|
45 |
This is a simple user-friendly wrapper for \code{\link{intToBits}}
|
|
|
46 |
etc., inspired by the Julia function \code{bitstring}.
|
|
|
47 |
}
|
|
|
48 |
\value{
|
|
|
49 |
An object of class \code{"bitstring"} which stores the bit patterns of
|
|
|
50 |
the underlying vector as character strings, along with type
|
|
|
51 |
information.
|
|
|
52 |
|
|
|
53 |
\code{format.bitstring} formats a bitstring object for user-friendly
|
|
|
54 |
display.
|
|
|
55 |
}
|
|
|
56 |
\examples{
|
|
|
57 |
|
|
|
58 |
x <- bitstring(pi^((-3):3))
|
|
|
59 |
x
|
|
|
60 |
print(x, sep = "-")
|
|
|
61 |
|
|
|
62 |
bitstring(seq(-3, 3))
|
|
|
63 |
bitstring(seq(-3, 3) |> as.numeric())
|
|
|
64 |
bitstring(c(NA_real_, NaN, Inf, -Inf))
|
|
|
65 |
bitstring(NA_integer_)
|
|
|
66 |
bitstring(charToRaw("bits"))
|
|
|
67 |
|
|
|
68 |
}
|
|
|
69 |
\keyword{utilities}
|