R: Simple Rational Number

simplenumber {spatstat.utils} | R Documentation

## Simple Rational Number

### Description

Given a numeric value, try to express it as a simple rational number.

### Usage

    simplenumber(x, unit = "", multiply = "*", tol = .Machine$double.eps)

### Arguments

`x` | A single numeric value.
`unit` | Optional. Character string giving the name of the unit in which `x` is expressed. Typically an irrational number such as `pi`. See Examples.
`multiply` | Optional. Character string representing multiplication.
`tol` | Numerical tolerance.

### Details

The code tries to express `x` as an integer `x=n`, or as the reciprocal of an integer `x=1/n`, or as a simple rational number `x = m/n`, where `m,n` are small integers.

### Value

A character string representing the simple number, or `NULL` if not successful.

### Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au.

### Examples

      simplenumber(0.3)
      simplenumber(0.333333333333333333333333)
      x <- pi * 2/3
      simplenumber(x/pi, "pi")

[Package spatstat.utils version 2.3-1 Index]