# Does unitful break the Float64 constructor?

**URL:** <https://discourse.julialang.org/t/does-unitful-break-the-float64-constructor/90655>\
**Category:** General Usage\
**Tags:** unitful\
**Created:** [November 22, 2022, 4:33pm UTC](https://discourse.julialang.org/t/does-unitful-break-the-float64-constructor/90655 "2022-11-22T16:33:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philip\_Stuckey](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/philip_stuckey/32/4000_2.png) [@Philip\_Stuckey](https://discourse.julialang.org/u/Philip_Stuckey)\
**Post date:** [November 22, 2022, 4:33pm UTC](https://discourse.julialang.org/t/does-unitful-break-the-float64-constructor/90655/1 "2022-11-22T16:33:25Z")

</div>

So I was running into an issue with a stack overflow error in `JSON3`, and in looking into it I discovered

```julia
using Unitful: m
Float64(10m) 

```

yields `10m`

In short, this means

```julia
Float64(x) isa Float64

```

doesn’t always hold.

Is this ok? is this an issue with `Unitful` ?

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [November 22, 2022, 4:49pm UTC](https://discourse.julialang.org/t/does-unitful-break-the-float64-constructor/90655/2 "2022-11-22T16:49:04Z")

</div>

It’s not great but it probably makes a lot more code work with unitful than would otherwise.

---

<div class="post-metadata">

**Author:** ![sostock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sostock/32/5546_2.png) [@sostock](https://discourse.julialang.org/u/sostock)\
**Post date:** [January 9, 2023, 10:50am UTC](https://discourse.julialang.org/t/does-unitful-break-the-float64-constructor/90655/3 "2023-01-09T10:50:25Z")

</div>

This is one of the things that I would like to remove in Unitful 2.0. I think that the `Float64` constructor should always return a `Float64`.

There is also a discussion about generally enforcing `T(x...) isa T` in Julia 2.0: [Require constructors and `convert` to return objects of stated type? · Issue #42372 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/42372)
