Mathematical functions
- Plus() (+)
- Minus() (-)
- Times() (*)
- Divide() (/)
- Positive() (+)
- Negate() (-)
The C name of each of these functions is prefixed by the name of the opaque data type for which they are defined.
BladeSmith generates only template code for these mathematical functions.
The generated code
These functions have an unused MI_FPARAM argument and one or two opaque data type arguments, and they return a pointer to the resulting opaque type structure.
In
the generated code, the return value is set to 0
.
You must add code to perform the required operation.
Complete the code
- Add your declarations, if necessary.
- Remove the call to mi_db_error_raise(), which raises an error stating that the routine is not implemented.
- Compute the return value and store it in the Gen_RetVal argument.
The database server frees the allocated memory when it has finished processing the result.
See HCL OneDB™ User-Defined Routines and Data Types Developer's Guide for more information about these functions.
Example
The Matrix DataBlade® module contains some of the mathematical functions.