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 prebuilt 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.
Exp(number)
DMX_CUSTOM_FUNCTION(Exp, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the basee exponential value of x, which is e^{x}.
It takes a value, x, as input, calls the math.h C library exp function on it, and assigns the resulting exponential of x as output.
Log(number)
DMX_CUSTOM_FUNCTION(Log, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the natural (basee) logarithm of x.
It takes a value, x, greater than 0, as input, calls the math.h C library log function on it, and assigns the resulting natural log of x as output.
Log10(number)
DMX_CUSTOM_FUNCTION(Log10, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the common (base10) logarithm of x.
It takes a value, x, greater than 0, as input, calls the math.h C library log10 function on it, and assigns the resulting common log of x as output.
BinaryMantissa(number)
DMX_CUSTOM_FUNCTION(BinaryMantissa, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the mantissa portion of the standard frexp function, which breaks a floating point number, x, into its binary mantissa (a floating point with an absolute value between 0.5 (inclusive) and 1.0 (exclusive)) and an integral exponent for 2, such that x = mantissa * 2^{exponent}.
It takes a floating point value, x, as input, calls the math.h C library frexp function on it, and assigns the resulting mantissa in the interval [0.5,1) as output. If x is zero, the output is zero; if x is negative, the output is negative.
BinaryExponent(number)
DMX_CUSTOM_FUNCTION(BinaryExponent, DMX_INT(output), DMX_DOUBLE(x))
This function computes the exponent portion of the standard frexp function, which breaks a floating point number, x, into its binary mantissa (a floating point with an absolute value between 0.5 (inclusive) and 1.0 (exclusive)) and an integral exponent for 2, such that x = mantissa * 2^{exponent}.
It takes a floating point value, x, as input, calls the math.h C library frexp function on it, and assigns the resulting integral exponent of 2 as output. If x is zero, the output is zero.
LdExp(number,number)
DMX_CUSTOM_FUNCTION(LdExp, DMX_DOUBLE(output), DMX_DOUBLE(x), DMX_INT(exponent))
This function computes the product of a floating point value and an integral power of 2.
It takes values x and exponent as input, calls the math.h C library function ldexp on the input, and assigns the resulting value of x * 2^{exponent} as output.
FractionPart(number)
DMX_CUSTOM_FUNCTION(FractionPart, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the fractional portion of the standard modf function, which breaks a floating point number, x, into its integer and fractional components.
It takes a floating point value, x, as input, calls the math.h C library modf function on it, and assigns the resulting fractional part of x, with the same sign as x, as output.
Ceil(number)
DMX_CUSTOM_FUNCTION(Ceil, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the ceiling of x, which is the smallest integer value not less than x.
It takes a value, x, as input, calls the math.h C library ceil function on it, and assigns the resulting ceiling of x as output.
Floor(number)
DMX_CUSTOM_FUNCTION(Floor, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the floor of x, which is the largest integer value not greater than x.
It takes a value, x, as input, calls the math.h C library floor function on it, and assigns the resulting floor of x as output.
Sin(number)
DMX_CUSTOM_FUNCTION(Sin, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the sine of x.
It takes an angle, x, in radians as input, calls the math.h C library sin function on it, and assigns the resulting sine of x as output.
Cos(number)
DMX_CUSTOM_FUNCTION(Cos, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the cosine of x.
It takes an angle, x, in radians as input, calls the math.h C library cos function on it, and assigns the resulting cosine of x as output.
ASin(number)
DMX_CUSTOM_FUNCTION(ASin, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the arc sine of x.
It takes a value, x, in the interval [1,+1] as input, calls the math.h C library asin function on it, and assigns the resulting arc sine of x in the interval [pi/2,+pi/2] radians as output.
ACos(number)
DMX_CUSTOM_FUNCTION(ACos, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the arc cosine of x.
It takes a value, x, in the interval [1,+1] as input, calls the math.h C library acos function on it, and assigns the resulting arc cosine of x in the interval [0,pi] radians as output.
ATan(number)
DMX_CUSTOM_FUNCTION(ATan, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the arc tangent of x.
It takes a value, x, as input, calls the math.h C library atan function on it, and assigns the resulting arc tangent of x, in the interval [pi/2,+pi/2] radians as output.
ATan2(number,number)
DMX_CUSTOM_FUNCTION(ATan2, DMX_DOUBLE(output), DMX_DOUBLE(y), DMX_DOUBLE(x))
This function computes the arc tangent of y/x using the sign of both arguments to determine the correct quadrant.
It takes coordinates y and x as input, calls the math.h C library function atan2 on the input, and assigns the resulting arc tangent of y/x in the interval [pi,+pi] radians, as output.
DegToRad(number)
DMX_CUSTOM_FUNCTION(DegToRad, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function converts an angle in degrees to the equivalent angle in radians.
It takes an angle, x, in degrees as input, multiplies it by pi/180, and assigns the resulting angle in radians as output.
RadToDeg(number)
DMX_CUSTOM_FUNCTION(RadToDeg, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function converts an angle in radians to the equivalent angle in degrees.
It takes an angle, x, in radians as input, multiplies it by 180/pi, and assigns the resulting angle in degrees as output.
SinH(number)
DMX_CUSTOM_FUNCTION(SinH, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the hyperbolic sine of x.
It takes an angle, x, in radians as input, calls the math.h C library sinh function on it, and assigns the resulting hyperbolic sine of x as output.
CosH(number)
DMX_CUSTOM_FUNCTION(CosH, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the hyperbolic cosine of x.
It takes an angle, x, in radians as input, calls the math.h C library cosh function on it, and assigns the resulting hyperbolic cosine of x as output.
TanH(number)
DMX_CUSTOM_FUNCTION(TanH, DMX_DOUBLE(output), DMX_DOUBLE(x))
This function computes the hyperbolic tangent of x.
It takes an angle, x, in radians as input, calls the math.h C library tanh function on it, and assigns the resulting hyperbolic tangent of x as output.
395_MathFunctions.zip, which contains the MathFunctions.cpp file, 32 and 64 bit Windows .dll files, and a 64 bit Linux .so file
To use the attached prebuilt 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:

Copyright © 2016 Syncsort All rights reserved.