CMATH for Borland C++
CMATH is a comprehensive library for complex-number arithmetis and mathematics. It is primarily intended as a high-quality replacement for the complex class libraries of popular C++ compilers. In addition, all functions may be called from C, without the necessity to use C++.
Superior speed, accuracy and safety are achieved through the implementation in Assembly language (as opposed to the compiled or inline C++ code of the compilers’ complex class libraries).
Only for the most simple tasks, alternative inline C++ functions are used.
The implementation was guided by the following rules:
1. Without any compromise, top priority is always given to the mathematically correct result, with the accuracy demanded for the respective data type. Especially for complex functions, this necessitates a very thorough treatment of many different situations. To this end, the various cases have to be distinguished with pedantic care.
2. Mathematical functions must be "safe" under all circumstances. They may for no reason simply crash, but have to perform a decent error treatment. This is true even – and perhaps especially – for seemingly nonsense arguments, with the single exception of the non-numbers INF and NAN, which occur themselves only as a result of serious errors in other functions.
3. By all possible means, greatest execution speed must be attained. (After all, you did not buy your fast computer for nothing!)
4. The program code has to be as compact as possible. However, in case of conflicts, faster execution speed is always given priority over smaller code size.
For programmers who prefer classis C-style functions over C++, CMATH provides all complex-number operations and functions also for the language C.
This is accomplished through an additional set of alternative declarations of the complex types as structs in place of classes.
The C++ classes and the C structs are binary compatible with each other.
This point may become important for large projects with mixed C and C++ modules.
Existing C++ code which uses the complex class library contained in <complex.h> can be left unchanged, because the CMATH functions and data types are also binary compatible with those of <complex.h>.
The present version of CMATH was designed to be used with Borland C++, version 3.0 or later, running under DOS, Windows3.x, or Windows95.
The library for the memory model Win32 for Windows95 and WindowsNT requires Borland C++, version 4.0 or higher.
Download a shareware version now
It contains libraries for the memory models Win32, Windows3.x-LARGE, and DOS-LARGE. All of them require, at least, a 386 computer equipped with a 387 coprocessor. (This means: no emulation, no 486SX, but preferrably 486DX, Pentium or higher.)
The full (registered) version contains libraries for all memory models of DOS, 16-bit Windows and 32-bit Windows.
These libraries in turn are shipped in three versions, individually optimized for each degree of backward-compatibility: 486DX/Pentium+ 386+ (387 coprocessor required) 286+ (no coprocessor required) The full version of CMATH is mailed with printed documentation.