RealDigits
The digits of a real number and the position of its decimal point, with the repeating block of a rational marked as a sublist.
✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram Language
RealDigits✓RealDigits(x)the exact digits of a rational (integers included), any repeating block nestedRealDigits(x, base)the same, in the given baseRealDigits(x, base, len)len digits — the exact expansion for a rational, or len digits of a numeric approximation (base 10 only) for anything elseTyped signatures
| Type | Package | Applies |
|---|---|---|
(value, integer?, integer?) -> list | numerals | always |
Details
- The result is
{{d₁, d₂, ...}, n}: the value is0.d₁d₂d₃... × baseⁿ, sonis the count of digits before the point - A rational's expansion is EXACT: a terminating one stops, a repeating one nests its period as the list's last element —
RealDigits(1/7)is{{{1,4,2,8,5,7}}, 0} - When the integer part is 0, leading fractional zeros are dropped from the digit list and folded into a more negative exponent instead of spelled out —
RealDigits(1/8, 2)is{{1}, -2}, not{{0,0,1}, 0} - For anything without an exact rational value —
Pi, aSqrt,ExponentialE—lenis required, and the digits are TRUNCATED, not rounded, from a numeric approximation computed a little beyondlendigits - Sign is dropped, like every other digit head here
Examples
Basic #
About
| Examples | 11 |
|---|---|
| Checked against | Wolfram Language 11 agree |
| Crosswalk | Wolfram Language |
See also: IntegerDigits, FromDigits