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
Harrierfalcon
The Raptor of Calcs


Super Elite (Last Title)


Joined: 25 Oct 2006
Posts: 2535

Posted: 21 Jan 2007 06:30:03 pm    Post subject:

I realize this thread is a little old by now, but anyways...

What's the smallest program you can make that gets a decimal number and converts it to a 1-byte binary?


Last edited by Guest on 21 Jan 2007 06:34:33 pm; edited 1 time in total
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 21 Jan 2007 06:37:34 pm    Post subject:

I believe goose has a routine for that. Somewhere. His website is down.
Back to top
Super Speler
Super Awesome Dude


Calc Guru


Joined: 28 Nov 2005
Posts: 1391

Posted: 21 Jan 2007 06:40:43 pm    Post subject:

I backed up his site, I'll check it, give me a sec'.

EDIT: He has this (closest thing I see):
[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]
PROGRAM:BASECONV
int(round(BfPart(NB^seq(I,I,?int(ln(N)/ln(B))-1,?1
Returns a list containing the digits of N in base B.

Limitations/Known Issues

Fails for inputs less than 1 for N and less than 2 for B.

Other Notes

To specify a dimension, change the begin argument to ?value.


Last edited by Guest on 21 Jan 2007 06:47:11 pm; edited 1 time in total
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 21 Jan 2007 06:44:13 pm    Post subject:

[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]int(round(2fPart(N2^seq(I,I,‾int(ln(N)/ln(2))-1,‾1
found it. N is the decimal number

Last edited by Guest on 21 Jan 2007 06:45:21 pm; edited 1 time in total
Back to top
Super Speler
Super Awesome Dude


Calc Guru


Joined: 28 Nov 2005
Posts: 1391

Posted: 21 Jan 2007 06:47:39 pm    Post subject:

You beat me to my edit...
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 21 Jan 2007 07:03:08 pm    Post subject:

yeah. I didn't see the
Quote:
The routines aren't going anywhere Routines.html
the first time.
Back to top
Harrierfalcon
The Raptor of Calcs


Super Elite (Last Title)


Joined: 25 Oct 2006
Posts: 2535

Posted: 21 Jan 2007 07:33:20 pm    Post subject:

Hmm...Perfect. Do you know if it's legal to use the routine in a program (that I'm going to distribute) without infringing the copyright?
Back to top
Super Speler
Super Awesome Dude


Calc Guru


Joined: 28 Nov 2005
Posts: 1391

Posted: 21 Jan 2007 08:06:44 pm    Post subject:

[quote name='"Goose Commons"']All routines on this page are public domain and are free to be used in any program at no consequence to the user.[/quote]
Back to top
Harrierfalcon
The Raptor of Calcs


Super Elite (Last Title)


Joined: 25 Oct 2006
Posts: 2535

Posted: 21 Jan 2007 08:46:05 pm    Post subject:

Shh....his routine gives you {0,0,0,0,0} or something along those lines when you enter 16. I made my own Smile
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 21 Jan 2007 08:53:59 pm    Post subject:

I'd replace the -int() with -int(round()) if it's what I'm thinking.
Back to top
Harrierfalcon
The Raptor of Calcs


Super Elite (Last Title)


Joined: 25 Oct 2006
Posts: 2535

Posted: 21 Jan 2007 09:20:55 pm    Post subject:

The only thing I need to know now is how many possible 5-digit binary combinations are there?

I'm guessing 2^5, which is 32, but I get the weird feeling there's more.
Back to top
Fallen Ghost


Elite


Joined: 15 Jun 2006
Posts: 955

Posted: 21 Jan 2007 09:26:16 pm    Post subject:

2^4+2^3+2^2+2^1+2^0=32

Well, it gives a number of 0-31 (zero is a number), and a signed value of -15 to +15.

Meguesses it's for ASM programming...

[Edit: It may be giving out lists either because of what Darkerline said or because you cannot represent a base-16 number with 1 digit in a decimal system. Or it's because I don't know what that code does (I don't love seq())


Last edited by Guest on 21 Jan 2007 09:28:51 pm; edited 1 time in total
Back to top
luby
I want to go back to Philmont!!


Calc Guru


Joined: 23 Apr 2006
Posts: 1477

Posted: 21 Jan 2007 09:39:03 pm    Post subject:

Fallen Ghost wrote:
because you cannot represent a base-16 number with 1 digit in a decimal system. [post="95443"]<{POST_SNAPBACK}>[/post]

yes you can. 9 in hexidecimal is 9 in decimal
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 UTC - 5 Hours

 

Advertisement