Add preprocessor macros, error codes

Add a couple of preprocessor macros for data access and an error code enum so
that the arithmatic functions can return useful values instead of relying on
printing messages to stderr.