# Creating Types in Julia

**URL:** https://discourse.julialang.org/t/creating-types-in-julia/75521
**Category:** New to Julia
**Tags:** numbers, type
**Created:** [January 31, 2022, 5:41pm UTC](https://discourse.julialang.org/t/creating-types-in-julia/75521 "2022-01-31T17:41:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![devin](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@devin](https://discourse.julialang.org/u/devin)
#### Post date: [January 31, 2022, 5:41pm UTC](https://discourse.julialang.org/t/creating-types-in-julia/75521/1 "2022-01-31T17:41:38Z")

</div>

Hello,

I’m interested in [using this library](https://github.com/JuliaMath/FixedPointNumbers.jl) for some fixed point calculations. However, I’m interested in using complex numbers for my analysis (this is a communications systems application) and the library presents this problem for me:

> This library defines an abstract type `FixedPoint{T <: Integer, f}` as a subtype of `Real` . The parameter `T` is the underlying machine representation and `f` is the number of fraction bits.

What are my options for having a fixed point complex type? Can I create some container type that has real and imaginary fixed point componets? Do I need to modify this library?

I’d very much like to avoid the situation where I have two vectors, one for the real part and another for the imaginary part.

Thanks,  
Devin

---

<div class="post-metadata">

### Author: ![goerch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerch/32/29122_2.png) [@goerch](https://discourse.julialang.org/u/goerch)
#### Post date: [January 31, 2022, 5:45pm UTC](https://discourse.julialang.org/t/creating-types-in-julia/75521/2 "2022-01-31T17:45:44Z")

</div>

Nice.

```julia
using FixedPointNumbers

x = N0f8(0.8)
y = N0f8(0.8)
c = Complex(x, y)
println(c)
println(typeof(c))

```

works like a charm:

```julia
0.8N0f8 + 0.8N0f8*im
Complex{N0f8}

```

---

<div class="post-metadata">

### Author: ![devin](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@devin](https://discourse.julialang.org/u/devin)
#### Post date: [January 31, 2022, 6:19pm UTC](https://discourse.julialang.org/t/creating-types-in-julia/75521/3 "2022-01-31T18:19:35Z")

</div>

Thanks a lot for this, very helpful.
