[Gambas-user] binary numeral system

Jeff Gray jeff at ...2103...
Wed Apr 15 00:49:37 CEST 2009


That's pretty cool.

My only comment would be that it took me a few goes at stepping through the code before I worked out how the blazes it worked, so perhaps less readable than the exponent version.

But hey - I'm no rocket scientist :-)
 
> From: ronstk at ...239...
> 
> 
> 
> function bin2dec(sBin) as long
> dim r as long
> r=0
> for i= 1 to len(sBin)
> r = r*2 + Val(Mid(sBin, i, 1)) 
> next
> return r
> end
> 

_________________________________________________________________
Need a new place to rent, share or buy? Let ninemsn property search for you.
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Edomain%2Ecom%2Eau%2F%3Fs%5Fcid%3DFDMedia%3ANineMSN%5FHotmail%5FTagline&_t=774152450&_r=Domain_tagline&_m=EXT


More information about the User mailing list