Microsoft math library routines require floating-point support to perform calculations with real numbers (numbers that can contain fractions). This support can be provided by the floating-point libraries that accompany your compiler software or by an 8087, 80287, or 80387 coprocessor. The names of the functions that require floating-point support are listed below:
acos_acoslasin_asinlatan_atanlatan2_atan2latof_atoldBessel_cabs_cabslceil_ceill_clear87_control87cos_coslcosh_coshl_dieeetomsbindifftime_dmsbintoieee_ecvtexp_explfabs_fabsl_fcvt_fieeetomsbinfloor_floorlfmod_fmodl_fmsbintoieee_fpresetfrexp_frexpl_gcvt_hypot_hypotlldexp_ldexpllog_logllog10_log10lmodf_modflpow_powlsin_sinlsinh_sinhlsqrt_sqrtl_status87strtod_strtoldtan_tanltanh_tanhl
Note that the Bessel routine does not correspond to a single function, but to 12 functions named _j0, _j1, _jn, _y0, _y1, _yn, _j0l, _j1l, _jnl, _y0l, _y1l, and _ynl. Also note that the _clear87 and _control87 functions are not available with the /FPa compiler option.
Also requiring floating-point support is the printf family of functions (_cprintf, fprintf, printf, _snprintf, sprintf, vfprintf, vprintf, _vsnprintf, and vsprintf). These functions require support for floating-point input and output if used to print floating-point values.
The compiler tries to detect whether floating-point values are used in a program so that supporting functions are loaded only if required. This behavior saves a considerable amount of space for programs that do not require floating-point support.
When you use a floating-point type specifier in the format string for a printf or scanf call, make sure you specify floating-point values or pointers to floating-point values in the argument list. These must correspond to any floating-point type specifiers in the format string. The presence of floating-point arguments allows the compiler to detect that floating-point support code is required. If a floating-point type specifier is used to print an integer argument, for example, floating-point values will not be detected because the compiler does not actually read the format string used in the printf and scanf functions. For instance, the following program produces an error at run time:
void main( void ) /* This example causes an error */
{
long f = 10L;
printf("%f", f);
}
In the preceding example, the functions for floating-point support are not loaded because
No floating-point arguments are given in the call to printf.
No floating-point values are used elsewhere in the program.
As a result, the following error occurs:
Floating point not loaded
Here is a corrected version of the above call to printf in which the long integer value is cast to double:
void main( void ) /* This example works correctly */
{
long f = 10L;
printf("%f", (double) f);
}