Re: [Gambas-user] binary numeral system

2009-04-15 Thread Simonart Dominique
vlahonick vlahonick a écrit : > > hello all :D > > i am trying to create a program that calculates a number from the binary > numeral system and gives a result > > example of what the program will do : > > we have the number (at binary numeral system) 10011 > > so to have result we have to do

Re: [Gambas-user] binary numeral system

2009-04-14 Thread Ron_1st
On Wednesday 15 April 2009, Jeff Gray wrote: > > 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 scientis

Re: [Gambas-user] binary numeral system

2009-04-14 Thread Jeff Gray
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: ron...@tiscali.nl > > > > function bin2dec(s

Re: [Gambas-user] binary numeral system

2009-04-14 Thread Simonart Dominique
Ron_1st a écrit : > On Tuesday 14 April 2009, Simonart Dominique wrote: >> PUBLIC SUB Button1_Click() >> DIM S AS String >> DIM i, y, N AS Integer >> >> S = TextArea1.Text >> y = Len(S) >> if y = 0 THEN RETURN >> N = 0 >> FOR i = 1 to y >>d = Val(Mid(S, i, 1)) ' I assume

Re: [Gambas-user] binary numeral system

2009-04-14 Thread Ron_1st
On Tuesday 14 April 2009, Simonart Dominique wrote: > PUBLIC SUB Button1_Click() > DIM S AS String > DIM i, y, N AS Integer > >     S = TextArea1.Text >     y = Len(S) >     if y = 0 THEN RETURN >     N = 0 >     FOR i = 1 to y >        d = Val(Mid(S, i, 1)) ' I assume that d is 0 or 1 >        N

Re: [Gambas-user] binary numeral system

2009-04-14 Thread Jeff
End If > > Next i > > End Function > > > > very best regards > > Emil > > > > > -Ursprüngliche Nachricht- > Von: Simonart Dominique [mailto:simonart.domini...@wanadoo.fr] > Gesendet: Dienstag, 14. April 2009 14:04 > An: mail

Re: [Gambas-user] binary numeral system

2009-04-14 Thread Emil Tchekov
Ursprüngliche Nachricht- Von: Simonart Dominique [mailto:simonart.domini...@wanadoo.fr] Gesendet: Dienstag, 14. April 2009 14:04 An: mailing list for gambas users Betreff: Re: [Gambas-user] binary numeral system vlahonick vlahonick a écrit : > > hello all :D > > i am trying to create a progr

Re: [Gambas-user] binary numeral system

2009-04-14 Thread Simonart Dominique
vlahonick vlahonick a écrit : > > hello all :D > > i am trying to create a program that calculates a number from the binary > numeral system and gives a result > > example of what the program will do : > > we have the number (at binary numeral system) 10011 > > so to have result we have to do

Re: [Gambas-user] binary numeral system

2009-04-14 Thread Emil Tchekov
regards Emil -Ursprungliche Nachricht- Von: vlahonick vlahonick [mailto:tsopanotr...@hotmail.com] Gesendet: Dienstag, 14. April 2009 11:22 An: gambas-user@lists.sourceforge.net Betreff: [Gambas-user] binary numeral system hello all :D i am trying to create a program that calculates a

[Gambas-user] binary numeral system

2009-04-14 Thread vlahonick vlahonick
hello all :D i am trying to create a program that calculates a number from the binary numeral system and gives a result example of what the program will do : we have the number (at binary numeral system) 10011 so to have result we have to do (1*2^4)+(0*2^3)+(0*2^2)+(1*2^1)+(1*2^0)= 16+0+0+2+1