Base One Number Class, v. 7.4

Fix the loopholes in C++ high-precision arithmetic Featured in: Essential Software Library, From: Base One International Corp

Fast, high-precision decimal arithmetic for C++

The Base/1 Number Class is an innovative technology for performing extremely precise mathematical calculations. If you are a programmer building applications for a large financial institution, an engineer designing a high-precision telemetry system, or a scientist striving to minimize errors in the analysis of experimental data, you will immediately recognize the value of Base One's Number Class. Even in less demanding applications you may be surprised to discover how often undetected computational errors lead to significant inaccuracies, which are readily eliminated by using the Number Class. (U.S. Patent Number 6,384,748)

To subscribe and download
Base One Number Class, click on box

To subscribe and download Base One Number Class, click here

You get the full source code and can build applications that support an unlimited number of users.

  • Full ANSI/C++ source code, with extensive comments and documentation

  • Source is Windows, Unix, and 64-bit ready

  • Support for Windows 7, 2008, 2003, XP

  • STL (Standard Template Library) and MFC (Microsoft Foundation Classes) support

  • Thorough online documentation and examples

Why Use the Base One Number Class?

Base One's Number Class is a general-purpose alternative to the built-in numeric data types of C++, with added safeguards against a variety of common (and not-so-common) errors. Whether you write programs for Windows, Linux, Unix, DOS, or any other platform, you can use our Number Class just as easily as the native C++ number types. If you have an existing application, conversion couldn't be easier. With a few localized changes to include our header files, huge applications can be made to support greatly enhanced precision simply by recompiling.

Comprehensive error handling

Even if your application doesn't require the highest level of precision, Base One's Number Class makes it easier to write reliable applications by adding convenient error-trapping features. This covers errors like Overflow, Divide by zero, Invalid sign, etc., which are not handled automatically by C++.

C++ provides only minimal facilities for detecting and handling errors that can occur in numeric arithmetic and conversion operations. This makes it necessary for programmers to take extra steps to be sure that certain errors, such as division by zero and overflow, can not occur. Otherwise, a program may crash or simply yield incorrect results when one of these exceptional conditions arises.

All too often obscure bugs result from failing to add adequate error checking logic. The Number Class provides additional capabilities for detecting and handling errors, so these details don't burden the programmer but they also don't get overlooked.

Division by zero

C++ also doesn't detect invalid attempts to divide a number by zero (unless you consider immediately crashing to be a form of error "detection"). This too is a type of error that the Number Class makes easy to trap and handle cleanly, again without a lot of extra code. The Number Class also detects attempts to raise 0 to a negative power.

Conversion errors

Another important category of errors is those that can occur when converting back and forth between different types of numeric and character representations. The limited error-handling features of C++'s conversion functions are greatly improved upon in the Base One Number Class. For example, Number Class conversions discriminate among many specific error types, such as invalid sign, missing digit, negative number converted to an unsigned data type, particular flavors of overflow, etc. You also have the choice of detecting errors either based on a return code or by raising an exception for which you can supply your own handler.

Bottom line: you are guaranteed to be warned if the number is too large to be stored or if a desired degree of accuracy (precision) can't be maintained. Using the Number Class prevents the silent destructiveness of overflow, which comes with all the C++ numeric data types.

But the main point is that numbers can be large - with many digits both to the left and to the right of the decimal point. Support for larger ranges of values avoids insidious arithmetic truncation, without any special effort dedicated to overflow error detection and handling.

To learn more about the Base One Number Class:

"In response to a client's need for very high precision, we had to fit a new extended-precision class into our product, which is comprised of hundreds of modules, in a very short time. We were able to incorporate Base One's Number class into our product in just over a week - that's how simple it is to integrate. Technical support throughout the process was superb. Thanks to an extremely well-designed class, and the top-notch help we got from the Base One staff, we were able to provide the new capability with virtually no impact on overall performance ... Our experience was positive in every respect -- high performance, stable code, supported by extremely capable and highly available staff."

Glenn R. Miller, Director, Research and Development, Optinfo, Inc., a Jack Henry Company

"Thank you for a very useful and elegantly designed number class. It provides some significant benefits for the application I'm currently developing."

Roger Taplin, programmer/psychologist, Fairview Park, South Australia

To download Base One Number Class (and subscribe if you haven't already) click here