RepeatingDecimalNotations.jl

A Julia package to handle repeating decimal numbers.
Author hyrodium
Popularity
4 Stars
Updated Last
6 Months Ago
Started In
December 2023

RepeatingDecimalNotations.jl

A Julia package to handle repeating decimal numbers.

Stable Dev Build Status Coverage Aqua QA RepeatingDecimalNotations Downloads

Quick start

julia> using RepeatingDecimalNotations

julia> using RepeatingDecimalNotations: stringify, rationalify

julia> r = rd"123.4(56)"  # 123.4565656...
61111//495

julia> rd"1.234r56e2"  # Other notations
61111//495

julia> rd"123.45656..."  # are also supported.
61111//495

julia> float(r)  # Check floating point number approximation.
123.45656565656566

julia> rd"0.(9)"  # 0.999... is equal to 1.
1//1

julia> rd"0.99(9)", rd"1", rd"1.000_000"  # The notation of repeating decimals is not unique.
(1//1, 1//1, 1//1)

julia> stringify(1//7)  # Generate `String` from `Rational`.
"0.(142857)"

julia> rationalify("0.1(6)")  # vice versa.
1//6