Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: jsj795 on May 08, 2012, 10:04:57 pm

Title: Flag variable in TI-BASIC
Post by: jsj795 on May 08, 2012, 10:04:57 pm
I thought this very handy routine should be shared. It's not mine, credit goes to Runer112 and jacobly. They helped me find a really compact way to store the flags in a variable (total of 44 flags per single variable!)

Write these codes as is in the beginning of the program. Make sure you're not in radial mode if you plan to use graph screen.
Code: [Select]
"iPart(2fPart(Ans2^-θ→r₁
"Ans-2^θ/2r₁→r₂
"Ans+2^θ/2not(r₁→r₃

In order to utilize the above routine, you use these when you need to work with flags
Code: [Select]
A:r₁(B to get
A:r₂(B→A to reset
A:r₃(B→A to set

So let's say you have 4 flags, and they are in the variable F. In order to see what 3rd flag is, you do:
F:r₁(3
In order to reset (make flag 0) the 2nd flag, you do
F:r₂(2
and so on.

This is a lot better and more efficient, then let's say setting each flag per element in a list.
like, L1(1,0,0,1,1,1,0,1,0,1,1,0,1,0,0
etc. when you can store all that in a single variable as '20148' and extract each flag by using the above method.

Just make sure the value doesn't contain more than 44 flags because after that you will lose accuracy due to how TI handles the number.
Title: Re: Flag variable in TI-BASIC
Post by: blue_bear_94 on May 09, 2012, 04:10:22 pm
Actually...
Code: [Select]
A:r₁(B to get
A:r₂(B→A to reset
A:r₃(B→A to set

Anyway, this is a very useful routine!
Title: Re: Flag variable in TI-BASIC
Post by: jsj795 on May 09, 2012, 07:57:57 pm
Actually...
Code: [Select]
A:r₁(B to get
A:r₂(B→A to reset
A:r₃(B→A to set

Anyway, this is a very useful routine!

Ahhh yes true. I forgot, will edit it in :)