Decimal/bits converter
9 posts • Page 1 of 1
Decimal/bits converter
Is there a formula to get the number of bits needed to make a certain amount of numbers? So 2 will give 1, 4 will give 2, 8 will give 3 etc
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
-

Matten - Posts: 435
- Joined: Mon Apr 05, 2010 2:03 pm
- Location: The Netherlands
Re: Decimal/bits converter
in binary i dont think 8 will result in 3, it is more likely it will have 0001 as output;
- Code: Select all
2^0,2^1,2^2,2^3
0 0 0 1
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
-

monstertje3 - Posts: 343
- Joined: Sat Sep 05, 2009 4:29 pm
- Location: N-H, NL
Re: Decimal/bits converter
I don't mean a binary number, but the number of bits. With 3 bits there are 2^3 = 8 possible combinations, with 4 bits there are 2^4 = 16 possible combinations etc... But I want the reverse, so how many bits do you need to get 8 or 16 possible combinations.
I also like your sig
I also like your sig
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
-

Matten - Posts: 435
- Joined: Mon Apr 05, 2010 2:03 pm
- Location: The Netherlands
Re: Decimal/bits converter
You can do this via logarithms.
2ˣ = Y
X = log₂(Y)
2ˣ = Y
X = log₂(Y)
-

Ivan - Posts: 203
- Joined: Tue Oct 06, 2009 2:01 pm
- Location: Croatia
Re: Decimal/bits converter
Thanks! I tested it with some graphing app, but does Algodoo know the log2 function? I thought I've seen the log function somewhere, but not log2.
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
-

Matten - Posts: 435
- Joined: Mon Apr 05, 2010 2:03 pm
- Location: The Netherlands
Re: Decimal/bits converter
log2 is the same as log Y / log 2
if i am understanding that log2(Y) 2logY is
if i am understanding that log2(Y) 2logY is
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
-

monstertje3 - Posts: 343
- Joined: Sat Sep 05, 2009 4:29 pm
- Location: N-H, NL
Re: Decimal/bits converter
Log(y)/log(2) nearly crashed that app...
I'll start my comp now to try it in Algodoo, and otherwise I suggest adding a logN(base,power) function
Edit: I searched for "log" in the console, but that also doesn't give any logarithm related stuff. Anyone any ideas?
I'll start my comp now to try it in Algodoo, and otherwise I suggest adding a logN(base,power) function
Edit: I searched for "log" in the console, but that also doesn't give any logarithm related stuff. Anyone any ideas?
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
-

Matten - Posts: 435
- Joined: Mon Apr 05, 2010 2:03 pm
- Location: The Netherlands
Re: Decimal/bits converter
according to the functions list in the thyme section, there isn't a log function 
maybe make a suggestion in the suggestion forum
maybe make a suggestion in the suggestion forum
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
-

monstertje3 - Posts: 343
- Joined: Sat Sep 05, 2009 4:29 pm
- Location: N-H, NL
Re: Decimal/bits converter
No need, I'll add Math.log (natural base) and Math.log10 (nice to have) in next version.
Emil Ernerfeldt, lead developer
- emilk
- Posts: 616
- Joined: Mon Aug 31, 2009 11:01 am
- Location: Umeå, Sweden
9 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 6 guests



