CornSnakes.com Forums  
  Tired of those Google and InfoLinks ads? Register and log in!

Go Back   CornSnakes.com Forums > Member Forums > Rich Z's Blatherings
Register FAQ Members List Calendar

Notices

Rich Z's Blatherings Since Connie and I have retired the SerpenCo business, topics here will focus on topics of a more personal and general nature.

Correspondence lag time........
Reply
 
Thread Tools Display Modes
Old 08-13-2002, 05:11 PM   #11
jim
counting in binary...

1 ...10 ...11 ...100 ...101 ...110 ...111 ...1000 ...1001 ...1010 ...1011 ...etc.
 
Old 08-13-2002, 07:01 PM   #12
Kat
No, Rich... 10. See.. 01 is still 1 reguardless of whether you're in base 2, base 10, base 8, base 16... whatever.

Since you're a computer geek as well, here's another one for you...

Why do programmers like Halloween?

Because OCT 31 = DEC 25





BTW, Rich... you may want to read through this thread started by Serpwidgets...

http://www.cornsnakes.com/forums/sho...&threadid=2111
 
Old 08-13-2002, 07:06 PM   #13
SilverTongue
you sure you are only 15 Kat???
 
Old 08-13-2002, 07:11 PM   #14
kenster
wow, I am learning so much here!! all about binary, and programming. What a great place, thanks for letting us use it RICH!!!
 
Old 08-13-2002, 07:20 PM   #15
Kat
What?

Lisa, I'm 22... I don't know where you got the idea I was only 15...



(Although, not to brag, but I could do this sort of thing when I was 15 too... just wasn't into snakes yet then. ;)
 
Old 08-14-2002, 04:59 AM   #16
Rich Z
Quote:
No, Rich... 10. See.. 01 is still 1 reguardless of whether you're in base 2, base 10, base 8, base 16... whatever.
Aha! Gotcha!

In binary, '0' is a true state. So a single bit can hold two conditions, ON and OFF. Using a two digit binary number, 00 = 1, 01 = 2. To continue that along to the maximum state values a two digit binary number can hold, 10 = 3 and 11 = 4. Do you see now the curve I threw at you?

In programming this can trip up many people when arrays are initialized and referenced incorrectly. In many cases, you want to reference the first element in an array as ARRAY(0), and NOT ARRAY(1). In such a case, ARRAY(1) actually points to the second element in the array. If the language you are working in allows binary values in the variable being used as the array index, this can be substantially faster than using an integer index. Since computers 'think' in binary', there is no delay in a conversion from integer to binary. In tight loops, this can make a big difference.

Hey, my brain actually does work at 5am after cleaning and feeding baby snakes for 16 hours! But time for lights out for me............ Got to start all over again in a few more hours.....
 
Old 08-14-2002, 12:19 PM   #17
Kat
Funny, I was under the impression that 0=0. Or were we assuming that zero is cannot be represented as a valid binary number?

If you want to get technical, too, 01 signifies a positive binary number equivalent to 1 in decimal. It depends on just what version of binary numbers you're using.

After all, 10 can mean two different negative numbers if we assume a signed two-bit integer, depending on whether we're talking one's compliment or two's compliment.


Reguardless... when I said 10 = 2, I meant that 0 was a valid number in the domain I was using, and that 0=0. Now if you want to go through and argue what other things 10 can represent in binary, up to you.


Besides, what language are you used to programming in that hides the zero-based array implementation from the coder? I'm sure I've run into only one language like that, but I forget exactly which one it was... PASCAL maybe? I forget. I'm so used to C and C++...
 
Old 08-14-2002, 07:37 PM   #18
Rich Z
Quote:
Besides, what language are you used to programming in that hides the zero-based array implementation from the coder? I'm sure I've run into only one language like that, but I forget exactly which one it was... PASCAL maybe? I forget. I'm so used to C and C++...
Who said anything about hiding? Many beginning coders assume that the array index reference begins with one, not realizing that in, for instance, a five element array, the elements are referenced 0 thru 4. And as you program in C, I am sure you realize this is the case in the C language as well as many others.

No sense boring you with a list of languages I have dabbled in. Suffice it to say that I bought my first computer in 1978 and cut my teeth on Z80 assembler. Most recently I was getting paid for Visual FoxPro and Perl programming and there were a lot of other jobs and tasks inbetween that required me to learn the lingo needed.

Unfortunately I don't have much time to dabble with coding lately, as I really do enjoy that kind of pasttime.

I'm not arguing with you. This was done playfully. I can't see why you got so defensive about something like this. This was just an exercise in computer geek definitions that I thought you would find amusing. My mistake.
 
Old 08-16-2002, 01:36 PM   #19
Kat
The part of your post that bothered me is that you seemed to assume that I was a beginner programmer and did not know the first thing about array indices. I suppose that is more a reflection on some of the programmers you must have been used to dealing with (or perhaps you were attempting to define it for the layperson?), but I did feel slighted on that implication. Aaaaanyway...
 
Old 08-31-2002, 01:46 AM   #20
Serpwidgets
Kewl, geek wars. :)

Hey Rich, you only have 3 years up on me. I started in '81 on a 4Kbyte TRS-80 CoCo, and moved up to a C=64 and learned assembly on that. (I believe that was also a Z80 chip. )

You lost me somewhere with saying that binary 00 = decimal 1. I not only did programming, but also have formal training and about 5 years experience as an electronics technician (both military and civilian) and I've never seen anything like what you mentioned ("00" = 1, "01"=2, etc.)

I assume that was some method you were taught that helped people look at numbers in a way which made addressing arrays easier, since that way you wouldn't have to go against the mind's grain to start an array with 0. (?)

The only thing I do recognize is your statement that zero is a true state. Although AFAIK that depends on the specifications of the CPU, as that would depend how the comparison for "true" is done by any particular language. (e.g. are you subtracting and branching based on the state of the zero flag?) In assembly, this is all dependent on the programmer's personal preference, as there is no actual "true" or "false" at all... if you designate some memory location as a flag and then check to see if it's true, you can subtract 1 from it and branch on the zero flag, or you could subtract 0 from it and branch on the zero flag... which one is "true" is 100% dependent upon the person who wrote the program, and it could even be different for different flags/comparisons.

Quote:
If the language you are working in allows binary values in the variable being used as the array index, this can be substantially faster than using an integer index.
This would only be true in a language that is interpreted OTF. Any precompiled language wouldn't have that concern. (I think Perl is OTF, but I dunno the first thing about FoxPro.)
 

Join now to reply to this thread or open new ones for your questions & comments! Cornsnakes.com is the largest online community dedicated to cornsnakes . Registration is open to everyone and FREE. Click Here to Register!

Google
 
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
The new server is up and guess which site gets to be the guinea pig this time?? Rich Z Discussions about this site 1 01-24-2003 06:41 PM
time? hurricane1 Miscellaneous Corn Snake Discussions 2 01-04-2003 07:49 AM
Hello,,,first time here Wa$ted Corn Snake Photo Gallery 9 12-11-2002 05:24 AM
is it fuzzie time?!? little twiglet Husbandry and Basic Care 2 11-09-2002 08:21 AM
Settle in time ?? arachniac Behavior 4 10-02-2002 08:00 PM


All times are GMT -4. The time now is 05:00 PM.





Fauna Top Sites
 

Powered by vBulletin® Version
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Page generated in 0.04696989 seconds with 10 queries
Copyright Rich Zuchowski/SerpenCo