TAILIEUCHUNG - Lập Trình C# all Chap "NUMERICAL RECIPES IN C" part 69

Tham khảo tài liệu 'lập trình c# all chap "numerical recipes in c" part 69', công nghệ thông tin phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 896 Chapter 20. Less-Numerical Algorithms exhausted. Here is a piece of code for doing both G i and its inverse. unsigned long igray unsigned long n int is For zero or positive values of is return the Gray code of n if is is negative return the inverse Gray code of n. int ish unsigned long ans idiv if is 0 This is the easy direction return n n 1 ish 1 This is the more complicated direction In hierarchical ans n stages starting with a one-bit right shift cause each for bit to be XORed with all more signibcant bits. ans idiv ans ish if idiv 1 ish 16 return ans ish 1 Double the amount of shift on the next cycle. In numerical work Gray codes can be useful when you need to do some task that depends intimately on the bits of i looping over many values of i. Then if there are economies in repeating the task for values differing by only one bit it makes sense to do things in Gray code order rather than consecutive order. We saw an example of this in for the generation of quasi-random sequences. CITED REFERENCES AND FURTHER READING Horowitz P. and Hill W. 1989 TheArtofElectronics 2nd ed. New York Cambridge University Press . Knuth . Combinatorial Algorithms vol. 4 of The Art of Computer Programming Reading MA Addison-Wesley . Unpublished. Will it be always so Cyclic Redundancy and Other Checksums When you send a sequence of bits from point A to point B you want to know that it will arrive without error. A common form of insurance is the parity bit attached to 7-bit ASCII characters to put them into 8-bit format. The parity bit is chosen so as to make the total number of one-bits versus zero-bits either always even even parity or always odd odd parity . Any single bit error in a character will thereby be detected. When errors are sufficiently rare and do not occur closely bunched in time use of parity provides sufficient error detection. Unfortunately in real situations a single noise event is likely to disrupt more than one bit. Since the parity bit has

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.