Utilities > Custom Math Functions

Custom Math Functions

Article #: Product: Version:


The DMExpress Custom Function Framework allows users to write their own custom functions in C/C++, build them into a Unix/Windows 32/64 bit library, and seamlessly integrate them into DMExpress at both design and run time.

A set of math functions, developed with the custom function interface by wrapping the standard C/C++ math library functions, are provided as a plugin library for DMExpress.





BinaryExponent (frexp)

BinaryMantissa (frexp)







FractionPart (modf)









The attached .cpp file and pre-built libraries use the DMExpress custom function interface to wrap the C/C++ math library functions. They define the following arithmetic and trigonometric functions, which can be made available in DMExpress by including the library in your DMExpress environment as described in Additional Information.

For each function, we display the signature as it appears in DMExpress as well as the API function declaration as it appears in the .cpp file, where the macros around the input and output parameters define the respective data types as explained in Custom function interface in the DMExpress Help.

Exponential Functions

Floating Point Manipulation Functions

Nearest Integer Floating Point Operations

Trigonometric Functions

Hyperbolic Functions


395_MathFunctions.zip, which contains the MathFunctions.cpp file, 32 and 64 bit Windows .dll files, and a 64 bit Linux .so file

Additional Information

To use the attached pre-built library, simply copy the appropriate version for your OS to the <DMExpress>/Plugins folder, where <DMExpress> is the DMExpress installation directory, and restart the Task Editor if it's already running. The functions will appear in the Custom submenu of the Function dropdown menu of the Expression Builder and Condition Builder dialogs.

For more information on creating and building custom functions for DMExpress, and making them available in the DMExpress environment, see Custom function framework in the DMExpress Help.

The functions provided in this library essentially pass straight through to the corresponding C library functions, making them subject to the following potential limitations:

  • The precision of floating point math as performed by the C library functions is inherently limited, so results may not be exact. Users may wish to adjust the results using the DMExpress Round() function.

  • The output of these functions is not guaranteed to be the same across different platforms, due to the variation in C library implementations and processor architecture.

  • The functions do not perform any additional error checking, relying on the behavior of the C library functions for user-supplied input. Input considered invalid by the C library functions may return output values such as NaN (Not a Number) or positive or negative infinity, or may even have undefined results.

Last updated: