Classic Computer Magazine Archive COMPUTE! ISSUE 43 / DECEMBER 1983 / PAGE 10

Avoiding Tl INT

A little known fact about TI computers is that they will accept nonintegers for arguments such as array subscripts and CALL HCHAR and CALL VCHAR arguments. If a floating point value is used, the computer will round off to the nearest integer. For example, A (1.6) is the same as A (2), and A(5.25) is the same as A (5).

This is useful when you want to compute the proper element of an array with floating point values. For example, say you have a sprite with coordinates SPRITEX and SPRITEY, and you want to see what's underneath it on the screen. You can then use the following command to get the value:

CALL GCHAR(SPRITEY/8 + .5, SPRITEX/8 + .5,var)

Why is this important? Taking the INT of those values uses a lot of valuable time, and the INT is absolutely unnecessary. In a graphics program, this can speed things up considerably.

Neil Weinstock