The decNumber Library, version 3.68
Copyright (c) IBM Corporation, 2010. All rights reserved. ©
|23 Jan 2010
|[previous | contents | next]
The section contains a detailed description of each of the modules in
the library. Each description is in three parts:
- An overview of the module and a description of its primary data
A description of other definitions in the header (.h) file.
This summarizes the content of the header file rather than detailing
every constant as it is assumed that users will have a copy of the
header file available.
A description of the functions in the source (.c) file.
This is a detailed description of each function and how to use it, the
intent being that it should not be necessary to have the source file
available in order to use the functions.
The modules all conform to some general rules:
They are reentrant (they have no static variables and may safely be
used in multi-threaded applications), and
use only aligned integers and strict aliasing.
All data structures are passed by reference, for best performance.
Data structures whose references are passed as inputs are never
altered unless they are also used as a result. Where appropriate,
functions return a reference to a result argument.
Only arbitrary-precision calculations might allocate memory.
Up to some maximum precision (chosen by a tuning parameter in
the decNumberLocal.h file), even these calculations do not
require allocated memory, except for rounded input arguments and some
Whenever memory is allocated, it is always released before the function
returns or raises any traps. The latter constraint implies that long
jumps may safely be made from a signal handler handling any traps, for
The names of all modules start with the string ‘dec’, and
the names of all public constants start with the string ‘DEC’.
Public functions (and macros used as functions) in a module have names
which start with the name of the module (for example, decNumberAdd).
This naming scheme corresponds to the common naming scheme in
object-oriented languages, where that function (method) might be
The types int and long are not used; instead types defined
in the C99 stdint.h header file are used to ensure integers are
of the correct length.
Strings always follow C conventions. That is, they are always
terminated by a null character (’\0’).
[previous | contents | next]