shawn3090 Posted September 24, 2010 Share Posted September 24, 2010 Does anyone have an algotrithm to extract digits out of a number? I have thought for a long time about this to no avail. For example:the 3 out of 1545253553the 4th digit from the left of 011001011 I will be mainly using this for binary. [hide=Stats][/hide]"One death is a tragedy. A million deaths is a statistic."-Joseph Stalin Link to comment Share on other sites More sharing options...
Markup Posted September 24, 2010 Share Posted September 24, 2010 Programming language and a summary of what you intend to achieve please Link to comment Share on other sites More sharing options...
obfuscator Posted September 24, 2010 Share Posted September 24, 2010 Well like Markup said it really depends on the language. Most languages have a wide variety of string functions that you could utilize. Are you looking to convert a decimal number to binary? "It's not a rest for me, it's a rest for the weights." - Dom Mazzetti Link to comment Share on other sites More sharing options...
shawn3090 Posted September 24, 2010 Author Share Posted September 24, 2010 I am trying to make a binary to decimal converter on the ti-84 plus silver. I have the OS 2.53 with new shortcuts and stuff. I already made a d-b converter which was ridiculously easy. [hide=Stats][/hide]"One death is a tragedy. A million deaths is a statistic."-Joseph Stalin Link to comment Share on other sites More sharing options...
obfuscator Posted September 24, 2010 Share Posted September 24, 2010 Hmm I don't know assembly :? "It's not a rest for me, it's a rest for the weights." - Dom Mazzetti Link to comment Share on other sites More sharing options...
Markup Posted September 25, 2010 Share Posted September 25, 2010 Various methods, the easiest of which is to locate and use the built in d-b b-d b-h b-o ect functions.If you wish to take on the challenge then assembly is the ideal method but I take it you are using BASIC or similar. In which case you could use a custom list as an alternative to an array and store each "binary bit" as an entry then perform simple logic to convert to decimal Link to comment Share on other sites More sharing options...
Peregrine Posted September 25, 2010 Share Posted September 25, 2010 (edited) Use iPart(x) to retrieve the integer part of x. If you let x = {4.5, pi, or 2}, iPart(x) will return {4, 3, or 2}. Use fPart(x) to retreive the fractional part of x.If you let x = {4.5, pi, or 2}, fPart(x) will return {0.5, pi-3, or 0}. To call a digit from a specific place in a number, use iPart(10*fPart(x*10^(n-1))), where x is your number, and n is the number of digits behind the decimal point the number you are calling is located.iPart(10*fPart(1.23456789*10^7))) will return the 8th ((7+1)th) number to the right of the decimal point, which is 9. Oh, I guess you would probably be using this to call numbers from the left side of the decimal point. in that case..iPart(10*fPart(1234.56789*10^(-n))) will return the nth number to the left of the decimal point. There's probably a better code but I just threw that together from my other code, as you can probably guess. It's probably best to stick with Dec->Bin functions already in the calculator (Not sure where to find 'em on the 84), but if you wanted to do it this way, these functions would be how you would do it. Edited September 25, 2010 by Peregrine One-Clicking the Summer Garden[AOW] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now