converters: converters

convertersR Documentation

converters

Description

Convert between a numeric vector/matrix and a float vector/matrix.

Usage

fl(x, strict = FALSE)

dbl(x, strict = FALSE)

int(x, strict = FALSE)

as.float(x, strict = FALSE)

## S3 method for class 'float32'
as.double(x, ...)

## S3 method for class 'float32'
as.integer(x, ...)

## S4 method for signature 'float32'
as.numeric(x, ...)

## S3 method for class 'float32'
as.vector(x, mode = "any")

## S3 method for class 'float32'
as.matrix(x, ...)

## S3 method for class 'float32'
as.data.frame(x, ...)

## S4 method for signature 'float32'
typeof(x)

## S4 method for signature 'float32'
storage.mode(x)

Arguments

x

A numeric or float vector/matrix.

strict

Should the function error if given the wrong kind of input? Otherwise it just silently returns the input.

mode, ...

Ignored.

Details

fl(), int(), and dbl() are shorthand for as.float(), as.integer(), and as.double(), respectively.

Value

The data stored in the type of whatever was asked for (the opposite of the input).

Examples

library(float)

x = matrix(1:30, 10, 3)
s = fl(x)

y = dbl(s)

all.equal(x, y)


float documentation built on Feb. 16, 2023, 6:43 p.m.