Module base_change

Module base_change 

Source
Expand description

Base conversion module for arbitrary-precision numbers.

This module provides functionality to convert numbers between different bases, supporting bases from 2 to 62. It handles both integer and fractional numbers, and uses a custom BigUint implementation for arbitrary-precision arithmetic.

§Features

  • Convert numbers between any base from 2 to 62
  • Support for fractional numbers
  • Arbitrary-precision arithmetic using BigUint

§Examples

use dev_utils::base_change::convert_base;

assert_eq!(convert_base("1010", 2, 10).unwrap(), "10");
assert_eq!(convert_base("FF", 16, 10).unwrap(), "255");

Structs§

BigUint
A custom arbitrary-precision unsigned integer implementation.
FixedDecimal
A fixed-point decimal number representation.

Enums§

BaseConversionError
Represents errors that can occur during base conversion.

Functions§

convert_base
Converts a number from one base to another.
digit_to_val
Converts a digit character to its numeric value.
val_to_digit
Converts a numeric value to its digit character representation.