Function Repository Resource:

# RecurringDecimalForm

Display a number in decimal form so that recurring digit sequences are highlighted and displayed only once

Contributed by: Jon McLoone
 ResourceFunction["RecurringDecimalForm"][val] displays numeric value val such that recurring digits are highlighted and displayed only once. ResourceFunction["RecurringDecimalForm"][val,b] displays numeric value val such that digits recurring in base b are highlighted and displayed only once.

## Details and Options

ResourceFunction["RecurringDecimalForm"] takes the following options:
 "MinRepeats" 3 number of times digits must repeat before they are assumed to be recurring "RoundingDigits" 1 number assumed to be affected by rounding and, as such, ignored "Notation" "Vinculum" display notation to be used for recurring digits; choices are "Vinculum", "Dots", "Parenthesis" or "Arc"

## Examples

### Basic Examples (2)

Some rational numbers have recurring decimal digits:

 In[1]:=
 Out[1]=

RecurringDecimalForm displays this in a more compact notation:

 In[2]:=
 Out[2]=

### Scope (5)

RecurringDecimalForm accepts any input that is numeric:

 In[3]:=
 Out[3]=

RecurringDecimalForm ignores repeating zeros:

 In[4]:=
 Out[4]=
 In[5]:=
 Out[5]=

For numeric quantities, a repeating sequence in the final digits (excluding the last digit, which is subject to rounding) is assumed to be recurring:

 In[6]:=
 Out[6]=

For exact numeric quantities that are not explicitly Rational, RecurringDecimalForm searches the first \$MaxExtraPrecision digits:

 In[7]:=
 Out[7]=

Recurring digits can be found in other number bases:

 In[8]:=
 Out[8]=

### Options (6)

#### MinRepeats (2)

Digit sequences that repeat at least three times are assumed to be recurring:

 In[9]:=
 Out[9]=

The option "MinRepeats" controls this sensitivity:

 In[10]:=
 Out[10]=

#### Notation (1)

There are several notations for the display of recurring digits used in different parts of the world:

 In[11]:=
 Out[11]=

#### RoundingDigits (3)

By default, the final digit is assumed to be subject to rounding and is ignored:

 In[12]:=
 Out[12]=

In some circumstances, more digits are affected by rounding:

 In[13]:=
 Out[13]=
 In[14]:=
 Out[14]=

You can ignore more digits with "RoundingDigits":

 In[15]:=
 Out[15]=

### Possible Issues (4)

By default, the final digit is assumed to be subject to rounding and is ignored:

 In[16]:=
 Out[16]=
 In[17]:=
 Out[17]=

In some circumstances, more digits are affected by rounding:

 In[18]:=
 Out[18]=

In these circumstances, RecurringDecimalForm will not recognize the repeat:

 In[19]:=
 Out[19]=

You can ignore more digits with "RoundingDigits":

 In[20]:=
 Out[20]=

Jon McLoone

## Version History

• 1.0.1 – 08 April 2022
• 1.0.0 – 06 December 2019