Skip to content

This repository contains a C-program for calculating with numbers in number systems with arbitrary integer bases.

License

Notifications You must be signed in to change notification settings

FabianHaeusel/integer-base-arithmetic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

integer-base-arithmetic

This repository contains a C-program for performing basic arithmetic operations on numbers in number systems with arbitrary integer bases. It was created in the practical course "Grundlagenpraktikum: Rechnerarchitektur (GRA)" (computer architecture) in the summer semester 2023 by the computer science students @felixhauptmann, @DominikSch004 and @FabianHaeusel at the Technical University Munich (TUM).

The german project title was "Arithmetik in Zahlensystemen mit ganzzahliger Basis".

Feel free to try out the program by building it using make. The help screen that provides information about the command-line-interface can be opened via the argument -h. You can use this program to easily compute simple operations on absurdly large integers or in any non-standard bases :)

Features/options:

  • specify the two operands (numbers to calculate with) as positional arguments after calling the executable
  • specify the base of the number system in which you want to operate using -b followed by the base written in decimal notation
  • specify the alphabet of the number system in which you want to operate using -a (mandatory, if |base| > 10). The length of the alphabet must be equal to |base| and the alphabet has to consist of printable ASCII characters
  • the operator can be set using -o followed by either +,- or * for addition, subtraction and multiplication respectively (there is no division)
  • tests that test the functionality and integrity of the program can be run using -t
  • there are three different implementations of the arithmetic operations: change between them using -V <impl>, you can choose between 0, 1 and 2 (descriptions below)
  • you can benchmark the runtime of the program using -B
  • list all implementations using -l

Implementations

  1. Binary Conversion Implementation (SIMD): This implementation calculates the result of the arithmetic operation by first converting the numbers into binary, then performing the operation and then converting the result back to the original base. This implementation is enhanced by using SIMD (Single Instruction multiple data) operations (on a maximum of 128 bits)
  2. Binary Conversion Implementation (SISD): This implementation calculates the result of the arithmetic operation by first converting the numbers into binary, then performing the operation and then converting the result back to the original base. This implementation is not enhanced and therefore uses SISD (Single Instruction Single Data) operations
  3. Naive Implementation: This implementation calculates the result without conversion into another base (This is the fastest implementation)

About

This repository contains a C-program for calculating with numbers in number systems with arbitrary integer bases.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages