Many routines in the libbfp754 Library are more optimized for Intel® microprocessors than for non-Intel microprocessors.
To use the library, include the header file, bfp754.h, in your program.
Here is an example program illustrating the use of the library on Linux* OS. This content is specific to C++; it does not apply to DPC++.
//binary.c
#include <stdio.h>
#include <bfp754.h>
int main(){
double a64, b64;
float c32;
a64 = 1.000000059604644775390625;
b64 = 1.1102230246251565404236316680908203125e-16;
c32 = __binary32_add_binary64_binary64(a64, b64);
printf("The addition result using the libary: %8.8f\n", c32);
c32 = a64 + b64;
printf("The addition result without the libary: %8.8f\n", c32);
return 0;
}
The command for compiling binary.c is:
icc -fp-model source -fp-model except binary.c –lbfp754
The output of a.out will look similar to the following:
The addition result using the libary: 1.00000012
The addition result without the libary: 1.00000000