# Linspace and irrationals with Float32

**URL:** <https://discourse.julialang.org/t/linspace-and-irrationals-with-float32/1464>\
**Category:** General Usage\
**Created:** [January 13, 2017, 3:26pm UTC](https://discourse.julialang.org/t/linspace-and-irrationals-with-float32/1464 "2017-01-13T15:26:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Post date:** [January 13, 2017, 3:26pm UTC](https://discourse.julialang.org/t/linspace-and-irrationals-with-float32/1464/1 "2017-01-13T15:26:25Z")

</div>

The following line throws an error

```julia
julia> 2π*linspace(0.0f0, 1.0f0, 2)
ERROR: MethodError: no method matching LinSpace{T<:AbstractFloat}(::Float64, ::Float64, ::Float32, ::Float32)

```

but this is fine

```julia
julia> 2(π*linspace(0.0f0, 1.0f0, 2))
2-element LinSpace{Float32}:
 0.0,6.28319

```

both on v0.5 and v0.6. There doesn’t seem to be an issue open: should I file one or is this nitpicking?

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [January 13, 2017, 3:42pm UTC](https://discourse.julialang.org/t/linspace-and-irrationals-with-float32/1464/2 "2017-01-13T15:42:55Z")

</div>

Looks like a bug, though not about irrationals.

```julia
julia> 2.0 * linspace(0f0, 1f0, 2)
ERROR: MethodError: no method matching LinSpace{T<:AbstractFloat}(::Float64, ::Float64, ::Float32, ::Float32)
Closest candidates are:
  LinSpace{T<:AbstractFloat}{T<:AbstractFloat}(::T<:AbstractFloat, ::T<:AbstractFloat, ::T<:AbstractFloat, ::T<:AbstractFloat) at range.jl:213
  LinSpace{T<:AbstractFloat}{T}(::Any) at sysimg.jl:66
 in *(::Float64, ::LinSpace{Float32}) at ./abstractarraymath.jl:96

```

---

<div class="post-metadata">

**Author:** ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Post date:** [January 13, 2017, 3:43pm UTC](https://discourse.julialang.org/t/linspace-and-irrationals-with-float32/1464/3 "2017-01-13T15:43:57Z")

</div>

You are right, I should have seen it.
