This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
United-TI Archives -> TI-Basic
 
    » Goto page Previous  1, 2
» View previous topic :: View next topic  
Author Message
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 24 Jul 2003 02:41:07 pm    Post subject:

im not sure
it might
try it
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 24 Jul 2003 04:12:39 pm    Post subject:

it should... *will Smile
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 24 Jul 2003 04:19:22 pm    Post subject:

well, i learned something today.
"if you dont learn something today, then the day has just wasted away."
--Darth Android
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 24 Jul 2003 05:51:54 pm    Post subject:

I have to disagree with that since I know spending time with friends, family, or otherwise having a good time (day) is a really good thing and a day spend having fun and stuff isn't a waste of time in my opinion.

Even a day on which you sleep 24 hours isn't a waste of time since your body does all kinds of things when you sleep (grow, heal, etc.) and your mind can do some nice things while sleeping too, espesially if realise you're dreaming/sleeping and can take control over your dream.

But let's get back to if..then.else statements Laughing .


Last edited by Guest on 24 Jul 2003 05:52:14 pm; edited 1 time in total
Back to top
omni


Member


Joined: 14 Jun 2003
Posts: 115

Posted: 26 Jul 2003 08:06:12 am    Post subject:

which one of these are faster?

1. If A=1:2->B
2. If A=1:Then
2->B
End
3.(A=1)2->B
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 26 Jul 2003 08:12:38 am    Post subject:

3 is always faster
2 is second
1 is the slowest
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 26 Jul 2003 08:27:16 am    Post subject:

(A=1)2->B is definetly faster, don't forget you can save a byte by doing:
2(A=1->B
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 26 Jul 2003 01:42:19 pm    Post subject:

if A is just 1 or 0, then u could do just 2A->B and make it even faster! (and smaller!)
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 26 Jul 2003 04:21:57 pm    Post subject:

one thing i need to point out:
if u use 2(A=1->B or 2A->B, B will always be 2 or 0
if u use if A=1:2->B or if A=1:then:2->B:end then B will either be 2 or what ever it was bfore the statement.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 14 Nov 2003 05:30:25 pm    Post subject:

A new use for If statements:


Code:
:Repeat 0
(some code)
:If X=0
:End
(some more code)
:End


If X=0. then 'some more code' would not be executed.
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 15 Nov 2003 06:45:18 am    Post subject:

It's hardly new, but yes, it works.
Back to top
anduril66
Anduril is the Flame of the West!


Member


Joined: 25 May 2003
Posts: 129

Posted: 21 Nov 2003 05:26:50 pm    Post subject:

I tried a time test, but for me the if:stuff was faster than the if:then:stuff:end, when "stuff" is a statement. Why does the calc processor search for an end if it doesn't see a then?
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 22 Nov 2003 01:36:43 pm    Post subject:

On my calculator (TI-83 Plus Silver Edition, low batteries warning appeared once a couple of days ago), I did a time test, here are the results:

The condition was 1>0, the statement was sin(X) where X was the for loop variable
The if-then did 500 loops in 11 seconds, the if in 10 seconds.

The condition was 1<0, the statement was the same
The if-then did 500 loops in 4 seconds, the if in 12 seconds.

The condition was X<250, the statement was the same
The if-then did 500 loops in 7 seconds, the if in 8 seconds.

In conclusion, the if-then is faster when the condition is likely to be false. But when the condition is likely to be true most of the time, if would work better. If the condition is equally likely to be true or false, if-then has a slight advantage in speed.

B+(A=1)(2-B -> B would work to leave the old value of B if A <> 1


Last edited by Guest on 22 Nov 2003 01:39:49 pm; edited 1 time in total
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page Previous  1, 2
» View previous topic :: View next topic  
Page 2 of 2 » All times are UTC - 5 Hours

 

Advertisement