Skip to main content

Convert two's complement integer to gray code and vice versa

Project description

Introduction

Graycode library implements functions to convert gray code to two's complement integer and vice versa.

See LICENSE.md for copyright information. This library is licensed under the MIT license.

See https://en.wikipedia.org/wiki/Gray_code for details about gray codes.

Installation

$ python3 setup.py install

Or from PyPi:

$ pip3 install graycode

Example

import graycode

graycode.tc_to_gray_code(2)
# => 3
graycode.gray_code_to_tc(3)
# => 2

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graycode-1.0.4.tar.gz (2.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page