Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Extracting digits out of integers

Featured Replies

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 1545253553
  • the 4th digit from the left of 011001011

 

I will be mainly using this for binary.

animsig.gif

[hide=Stats]I_B_Trolin_U.png[/hide]

"One death is a tragedy. A million deaths is a statistic."

-Joseph Stalin

Programming language and a summary of what you intend to achieve please

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?

polvCwJ.gif
"It's not a rest for me, it's a rest for the weights." - Dom Mazzetti

  • Author

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.

animsig.gif

[hide=Stats]I_B_Trolin_U.png[/hide]

"One death is a tragedy. A million deaths is a statistic."

-Joseph Stalin

Hmm I don't know assembly :?

polvCwJ.gif
"It's not a rest for me, it's a rest for the weights." - Dom Mazzetti

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

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 by Peregrine

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.