Engineer, on 05 May 2013 - 04:28 PM, said:
Binary and Computer Logics
#21
Posted 05 May 2013 - 08:55 PM
#22
Posted 05 May 2013 - 10:25 PM
i was trying to solve myan math problems (base 20) and didnt want to convert by hand
converting from something to base 10 is easy, you just loop through the number and do this:
C+(N*(B^I)) -> CC = result, N = NUM[I+1], B = base, I = iterator (starts at 0)
so, every number in NUM is worth (multiplied) by the base raised by the iterator
converting to a base is a bit trickier, this time in LUA:
local O={}
local N=100
local B=20
repeat
local D=(N%B)/>/>+1
N=math.floor(N/B)/>/>
table.insert(O,1,D)
until N==0
as you can see i use modulous instead of getting the remainder of the divisionif you are doing this on paper just use subtraction, unless you are really good at long division
#23
Posted 05 May 2013 - 10:34 PM
PixelToast, on 05 May 2013 - 10:25 PM, said:
PixelToast, on 05 May 2013 - 10:25 PM, said:
#24
Posted 05 May 2013 - 11:03 PM
theoriginalbit, on 05 May 2013 - 03:19 PM, said:
<source-base> —> <base-10> —> <target-base>
#25
Posted 05 May 2013 - 11:08 PM
KingOfNoobs, on 05 May 2013 - 11:03 PM, said:
#26
Posted 08 May 2013 - 09:28 PM
#27
Posted 08 May 2013 - 11:07 PM
Symmetryc, on 08 May 2013 - 09:28 PM, said:
#28
Posted 09 May 2013 - 02:17 AM
#29
Posted 10 May 2013 - 05:26 PM
#31
Posted 11 May 2013 - 06:21 AM
KingOfNoobs, on 11 May 2013 - 06:01 AM, said:
Edit: I realized that there was a huge flaw in my code
#32
Posted 11 May 2013 - 07:12 AM
Symmetryc, on 11 May 2013 - 06:21 AM, said:
KingOfNoobs, on 11 May 2013 - 06:01 AM, said:
Edit: I realized that there was a huge flaw in my code
#33
Posted 11 May 2013 - 07:53 AM
KingOfNoobs, on 11 May 2013 - 07:12 AM, said:
most of the Lua APIs you can use object notation on.
#34
Posted 11 May 2013 - 08:14 AM
theoriginalbit, on 11 May 2013 - 07:53 AM, said:
KingOfNoobs, on 11 May 2013 - 07:12 AM, said:
most of the Lua APIs you can use object notation on.
3 user(s) are reading this topic
0 members, 3 guests, 0 anonymous users











