Giter Site home page Giter Site logo

lucluclucluclucluc / double-conversion-decimal-binary Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 18 KB

Efficient binary-decimal and decimal-binary conversion routines. u int8 /u int16 /u int32 / float16 / float34 / to binary string or Array Binary. Can invert operation. Use IEEE 754 - 1985

Home Page: http://lucasbertola.github.io/double-conversion-decimal-binary

License: MIT License

JavaScript 100.00%

double-conversion-decimal-binary's Introduction

Double Conversion Decimal Binary Build Status

A simple but powerful libraire to convert decimals to binary and binary to decimal

##Usage

Require the module

var doubleConversion = require('double-conversion-decimal-binary');

uint8 to Array Binary

doubleConversion.uint8(5).toArrayBinary(); // [0,0,0,0,0,1,0,1]

uint8 to String Binary

doubleConversion.uint8(5).toStringBinary(); // "00000101"

Array Binary to uint8

doubleConversion.arrayBinary([0,0,0,0,0,1,0,1]).toUint8(); // 5

String Binary to uint8

doubleConversion.StringBinary("00000101").toUint8(); // 5

uint8, uint16, uint32, float32, float64

In above exemples, you can see how tu use uint8. But other type of number works in the same way!

doubleConversion.uint8(5).toArrayBinary();
doubleConversion.uint16(5).toArrayBinary();
doubleConversion.uint32(5).toArrayBinary();
doubleConversion.float32(5).toArrayBinary();
doubleConversion.float64(5).toArrayBinary();

doubleConversion.uint8(5).toStringBinary();
doubleConversion.uint16(5).toStringBinary();
doubleConversion.uint32(5).toStringBinary();
doubleConversion.float32(5).toStringBinary();
doubleConversion.float64(5).toStringBinary();

doubleConversion.arrayBinary([0,0,0,0,0,1,0,1]).toUint8();
doubleConversion.arrayBinary([0,0,0,0,0...lot of numbers..0,1,0,1]).toUint16();
doubleConversion.arrayBinary([0,0,0,0,0...lot of numbers..0,1,0,1]).toUint32();
doubleConversion.arrayBinary([0,0,0,0,0...lot of numbers..0,1,0,1]).toFloat32();
doubleConversion.arrayBinary([0,0,0,0,0...lot of numbers..0,1,0,1]).toFloat64();

doubleConversion.StringBinary("00000101").toUint8();
doubleConversion.StringBinary("000...lot of numbers...00101").toUint16();
doubleConversion.StringBinary("000...lot of numbers...00101").toUint32();
doubleConversion.StringBinary("000...lot of numbers...00101").toFloat32();
doubleConversion.StringBinary("000...lot of numbers...00101").toFloat64();

What is differences between uint8, uint16, uint32, float32 and float64 ?

http://my.math.wsu.edu/help/matlab/uint8.html

https://en.wikipedia.org/wiki/IEEE_754-1985

##Installation

You will can install Double Conversion Decimal Binary with npm:

npm install double-conversion-decimal-binary --save

##Contribute

Double Conversion Decimal Binary is an Open Source project that started in Lyon, French. Anybody in the world is welcome to contribute to the development of the project.

If you want to contribute feel free to send PR's, just make sure to run the gulp test task before submiting it. This way you'll run all the test specs .

<3

double-conversion-decimal-binary's People

Contributors

lucasbertola avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

puppybits

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.