The fixed-capacity decimal arithmetic for the numbers with the decimal point natural placement (this representation used for financial hardware calculators).
The Author: Ihar Areshchankau, 2019.
- Specify the needed capacity of the arithmetic into the file "iadf.h":
...
#define IADFCAPACITY 10
...
- Include the header "iadf.h" into the program and use the abilities it provides:
#include "iadf.h"
#define N (IADFCAPACITY + 4)
...
char a[] = "1234.56789";
char b[] = "-98765.4321";
char c[N];
struct IADF dfa, dfb;
...
iadfInit (&dfa, a);
iadfInit (&dfb, b);
iadfAdd (&dfa, &dfb);
iadfToStr (&dfa, c, N);
printf ("Addition: (%s) + (%s) = (%s)\n", a, b, c);
- Please look the file "demo.c" for the more descriptive example.