Why the frick won't this work?

Quote:

> I have traced the problem down to one thing:

> 2^(7-j)

Beware this may be very slow! Most BASIC interpreters process powers using

*floating* point calculations. Typically it's impemented as

FUNCTION power#(base#, exponent#)

power# = EXP(LOG(base#) * exponent#)

END FUNCTION

and typically, EXP() and LOG() are CPU time expensive operations!

Quote:

> RealBasic doesn't seem to be able to do this!

> I replaced it with Select Case, but I still can't figure out why RealBasic

> can't evaluate this expression.

I would recommend looking for a *shift* operation in RealBasic like "<<" and

">>" in ANSI C/C++/Java. Some basic dialects such as BlitzBASIC offer SHL

and SHR, so you can write

1 SHL 7-j

(C/C++ syntax: 1 << 7-j)

or even

128 SHR j

(128 >> j)

I hope that somebody in this NG which has more detailed knowledge about

RealBasic than me could provide you the needed help.

Due lack of SHL/SHR in QB, i often use a DIM powerOf2%() array variable with

precalculated binary powers in my projects.

Andreas