Ok, so I've deleted most of the discussion of this one but I felt it was time to give my two cents (pence?) worth. Apologies if it's all been said before......
Literal values are stored according to the way they are written. Stick quotes round something and its a string. Just write a number and its an integer (or float if it's got a decimal point in it). Let's ignore the problem of integers > 2^31. (UV confusingly refers to the float data type as "number" for historic reasons). All Basic operators start by converting their operands to the necessary type. Arithmetic operators require numbers. String operators require strings. The type of the result of an assignment depends on the last operator applied in evaluating the expression. Once you accept this, most of the examples quoted in previous mailing become clear. IBM are very secretive about the internals of UniVerse but from simple experiment it appears not to include any optimisation of the results of division. Is the result of A = B / C an integer or a float? It all depends on the values of B and C. UV seems always to store the result as a float. Some MV databases detect that it would be better to store this as an integer. Hidden data type conversion is great from a programmer's point of view. You don't have to worry about data types; it just gets on with it. There are, however, times when an understanding of data types is useful. Some years ago I came across a program where, because a value stored as a string was used endlessly in a very repetitive loop as a number, the conversion costs were enormous. By changing just five lines of the program to ensure that the right data type was used, the program ran over 10,000 times faster. (I got in trouble for fixing this. The software house was going to sell the customer a faster processor!) Because Basic lacks any explicit conversion functions akin to the atoi() and itoa(), etc of C, programmers sometimes write apparently pointless statements such as A = A + 0 Don't remove it! This is probably there to force A to be stored as an integer. Martin Phillips Ladybridge Systems 17b Coldstream Lane, Hardingstone, Northampton NN4 6DB +44-(0)1604-709200 -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
