# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# `numlib`::`decimal`

Infinite representation of rational numbers

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```numlib::decimal(`q`)
```

## Description

`numlib::decimal(q)` computes the decimal expansion of a rational number `q`.

If `q` is a nonnegative rational number whose decimal expansion is finite, then `numlib::decimal``(q)` returns the expression sequence starting with the integral part of `q` and followed by the digits after the decimal point.

If `q` is a nonnegative rational number whose decimal expansion is infinite, then `numlib::decimal``(q)` returns the expression sequence starting with the integral part of `q`, followed by the digits of the pre-period and terminated with a list, containing the digits of a minimal period.

## Examples

### Example 1

Computing the decimal expansion of 1999:

`numlib::decimal(1999)`

### Example 2

Computing the (finite) decimal expansion of :

`numlib::decimal(52187/78125)`

### Example 3

Computing the (infinite) decimal expansion of :

`numlib::decimal(111/7)`

### Example 4

Computing the (infinite) decimal expansion of :

`numlib::decimal(37/28)`

## Parameters

 `q` Nonnegative rational number

## Return Values

`numlib::decimal``(q)` returns an expression sequence consisting of nonnegative integers or an expression sequence consisting of nonnegative integers and terminated by a list of nonnegative integers.