Using the Open-Source Database SLEEF
- Generate the dynamic library libsleef.so based on the compilation guide on the SLEEF official website (https://sleef.org/).
- The sleef interface is different from the standard libm interface. To enable the application to call the sleef library without modifying the source code, add a wrap interface.The wrap interface template is as follows. You can supplement math function interfaces based on project requirements.
// wrapmath.c #include<sleef.h> double exp (double a) { return Sleef_expd1_u10purec(a); } double log (double a) { return Sleef_logd1_u10purec(a); } double pow (double a, double b) { return Sleef_powd1_u10purec(a, b); } - Compile wrapmath.c into libwrapmath.so. During compilation, use -L to specify the link paths of libwrapmath.so and libsleef.so.