Developer Guide and Reference

Contents

Function List

Intel's Numeric String Conversion library (
libistrconv
) functions are listed in this topic.

Routines to convert floating-point numbers to ASCII strings

Intel's Numeric String Conversion Library supports the following functions to convert floating-point number
x
to string
s
in various formats, where
l
represents the length of the formatted string allowing for full conversion (not including the null terminator).
__IML_float_to_string
,
__IML_double_to_string
Description:
These functions are similar to
snprintf(s, n, "%.*g", p, x)
in
stdio.h
, where
p
specifies the maximum number of significant digits in either fixed-point or exponential notation format. If
n
is zero, nothing is written and
s
may be a null pointer. Output characters beyond the
(n-1)
th
character are discarded and a null character is appended at the end.
l
is returned on success; otherwise the result is undefined.
Calling interface:
int __IML_float_to_string
(
char * s
,
size_t n
,
int p
,
float x
);
int __IML_double_to_string
(
char * s
,
size_t n
,
int p
,
double x
);
__IML_float_to_string_f
,
__IML_double_to_string_f
Description:
These functions are similar to
snprintf(s, n, "%.*f", p, x)
in
stdio.h
, where
p
specifies the number of digits after the decimal point in the fixed-point notation format. If
n
is zero, nothing is written and
s
may be a null pointer. Output characters beyond the
(n-1)
th
character are discarded and a null character is appended at the end.
l
is returned on success; otherwise the result is undefined.
Calling interface:
int __IML_float_to_string_f
(
char * s
,
size_t n
,
int p
,
float x
);
int __IML_double_to_string_f
(
char * s
,
size_t n
,
int p
,
double x
);
__IML_float_to_string_e
,
__IML_double_to_string_e
Description:
These functions are similar to
snprintf(s, n, "%.*e", p, x)
in
stdio.h
, where
p
specifies the number of digits after the decimal point in the exponential notation format. If
n
is zero, nothing is written and
s
may be a null pointer. Output characters beyond the
(n-1)
th
character are discarded and a null character is appended at the end.
l
is returned on success; otherwise, the result is undefined.
Calling interface:
int __IML_float_to_string_e
(
char * s
,
size_t n
,
int p
,
float x
);
int __IML_double_to_string_e
(
char * s
,
size_t n
,
int p
,
double x
);
__IML_f_to_str
,
__IML_d_to_str
Description:
These functions are similar to
snprintf(s, n, “%.*g”, p, x)
in
stdio.h
, where
p
specifies the maximum number of significant digits in either fixed-point or exponential notation format. If
l < n
, all output characters are stored in
s
with a null terminator at the end. Otherwise, output characters beyond the
n
th
character are discarded and no null character is appended at the end. If
n
is zero, nothing is written and
s
may be a null pointer.
l
is returned on success; otherwise the result is undefined.
Calling interface:
int __IML_f_to_str
(
char * s
,
size_t n
,
int p
,
float x
);
int __IML_d_to_str
(
char * s
,
size_t n
,
int p
,
double x
);
__IML_f_to_str_f
,
__IML_d_to_str_f
Description:
These functions are similar to
snprintf(s, n, “%.*f”, p, x)
in
stdio.h
, where
p
specifies the number of digits after the decimal point in the fixed-point notation format. If
l < n
, all output characters are stored in
s
with a null terminator at the end. Otherwise, output characters beyond the
n
th
character are discarded and no null character is appended at the end. If
n
is zero, nothing is written and
s
may be a null pointer.
l
is returned on success; otherwise the result is undefined.
Calling interface:
int __IML_f_to_str_f
(
char * s
,
size_t n
,
int p
,
float x
);
int __IML_d_to_str_f
(
char * s
,
size_t n
,
int p
,
double x
);
__IML_f_to_str_e
,
__IML_d_to_str_e
Description:
These functions are similar to
snprintf(s, n, “%.*e”, p, x)
in
stdio.h
, where
p
specifies the number of digits after the decimal point in the exponential notation format. If
l < n
, all output characters are stored in
s
with a null terminator at the end. Otherwise, output characters beyond the
n
th
character are discarded and no null character is appended at the end. If
n
is zero, nothing is written and
s
may be a null pointer.
l
is returned on success; otherwise the result is undefined.
Calling interface:
int __IML_f_to_str_e
(
char * s
,
size_t n
,
int p
,
float x
);
int __IML_d_to_str_e
(
char * s
,
size_t n
,