Skip to content

Latest commit

 

History

History
30 lines (27 loc) · 801 Bytes

File metadata and controls

30 lines (27 loc) · 801 Bytes

IADF

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.

Usage:

  1. Specify the needed capacity of the arithmetic into the file "iadf.h":
...
#define IADFCAPACITY 10
...
  1. 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);
  1. Please look the file "demo.c" for the more descriptive example.