var casting : float = cast[float](1)
echo casting
result :
4.940656458412465e-324
why is this happening ?
how does the cast keyword work on which types ?
Also, you don't need the apostrophe ' for float and uint (and maybe others):
echo type(1f)," ",type(1u)
And if you put the word "Nim" after the triple open quotes it will syntax-highlight your code on The Forum (if you did not know).
A quick grep suggests about 210 packages in ~560 files use expression type(). So, I don't know.. that's like 10% of Nimble packages. Of course, there are definitely many packages not in the nimble index, and also dark code that is not even public. I am aware of at least order(100) subcommand "dark use cases" of cligen, for example.
I think the idea for deprecation is that the same word two different ways (another way is this which uses both on the same line of code) is "confusing". Personally, I always liked the brevity of type() and there are certainly other cases of the same word being used two different ways (like of in case vs. in a type expression like type Animal = ref object of RootObj), but it's not much of a hill worth dying on, as the old saying goes. ;-)
Just for completeness sake you could also just type out a floating point number:
var x = 1.0