Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Display a number in decimal form so that recurring digit sequences are highlighted and displayed only once
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. |
"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" |
Some rational numbers have recurring decimal digits:
In[1]:= |
Out[1]= |
RecurringDecimalForm displays this in a more compact notation:
In[2]:= |
Out[2]= |
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]= |
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]= |
There are several notations for the display of recurring digits used in different parts of the world:
In[11]:= |
Out[11]= |
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]= |
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]= |
This work is licensed under a Creative Commons Attribution 4.0 International License