A C library implementing conversions between int/float and a custom 96-bit decimal type, with support for special values (INFINITY, -INFINITY, NAN).
C (C99), gcc, ar
| Function | Signature |
|---|---|
| int → decimal | int from_int_to_decimal(int src, decimal *dst) |
| float → decimal | int from_float_to_decimal(float src, decimal *dst) |
| decimal → int | int from_decimal_to_int(decimal src, int *dst) |
| decimal → float | int from_decimal_to_float(decimal src, float *dst) |
Return codes: 0 — success, 1 — error.
cd src
# Build static library → libs/convertorslib.a
make
# Clean build artifacts
make cleanLink against the resulting static library:
gcc main.c -L./src/libs -lconvertorslib -lm -o decimal