The sq() test is probably spending all its time converting between data types.
a=sq(i) must convert the integer i to a float, convert the float result x*x to an integer return value and finally convert that to a float for assignment to variable a.
Function sq(x#) Return x*x End Function t=MilliSecs() Local a# For i=0 To 10000000 a=sq(i) Next
a=sq(i) must convert the integer i to a float, convert the float result x*x to an integer return value and finally convert that to a float for assignment to variable a.