binary to decimal??

Blitz3D Forums/Blitz3D Programming/binary to decimal??

Yue(Posted 2010) [#1]
hello, is there a command that I spent a binary number to decimal.


JBR(Posted 2010) [#2]
text 0,0, %11111111


will print 255


ClayPigeon(Posted 2010) [#3]
I don't believe there is - you have to make your own. A binary number is a representation of a fixed number of digits. It's up to you to decide where to put the decimal point. Typically, you convert the binary to an integer, then divide it by 10 times the number of places you want to move the decimal point by. Fixed point decimals always have their decimal point in the dead center of the number (0000.0000) regardless of the number. I'm not sure about floating point decimals, but I think they move the decimal point to the center of the bulk of the non-zero numbers? I hope I got that right.. :D


Matty(Posted 2010) [#4]
ClayPigeon I don't think you have any idea what you're talking about...Yue see JBR's answer above.


xlsior(Posted 2010) [#5]
http://www.blitzbasic.com/Community/posts.php?topic=92570#1055523


ClayPigeon(Posted 2010) [#6]
Ohhhhhh- you mean binary to DECIMAL number. I thought he was saying binary to a number that contains a decimal point in some shape or form. Sorry. :)


Yue(Posted 2010) [#7]
@ JBR: hear and what happens when I use $ this operator is the role.

Sample $1978


JBR(Posted 2010) [#8]
Hi,

%11111111 is binary ( 0,1)

$FF is hexa decimal ( 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F )

both = 255 decimal

I'd do a google search to find out more. (wiki maybe have good description)

Jim


D4NM4N(Posted 2010) [#9]
^wot he said

ps $1978 = 6520 in hex 2 decimal.

Last edited 2010