# Complexifying pi

**URL:** https://discourse.julialang.org/t/complexifying-pi/23885
**Category:** General Usage
**Created:** [May 5, 2019, 9:37pm UTC](https://discourse.julialang.org/t/complexifying-pi/23885 "2019-05-05T21:37:21Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [May 5, 2019, 11:10pm UTC](https://discourse.julialang.org/t/complexifying-pi/23885/6 "2019-05-05T23:10:01Z")

</div>

> [@DNF](#):
>
> Should there be a `Complex{Irrational{...}}` type?

The type exists already:

```julia
julia> complex(pi, pi) |> typeof
Complex{Irrational{:π}}

```

but the point is that the parameter of `Complex{T}` is the type of both the real _and_ the imaginary parts, so the only way to build a `Complex{Irrational{...}}` is to do `complex(x, x)` with `x isa Irrational`.

If one wants to have `complex(pi)` with the highest precision possible, `complex(big(pi))` is the only solution currently.

For more information see:

> <https://github.com/JuliaLang/julia/issues/21204>
>
> A \`Complex{Irrational}\` is allowed (e.g., \`Complex(pi, pi)\`), but there are a fe…w functions that currently don't work with this type (e.g., \`exp\`, \`exp2\`, \`exp10\`; \`exp\` can be easily fixed if #21203 is merged, the other two functions can be fixed as part of the fix to #21200).
> 
> Should this type be kept (and non-working functions fixed) or automatically converted to, say, \`Complex{Float64}\`? I don't think this type is widely used (its odd representation in the REPL seems to confirm this) and any mathematical operation with it promotes it to another type, but I think that a decision should be taken about its status.
> 
> TODO list:
> \- \[x\] make \`big(complex(pi, pi))\` work (PR #21218)
> \- \[x\] fix \`exp\` (PR #21596)
> \- \[x\] make \`sinpi(complex(pi, pi))\` work (actually, not even \`sinpi(pi)\` works right now). Same for \`cospi\`. Requires #21219 (PR #21781)
> \- \[x\] fix \`log1p\`: can be fixed with \`one(float(T))\` in place of \`float(one(T))\` (which is also more efficient for Big numbers, only one number is allocated) if #21219 if merged (PR #21784)
> \- \[x\] fix \`exp2\` and \`exp10\`: see \[this comment\](https://github.com/JuliaLang/julia/issues/21204#issuecomment-289900420) below, requires PR #21219 (PR #21874)
> \- \<s\>make \`complex(pi)\` work (PR #22928)\</s\> The decision was to not make \`complex(irrational)\` work at all.

---

_[View the full topic](https://discourse.julialang.org/t/complexifying-pi/23885)._
