Does unitful break the Float64 constructor?

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

using Unitful: m

yields 10m

In short, this means

Float64(x) isa Float64

doesn’t always hold.

Is this ok? is this an issue with Unitful ?

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

1 Like

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