When you define a constant in the IDE you can only assign it's type as Number and not the specific numeric type. This has bothered me for a long time, but as it usually does not matter I have not said anything about it, but there are are times it can.
I thought maybe the IDE was smart enough to detect what numeric type to use... and finally decided to test that..
So I created a Constant called UInt64Max and set the value to 18446744073709551615...
And then did this:
Dim IU64 as Uint64 =Uint64Max\2
And guess what .... the value of IU64 was 0!!!!
The reason is easy to understand. I exported the module I put that in as text and here is what I saw:
#tag Module Protected Module Module1 #tag Constant, Name = Uint64Max, Type = Double, Dynamic = False, Default = \"18446744073709551615", Scope = Public #tag EndConstant End Module #tag EndModule
So all the numeric constants are stored as doubles.... not only can that produce wrong results but even when it does not, it can also introduce extra numeric type conversion overhead in our code making it less efficient.
I go back to before UInt64 was added to the language and back then a double could hold all numeric types without losing information (though the conversion overhead issue was still there)...
But when the additional datatypes were added this was missed....
The thing is this type of stuff SHOULD be rock solid... While i don't use it, I think I've heard that Currency still is not rock solid...
The need for API 2.0 was sold as a need to deal with all the changes/additions to the language/framework over the years and rationalize them and make them consistent... And that IS a need... one that at the most basic level API 2 mostly does not deal with IMO.