-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
Description
julia> @btime Float16(rand())
15.878 ns (0 allocations: 0 bytes)
julia> @btime Float16(Float32(rand()))
5.928 ns (0 allocations: 0 bytes)
julia> @btime Float16(rand(Float32))
4.282 ns (0 allocations: 0 bytes)
I believe we are calling compiler-rt for this. Of course this can't be implemented by converting via Float32 since that rounds twice, but it's frustrating that that method is so much faster. Would be nice to have a better implementation of this. See also #40315.