Next: Portability functions, Previous: Inline functions, Up: Using the library
The extended numerical type long double
is part of the ANSI C
standard and should be available in every modern compiler. However, the
precision of long double
is platform dependent, and this should
be considered when using it. The IEEE standard only specifies the
minimum precision of extended precision numbers, while the precision of
double
is the same on all platforms.
In some system libraries the stdio.h
formatted input/output
functions printf
and scanf
are not implemented correctly
for long double
. Undefined or incorrect results are avoided by
testing these functions during the configure
stage of library
compilation and eliminating certain GSL functions which depend on them
if necessary. The corresponding line in the configure
output
looks like this,
checking whether printf works with long double... no
Consequently when long double
formatted input/output does not
work on a given system it should be impossible to link a program which
uses GSL functions dependent on this.
If it is necessary to work on a system which does not support formatted
long double
input/output then the options are to use binary
formats or to convert long double
results into double
for
reading and writing.