Given the loose typing system of Q, I would have thought that it would promote variables when arithmetic overflow is produced but instead it computes the carry. Come on Arthur, don't be shy, take advantage of your type system and promote its type behind the scenes.
Let me give an example:
q) x:2147483646*2147483646
q) x
4
q)type x
-6h
What it should really do is this:
q) x:2147483646*2147483646
q) x
4611686009837453316j
q)type x
-7h
The only way to do this is explicitly promoting to long before the arithmetic.
q) x:2147483646j*2147483646j
q) x
4611686009837453316j
q)type x
-7h
Which one do you prefer?
No comments:
Post a Comment