NuruProgramming / Nuru

A Swahili Programming Language built from the ground up
https://nuruprogramming.org
GNU General Public License v2.0
188 stars 30 forks source link

Support for various numeral systems #63

Open neicore opened 1 year ago

neicore commented 1 year ago

Describe the feature

Currently, we only have support for the base 10 numeral system but it would be cool to support other systems like Hexadecimal numbers for example.

Use Case

Low-Level Programming In systems programming or when working with hardware, hexadecimal and binary representations are often used to specify memory addresses, bit patterns, and control registers.

Data Encoding and Decoding: When dealing with data formats like binary, hexadecimal, or base64, the ability to convert between numeral systems is crucial for tasks such as data serialization, deserialization, and encoding/decoding.

Cryptography: Cryptographic algorithms often require working with binary data and performing bitwise operations.

Network Programming: Network protocols like IP addresses and MAC addresses are often represented in hexadecimal notation.

Mathematics Applications: In mathematical applications, different numeral systems might be used to represent numbers or perform specific calculations.

Educational Purposes: Teaching programming and computer science concepts can benefit from exposing students to different numeral systems. It helps in understanding how computers store and manipulate data.

Custom Base Number Systems: Some specialized applications may require custom base number systems.

Proposed Solution

A function for converting string to a number that will take a string and a radix and return a number and if the one of the parameters are incorrect, throw an errora

Other Information

No response

Acknowledgements

Version used

v0.2.0

Environment details (OS name and version, etc.)

    OS: Linux 6.1 Manjaro Linux
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 6.19 GB / 15.31 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
AvicennaJr commented 6 days ago

After one year I'll attempt this