Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
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 Brain Teasers => TI-BASIC
Author Message
vanchagreen


Member


Joined: 20 Feb 2008
Posts: 136

Posted: 22 Sep 2009 10:26:23 pm    Post subject:

Find the shortest program that calculates the amount of significant figures of a number. Assume the input number is already stored in a variable (Ans, Str1, whatever).

With a one word title I have an almost impossibly small 155 bites. Beat that... Rolling Eyes

Good luck, and I hope this post might revitalize the forums!

PS. Is it bites or bytes?
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 22 Sep 2009 11:46:56 pm    Post subject:

With a one-letter name, I have it in 32 bytes.

Although, I'm not accounting for any trailing zeros that are written-in explicitly.


Last edited by Guest on 23 Sep 2009 12:02:52 am; edited 1 time in total
Back to top
vanchagreen


Member


Joined: 20 Feb 2008
Posts: 136

Posted: 23 Sep 2009 05:57:14 pm    Post subject:

What do you mean exactly by "trailing zeros"? Like 6000000 and 6.00000007?

Last edited by Guest on 23 Sep 2009 05:58:51 pm; edited 1 time in total
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 23 Sep 2009 08:45:38 pm    Post subject:

I got 31 bytes with a one-letter name, same limitations as Weregoose's. Also, 0 will give an error (which makes sense).

Edit: Forgot to support negative numbers. I have 32 bytes now as well.


Last edited by Guest on 23 Sep 2009 08:50:25 pm; edited 1 time in total
Back to top
thornahawk
μολών λαβέ


Active Member


Joined: 27 Mar 2005
Posts: 569

Posted: 23 Sep 2009 08:46:13 pm    Post subject:

"Trailing" - stuff at the end, e.g. the zeroes in 3.141592600000000 are trailing zeroes.

thornahawk
Back to top
vanchagreen


Member


Joined: 20 Feb 2008
Posts: 136

Posted: 23 Sep 2009 11:11:49 pm    Post subject:

So, in the above example, Weregoose's program would return 8 instead of 16?

Last edited by Guest on 23 Sep 2009 11:13:56 pm; edited 1 time in total
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 24 Sep 2009 06:23:16 am    Post subject:

vanchagreen wrote:
So, in the above example, Weregoose's program would return 8 instead of 16?

That sounds right. There's really no way to differentiate between the two because the floating point format doesn't store stuff like that. The only solution would be to use strings.
Back to top
vanchagreen


Member


Joined: 20 Feb 2008
Posts: 136

Posted: 24 Sep 2009 06:02:20 pm    Post subject:

I used strings. Guess that's why mine is so long.
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours

 

Advertisement