# libHOBDCalc

## Introduction

libHOBDCalc (Hexadecimal, Octal, Binary, Decimal Calculator) is a little C library for converting decimal values (signed integers or floating-point values) in an string representing the value in following bases.
• Binary base (2).
• Octal base (8).

The values are converted within a string into the wanted base.

And libHOBDCalc provides the back conversion functions:
from an string representing a value in base 2, 8 or 16 to the corresponding value in decimal base.
That's not all because libHOBDCalc implement the basic operations to apply on the strings in the supported base.
• Additions from 2 strings representing values in base 2, 8 or 16.
• Subtractions from 2 strings representing values in base 2, 8 or 16.
• Multiplications from 2 strings representing values in base 2, 8 or 16.
• Divisions from 2 strings representing values in base 2, 8 or 16.

Either as integer values or as floating-point values.

## Description:

### Functions listing

• integer to base 2, 8 and 16 strings conversion:

char *inttobin(long long value, char *buffer) ;
char *inttooct(long long value, char *buffer) ;
char *inttohex(long long value, char *buffer) ;

• From base 2, 8 and 16 to integer conversion:

long long bintoint(const char *string) ;
long long bintooct(const char *string) ;
long long bintohex(const char *string) ;

• From floats to base 2, 8 and 16 strings conversion:

char *floattobinfloat(long double value, char *buffer) ;
char *floattooctfloat(long double value, char *buffer) ;
char *floattohexfloat(long double value, char *buffer) ;

• From base 2, 8 and 16 to floats conversion:

long double binfloattofloat(const char *float_string) ;
long double octfloattofloat(const char *float_string) ;
long double hexfloattofloat(const char *float_string) ;

• Binary integers strings operations:

long long binaddbin(const char *bin_str_1,   const char *bin_str_2) ;
long long binsubbin(const char *bin_str_1,   const char *bin_str_2) ;
long long binmultbin(const char *bin_str_1,  const char *bin_str_2) ;
long double bindivbin(const char *bin_str_1, const char *bin_str_2) ;

• Octal integers strings operations:

long long octaddoct(const char *oct_str_1,   const char *oct_str_2) ;
long long octsuboct(const char *oct_str_1,   const char *oct_str_2) ;
long long octmultoct(const char *oct_str_1,  const char *oct_str_2) ;
long double octdivoct(const char *oct_str_1, const char *oct_str_2) ;

long long hexaddhex(const char *hex_str_1,   const char *hex_str_2) ;
long long hexsubhex(const char *hex_str_1,   const char *hex_str_2) ;
long long hexmulthex(const char *hex_str_1,  const char *hex_str_2) ;
long double hexdivhex(const char *hex_str_1, const char *hex_str_2) ;

• Binary floats strings operations:

long double binfloataddbinfloat(const char *bin_float_str_1,  const char *bin_float_str_2) ;
long double binfloatsubbinfloat(const char *bin_float_str_1,  const char *bin_float_str_2) ;
long double binfloatmultbinfloat(const char *bin_float_str_1, const char *bin_float_str_2) ;
long double binfloatdivbinfloat(const char *bin_float_str_1,  const char *bin_float_str_2) ;

• Octal floats strings operations:

long double octfloataddoctfloat(const char *oct_float_str_1,  const char *oct_float_str_2) ;
long double octfloatsuboctfloat(const char *oct_float_str_1,  const char *oct_float_str_2) ;
long double octfloatmultoctfloat(const char *oct_float_str_1, const char *oct_float_str_2) ;
long double octfloatdivoctfloat(const char *oct_float_str_1,  const char *oct_float_str_2) ;

long double hexfloataddhexfloat(const char *hex_float_str_1,  const char *hex_float_str_2) ;
long double hexfloatsubhexfloat(const char *hex_float_str_1,  const char *hex_float_str_2) ;
long double hexfloatmulthexfloat(const char *hex_float_str_1, const char *hex_float_str_2) ;
long double hexfloatdivhexfloat(const char *hex_float_str_1,  const char *hex_float_str_2) ;

# Documentation:

Actually libHOBDCalc is distributed as an simple zip archive which contains:

• An autotool implemented building system which should work on all POSIX compliant system.
• NOTE:

The archive contains the manpages from the libHOBDCalc library project as complete as possible, instead of HTML documentation.
• the tarball archive from the libHOBDCalc project: : An autotool implemented building system (POSIX Compliant systems).

• To install on POSIX compliant systems simply type:
\$ ./configure
\$ make
\$ sudo make install

• github repository:

# Credits

Author: Eddie Brüggemann.
Contact: mrcyberfighter@gmail.com