.\" ISO/IEC TS 18661-1 technical specification.
.\" snprintf and other man.3 pages.
.\"
-.TH STRFROMD 3 2016-12-02 "GNU C Library"
+.TH STRFROMD 3 2016-12-02 "GNU" "Linux Programmer's Manual"
.SH NAME
strfromd, strfromf, strfroml \- convert a floating-point value into
-a string.
+a string
.SH SYNOPSIS
+.nf
.B #include <stdlib.h>
-.sp
-.BI "int strfromd (char *restrict " str ", size_t " n ",
-.br
-.BI " const char *restrict " format ", double " fp ");"
-.br
-.BI "int strfromf (char *restrict " str ", size_t " n ",
-.br
-.BI " const char *restrict " format ", float "fp ");"
-.br
-.BI "int strfroml (char *restrict " str ", size_t " n ",
-.br
-.BI " const char *restrict " format ", long double " fp ");"
-.sp
+
+.BI "int strfromd(char *restrict " str ", size_t " n ",
+.BI " const char *restrict " format ", double " fp ");"
+.BI "int strfromf(char *restrict " str ", size_t " n ",
+.BI " const char *restrict " format ", float "fp ");"
+.BI "int strfroml(char *restrict " str ", size_t " n ",
+.BI " const char *restrict " format ", long double " fp ");"
+.fi
+
.in -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
.ad b
.SH DESCRIPTION
-The
-.BR strfrom ()
-class of functions converts a floating-point value
-.I fp
-into a string of characters
+These functions convert a floating-point value,
+.IR fp ,
+into a string of characters,
.IR str ,
with a configurable
.IR format
and
.BR strfroml ()
functions are equivalent to
-.sp
-.in +4
-.BI "snprintf (str, n, format, fp)"
-.in
-.sp
+
+ snprintf(str, n, format, fp);
+
except for the
.I format
string.
.SS Format of the format string
The
.I format
-string must start with the character %.
-This is followed by an optional precision which starts with period
+string must start with the character \(aq%\(aq.
+This is followed by an optional precision which starts with the period
character (.), followed by an optional decimal integer.
-If no integer is specified after the period character, the precision used
-is zero.
-Finally, it should have one of the conversion specifiers
+If no integer is specified after the period character,
+a precision of zero is used.
+Finally, the format string should have one of the conversion specifiers
.BR a ,
.BR A ,
.BR e ,
.sp
The implementation conforms to the C99 standard on conversion of NaN and
infinity values:
-.sp
-.in +4
+
+.RS
If
.I fp
is a NaN, +NaN, or -NaN, and
Likewise if
.I fp
is infinity, it is converted to [-]inf or [-]INF.
-.in
-.sp
+.RE
+
A malformed
.I format
string results in undefined behavior.
.sp
.TS
allbox;
-lb lb lb
+lbw11 lb lb
l l l.
Interface Attribute Value
T{
.SH CONFORMING TO
C99, ISO/IEC TS 18661-1.
.SH NOTES
-The behavior of
+The
.BR strfromd (),
.BR strfromf (),
and
functions take account of the
.B LC_NUMERIC
category of the current locale.
-
.SH EXAMPLES
To convert the value 12.1 as a float type to a string using decimal
notation, resulting in "12.100000":