gray code

  • Thread starter Srinivas Rao \(Rbin/eds2\)
  • Start date
S

Srinivas Rao \(Rbin/eds2\)

HI all,
Can any one tell me what the term "gray coding" mean in C programming.

with regards,
K Srinivas
 
R

Richard Bos

Srinivas Rao \(Rbin/eds2\) said:
Can any one tell me what the term "gray coding" mean in C programming.

In C programming, it means nothing. Gray encoding (and note, it's Gray,
not gray, since it's a proper name - Frank Gray, from Bell Labs) is a
way to encode integers. It has its advantages and disadvantages compared
to a pure binary encoding, but in comp.lang.c one of its worst
disadvantages is that C mandates a pure binary encoding, and so Gray
encodings are off-topic here, _unless_ you can show code which handles
Gray encoding "by hand". That'd be possible, but pretty inefficient.

Richard
 
J

Joe Wright

Srinivas said:
HI all,
Can any one tell me what the term "gray coding" mean in C programming.
It has no meaning in C. It is a binary counting scheme where only one
bit changes per count. It can be implemented several ways, I believe.
 
J

Julian V. Noble

Srinivas Rao (Rbin/eds2) said:
HI all,
Can any one tell me what the term "gray coding" mean in C programming.

with regards,
K Srinivas

Look in Knuth.

--
Julian V. Noble
Professor Emeritus of Physics
(e-mail address removed)
^^^^^^^^
http://galileo.phys.virginia.edu/~jvn/

"Science knows only one commandment: contribute to science."
-- Bertolt Brecht, "Galileo".
 
R

Richard Heathfield

Julian said:
Look in Knuth.

I did so. Gray coding is covered in Chapter 7, which hasn't been published
yet AFAIK. Having said that, there are sufficient hints in Volume II to
answer the OP's question.
 
P

pete

Richard said:
In C programming, it means nothing. Gray encoding
(and note, it's Gray,
not gray, since it's a proper name - Frank Gray, from Bell Labs) is a
way to encode integers. It has its advantages and disadvantages
compared
to a pure binary encoding, but in comp.lang.c one of its worst
disadvantages is that C mandates a pure binary encoding, and so Gray
encodings are off-topic here, _unless_ you can show code which handles
Gray encoding "by hand". That'd be possible, but pretty inefficient.

http://groups.google.com/groups?&[email protected]
 
D

Dave Von Pless

I did so. Gray coding is covered in Chapter 7, which hasn't been published
yet AFAIK. Having said that, there are sufficient hints in Volume II to
answer the OP's question.

Knuth does have Pre-Fascicle 2a available at his web site, which includes
some Gray code coverage.

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,264
Messages
2,571,065
Members
48,770
Latest member
ElysaD

Latest Threads

Top