# \#rationals

**URL:** https://discourse.julialang.org/tag/rationals/297.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [\[ANN\] XRationals.jl](https://discourse.julialang.org/t/ann-xrationals-jl/136347)

<div class="topic-metadata">

**Author:** [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Replies:** 0\
**Last updated:** [March 23, 2026, 7:48pm UTC](https://discourse.julialang.org/t/ann-xrationals-jl/136347 "2026-03-23T19:48:19Z")

</div>

From the README.md: Exact rational arithmetic with IEEE-like special values (NaN, Inf, -Inf), overflow-safe saturation, and lazy normalization for impressive throughput. Types Type Alias Backing Overflow Normalizat…

---

## [Should Rationals be explicitly converted?](https://discourse.julialang.org/t/should-rationals-be-explicitly-converted/131350)

<div class="topic-metadata">

**Author:** [@NonDairyNeutrino](https://discourse.julialang.org/u/NonDairyNeutrino)\
**Replies:** 11\
**Last updated:** [August 5, 2025, 5:56pm UTC](https://discourse.julialang.org/t/should-rationals-be-explicitly-converted/131350 "2025-08-05T17:56:46Z")

</div>

The question is basically, which is “better” in terms of intermediate type-stability and/or performance: function half\_promote(x :: T) :: T where T \<: AbstractFloat half = 1//2 return half \* x end or function …

---

## [FiniteContinuedFractions.jl - a number type for rational numbers](https://discourse.julialang.org/t/finitecontinuedfractions-jl-a-number-type-for-rational-numbers/123007)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 4\
**Last updated:** [December 8, 2024, 12:01pm UTC](https://discourse.julialang.org/t/finitecontinuedfractions-jl-a-number-type-for-rational-numbers/123007 "2024-12-08T12:01:38Z")

</div>

A package that provides the FiniteContinuedFraction type, an alternative to Rational. Both subtype Real. I don’t know if FiniteContinuedFraction is ever a good replacement for Rational in package code, seeing as it’s …

---

## [\[ANN\] RepeatingDecimalNotations.jl](https://discourse.julialang.org/t/ann-repeatingdecimalnotations-jl/108011)

<div class="topic-metadata">

**Author:** [@hyrodium](https://discourse.julialang.org/u/hyrodium)\
**Replies:** 1\
**Last updated:** [January 6, 2024, 6:54am UTC](https://discourse.julialang.org/t/ann-repeatingdecimalnotations-jl/108011 "2024-01-06T06:54:35Z")

</div>

Hi all, I’m pleased to announce my package RepeatingDecimalNotations.jl (repo, docs). This package has some operations with repeating decimals. Define rational number with string macro like rd"123.4(56)". Convert R…

---

## [Quick way to create a vector of only rationals wthin a range?](https://discourse.julialang.org/t/quick-way-to-create-a-vector-of-only-rationals-wthin-a-range/107189)

<div class="topic-metadata">

**Author:** [@PeX](https://discourse.julialang.org/u/PeX)\
**Replies:** 2\
**Last updated:** [December 6, 2023, 2:18am UTC](https://discourse.julialang.org/t/quick-way-to-create-a-vector-of-only-rationals-wthin-a-range/107189 "2023-12-06T02:18:17Z")

</div>

Hi all, I want to create a vector of 30 rational numbers between 10^(-5) to 10^(-1). Preferably evenly spaced. Is there a quick and efficient way to do it in Julia? Thank you!

---

## [Fast recursion with big rationals](https://discourse.julialang.org/t/fast-recursion-with-big-rationals/101023)

<div class="topic-metadata">

**Author:** [@Denis\_Ivanov](https://discourse.julialang.org/u/Denis_Ivanov)\
**Replies:** 4\
**Last updated:** [July 1, 2023, 3:56pm UTC](https://discourse.julialang.org/t/fast-recursion-with-big-rationals/101023 "2023-07-01T15:56:24Z")

</div>

Hi! Now I’m doing one task for OEIS. In particular, I need to implement a fast algorithm for finding egyptian fractions of shortest length. There is the next algorithm for to find just the shortest length: If there…

---

## [Weird floating point vs rational behavior](https://discourse.julialang.org/t/weird-floating-point-vs-rational-behavior/96466)

<div class="topic-metadata">

**Author:** [@DOT](https://discourse.julialang.org/u/DOT)\
**Replies:** 6\
**Last updated:** [March 23, 2023, 12:28pm UTC](https://discourse.julialang.org/t/weird-floating-point-vs-rational-behavior/96466 "2023-03-23T12:28:54Z")

</div>

Just when you think you’ve seen it all: Could someone please explain this to me? julia\> 10\*1.1 ≤ 11 true julia\> (10//1)\*1.1 ≤ (11//1) true julia\> (10//1)\*1.1 - (11//1) ≤ 0 true julia\> 1 ≤ (11//10)/1.1 true julia\> 1.…

---

## [Vector of Rational{Int64}](https://discourse.julialang.org/t/vector-of-rational-int64/95891)

<div class="topic-metadata">

**Author:** [@Cougar](https://discourse.julialang.org/u/Cougar)\
**Replies:** 1\
**Last updated:** [March 10, 2023, 10:14pm UTC](https://discourse.julialang.org/t/vector-of-rational-int64/95891 "2023-03-10T22:14:56Z")

</div>

Does anyone know why the following … rationalVector::Vector{Rational{Int64}} = \[ (2//3), (5//8), (11//17), (44/101) \] for rational in rationalVector println(rational) end # for rational … prints the following … 600…

---

## [Surprise with Rational](https://discourse.julialang.org/t/surprise-with-rational/88694)

<div class="topic-metadata">

**Author:** [@thattommyhall](https://discourse.julialang.org/u/thattommyhall)\
**Replies:** 28\
**Last updated:** [October 17, 2022, 12:28am UTC](https://discourse.julialang.org/t/surprise-with-rational/88694 "2022-10-17T00:28:31Z")

</div>

I dont understand why 0 \* 1//0 blows up julia\> 1//0 \* 2 1//0 julia\> 1//0 \* 1 1//0 julia\> 1//0 \* 0 ERROR: DivideError: integer division error Stacktrace: \[1\] div @ ./int.jl:288 \[inlined\] \[2\] divgcd(x::Int64, y::I…

---

## [Why the weird summarysize results for Rational{BigInt}](https://discourse.julialang.org/t/why-the-weird-summarysize-results-for-rational-bigint/86704)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 2\
**Last updated:** [September 3, 2022, 4:51am UTC](https://discourse.julialang.org/t/why-the-weird-summarysize-results-for-rational-bigint/86704 "2022-09-03T04:51:01Z")

</div>

julia\> n = big"3"^100000; julia\> t = (n // 1, n, Rational{BigInt}(n)); julia\> typeof(t) Tuple{Rational{BigInt}, BigInt, Rational{BigInt}} julia\> map(Base.summarysize, t) (19872, 19968, 20008) julia\> first(t) == last(…

---

## [Vector conversion mixed rational integers](https://discourse.julialang.org/t/vector-conversion-mixed-rational-integers/79546)

<div class="topic-metadata">

**Author:** [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Replies:** 32\
**Last updated:** [April 17, 2022, 4:48pm UTC](https://discourse.julialang.org/t/vector-conversion-mixed-rational-integers/79546 "2022-04-17T16:48:26Z")

</div>

Is there (or how could one write) a function that gives me this vector \[0, 1//2, 1, 3//2, 2\] from this vector \[0//2, 1//2, 2//2, 3//2, 4//2\]?

---

## [StatsBase.summarystats not defined for Rational numbers](https://discourse.julialang.org/t/statsbase-summarystats-not-defined-for-rational-numbers/55165)

<div class="topic-metadata">

**Author:** [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)\
**Replies:** 3\
**Last updated:** [March 1, 2021, 7:11pm UTC](https://discourse.julialang.org/t/statsbase-summarystats-not-defined-for-rational-numbers/55165 "2021-03-01T19:11:29Z")

</div>

Hi, I have code that uses StatsBase.summarystats on a Vector{T} where T \<: Real sometimes T can be Rational, and summarystats fails as it is not defined on Rational. Is there an alternative I can use? My current work…

---

## [\[ANN\] FastRationals.jl](https://discourse.julialang.org/t/ann-fastrationals-jl/26634)

<div class="topic-metadata">

**Author:** [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Replies:** 4\
**Last updated:** [July 22, 2019, 6:40pm UTC](https://discourse.julialang.org/t/ann-fastrationals-jl/26634 "2019-07-22T18:40:56Z")

</div>

FastRationals.jl gives you rational arithmetic that is much faster than the system Rationals. Please note that this is not a general purpose package. It works well only when working either in limited rational domains, …
