# Is it possible to get results in the form of irrationals?

**URL:** <https://discourse.julialang.org/t/is-it-possible-to-get-results-in-the-form-of-irrationals/85998>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [August 19, 2022, 12:01pm UTC](https://discourse.julialang.org/t/is-it-possible-to-get-results-in-the-form-of-irrationals/85998 "2022-08-19T12:01:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AwesomeQuest](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/awesomequest/32/38910_2.png) [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Post date:** [August 19, 2022, 12:01pm UTC](https://discourse.julialang.org/t/is-it-possible-to-get-results-in-the-form-of-irrationals/85998/1 "2022-08-19T12:01:10Z")

</div>

Is it possible to get the result of a computation in the form

```julia
2pi//5
2√2//3

```

just like there is for Rationals?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [August 19, 2022, 12:09pm UTC](https://discourse.julialang.org/t/is-it-possible-to-get-results-in-the-form-of-irrationals/85998/2 "2022-08-19T12:09:18Z")

</div>

no, you can probably try to delay the calculation yourself

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [August 19, 2022, 12:43pm UTC](https://discourse.julialang.org/t/is-it-possible-to-get-results-in-the-form-of-irrationals/85998/3 "2022-08-19T12:43:58Z")

</div>

Depending on what are you aiming for, you can take a look at `Symbolics`:

```julia
julia> using Symbolics

julia> @variables pi sq2
2-element Vector{Num}:
  pi
 sq2

julia> formula = 2 * pi // ( 3 * sq2 )
(2pi) / (3sq2)

julia> substitute(formula, Dict(pi => π, sq2 => √2))
1.4809609793861218

```

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [August 19, 2022, 3:27pm UTC](https://discourse.julialang.org/t/is-it-possible-to-get-results-in-the-form-of-irrationals/85998/4 "2022-08-19T15:27:13Z")

</div>

There is [this package](https://github.com/perrutquist/IrrationalExpressions.jl) which seems to be heavy on the type piracy but if it’s for private use that’s probably fine.

(There’s a pun on the word “privateer” in here somewhere)
