# Converting Float32 to N0f32 in FixedPointNumbers.jl

**URL:** <https://discourse.julialang.org/t/converting-float32-to-n0f32-in-fixedpointnumbers-jl/8555>\
**Category:** Numerics\
**Tags:** question\
**Created:** [January 23, 2018, 9:47pm UTC](https://discourse.julialang.org/t/converting-float32-to-n0f32-in-fixedpointnumbers-jl/8555 "2018-01-23T21:47:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jwu/32/3775_2.png) [@jwu](https://discourse.julialang.org/u/jwu)\
**Post date:** [January 23, 2018, 9:47pm UTC](https://discourse.julialang.org/t/converting-float32-to-n0f32-in-fixedpointnumbers-jl/8555/1 "2018-01-23T21:47:01Z")

</div>

this works in Julia 0.6.2:

```julia
Float32(1.0) |> N0f8
Float32(1.0) |> N0f16

```

this will not work

```julia
Float32(1.0) |> N0f32
Float32(1.0) |> N0f64
Float64(1.0) |> N0f64

```

It looks like when the number of bits is the same or larger, it won’t work.  
error message:

```julia
ArgumentError: FixedPointNumbers.Normed{UInt64,64} is a 64-bit type representing 0 values from 0.0 to 1.0; cannot represent 1.0

```

is this a bug?

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [January 24, 2018, 3:50pm UTC](https://discourse.julialang.org/t/converting-float32-to-n0f32-in-fixedpointnumbers-jl/8555/2 "2018-01-24T15:50:46Z")

</div>

seems like it. should probably submit an issue on github

---

<div class="post-metadata">

**Author:** ![jwu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jwu/32/3775_2.png) [@jwu](https://discourse.julialang.org/u/jwu)\
**Post date:** [January 24, 2018, 4:22pm UTC](https://discourse.julialang.org/t/converting-float32-to-n0f32-in-fixedpointnumbers-jl/8555/3 "2018-01-24T16:22:57Z")

</div>

thanks, submitted.  
[https://github.com/JuliaMath/FixedPointNumbers.jl/issues/102](https://github.com/JuliaMath/FixedPointNumbers.jl/issues/102)
