Author Topic: Undocumented TI-BASIC tricks  (Read 83138 times)

0 Members and 1 Guest are viewing this topic.

dysfunction

  • Guest
Undocumented TI-BASIC tricks
« Reply #105 on: January 13, 2006, 12:38:00 pm »
That's very useful, thanks! I remember I was looking for something that would do that a while ago, but I don't remember exactly what for... but I'll remember that.

dragon__lance

  • Guest
Undocumented TI-BASIC tricks
« Reply #106 on: January 13, 2006, 04:05:00 pm »
QuoteBegin-CDI+13 January 2006, 7:04-->
QUOTE (CDI @ 13 January 2006, 7:04)
my 2 cents...

int(log(#)+1 = How many digits the number is

example

Text(0,0,sub(" 00000000",1,8-int(log(S)+1)),S

will return an 8 digit number at 0,0 on the GS no matter what (if S's digits are less than 8)  

 nice trick, i'll probably use it sometime  >Dgni.gif i may sound so noobish for asking this, but wat exactly is a memory leak? just when u use lables/ gotos and amount of free mem goes down?

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
Undocumented TI-BASIC tricks
« Reply #107 on: January 13, 2006, 04:59:00 pm »
QuoteBegin-dragon__lance+13 January 2006, 22:05-->
QUOTE (dragon__lance @ 13 January 2006, 22:05)
QuoteBegin-CDI+13 January 2006, 7:04-->
QUOTE (CDI @ 13 January 2006, 7:04)
my 2 cents...

int(log(#)+1 = How many digits the number is

example

Text(0,0,sub(" 00000000",1,8-int(log(S)+1)),S

will return an 8 digit number at 0,0 on the GS no matter what (if S's digits are less than 8)

nice trick, i'll probably use it sometime  >Dgni.gif i may sound so noobish for asking this, but wat exactly is a memory leak? just when u use lables/ gotos and amount of free mem goes down?  

 I seen this on maxcoderz before and is nice, a memory leak I believe is when you use a loop of some kind like while or repeat, then within the loop use an exit which isn't from the main loop.
c1
-->
CODE
ec1
Lbl 1
While K!=105
getkey->K
if Ans=21:Goto 1
endc2
ec2
This would give a bad memory leak (take up ram space I believe) if 2nd is pressed within the loop.

Offline tifreak

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2708
  • Rating: +82/-3
  • My Kung Fu IS strong...
    • View Profile
    • TI-Freakware
Undocumented TI-BASIC tricks
« Reply #108 on: January 13, 2006, 05:32:00 pm »
A memory leak is when the calc encounters a command that requires an End statement, but never reaches it. The reason is it keeps track of how many Ends there should be, and that eats up memory...
Projects: AOD Series: 75% | FFME: 80% | Pokemon: 18% | RPGSK: 60% | Star Trek: 70% | Star Trek 83+: 40% | TI-City: 5%

Offline Spellshaper

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1690
  • Rating: +0/-0
  • This is me. Or maybe not.
    • View Profile
Undocumented TI-BASIC tricks
« Reply #109 on: January 14, 2006, 01:19:00 am »
got a question:

Is there a difference between int( and iPart( ?

cause it seems to me that they give the same reults...

CDI

  • Guest
Undocumented TI-BASIC tricks
« Reply #110 on: January 14, 2006, 02:16:00 am »
hmm... isn't int( for positive numbers? and iPart( for anything?

BCTurk

  • Guest
Undocumented TI-BASIC tricks
« Reply #111 on: January 14, 2006, 03:16:00 am »
CDI is correct.

MathStuf

  • Guest
Undocumented TI-BASIC tricks
« Reply #112 on: January 14, 2006, 06:56:00 am »
With the bases, here's one for the maximum number of digits in any base from any base (b is old base, n is old number, c is new base):
c1-->
CODE
ec1
iPart(dim(n)*ln(b)/ln(c)+1)
c2
ec2

QuoteBegin-Spellshaper+14 January 2006, 7:19
-->
QUOTE (Spellshaper @ 14 January 2006, 7:19)
got a question:

Is there a difference between int( and iPart( ?

cause it seems to me that they give the same reults...

iPart( goes towards 0, int( goes to the next lowest integer.

CDI

  • Guest
Undocumented TI-BASIC tricks
« Reply #113 on: January 14, 2006, 09:41:00 am »
QuoteBegin-MathStuf+14 January 2006, 13:56-->
QUOTE (MathStuf @ 14 January 2006, 13:56)
With the bases, here's one for the maximum number of digits in any base from any base (b is old base, n is old number, c is new base):
c1-->
CODE
ec1
iPart(dim(n)*ln(b)/ln(c)+1)
c2
ec2  

 so if I do iPart(dim(42)*ln(13)/ln(10)+1) what will that do again?

MathStuf

  • Guest
Undocumented TI-BASIC tricks
« Reply #114 on: January 14, 2006, 11:32:00 am »
QuoteBegin-CDI+14 January 2006, 15:41-->
QUOTE (CDI @ 14 January 2006, 15:41)
QuoteBegin-MathStuf+14 January 2006, 13:56-->
QUOTE (MathStuf @ 14 January 2006, 13:56)
With the bases, here's one for the maximum number of digits in any base from any base (b is old base, n is old number, c is new base):
c1-->
CODE
ec1
iPart(dim(n)*ln(b)/ln(c)+1)
c2
ec2

so if I do iPart(dim(42)*ln(13)/ln(10)+1) what will that do again?  

 That will return the maximum amount of digits in base 10 that a 42 digit number in base 13 can take up (which is 47). But n should be either a string (change to length( in that case) or a list for dim( to work properly).

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
Undocumented TI-BASIC tricks
« Reply #115 on: January 31, 2006, 08:07:00 am »
Thanks for the "please install xLIB first thing" I just used it in my MS clone.