#Get size of numeric string as number

11 messages · Page 1 of 1 (latest)

hallow quailBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

solemn wren
#

put simply:

If we already have a number x, just use floor(log2(x)) + 1 to get it's size in bits

with a string of numbers that you don't know the size of, how would you do this?

hallow quailBOT
#

@solemn wren

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.

clear meteor
#

could you use strtol?

#

that would turn string to int

solemn wren
#

how would I make it start as base 10 (let's say "8") and go to binary (1000)

#

@clear meteor

clear meteor
#

you want to print number in binary form?

#

or string number to string binary?

solemn wren
#

string in base 10 to string in binary

#

!solved