13 if (dec_number == 0) {
14 return std::vector<bool>(size, 0);
16 unsigned int tmp = dec_number;
17 std::vector<bool> res;
31 while (res.size() < size) {
39 unsigned int actual_exp = 1;
40 for (
unsigned int i = 0 ; i < binary_number.size() ; i++) {
41 unsigned int bit = binary_number[i];
42 res += actual_exp * bit;
The namespace of the library.
This file declares the function to convert a number in its decimal form to its binary form and vice-v...
std::vector< bool > decimal_to_binary(unsigned int dec_number, unsigned int size)
Converts a number in decimal form to binary form.
unsigned int binary_to_decimal(const std::vector< bool > &binary_number)
Converts a number in binary form to decimal form.