strfromd,  strfromf,  strfroml  - convert a floating-point value into a


   #include <stdlib.h>

   int strfromd(char *restrict str, size_t n,
                const char *restrict format, double fp);
   int strfromf(char *restrict str, size_t n,
                const char *restrict format, float fp);
   int strfroml(char *restrict str, size_t n,
                const char *restrict format, long double fp);

   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

   strfromd(), strfromf(), strfroml():


   These functions convert a floating-point value, fp, into  a  string  of
   characters,  str,  with  a  configurable  format  string.   At  most  n
   characters are stored into str.

   The terminating null character ('\0') is written if and only  if  n  is
   sufficiently  large,  otherwise  the  written  string is truncated at n

   The strfromd(), strfromf(), and strfroml() functions are equivalent to

       snprintf(str, n, format, fp);

   except for the format string.

   Format of the format string
   The format string must start with the character '%'.  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, a precision of zero is used.  Finally, the
   format string should have one of the conversion specifiers a, A, e,  E,
   f, F, g, or G.

   The  conversion  specifier  is applied based on the floating-point type
   indicated by the function suffix.  Therefore,  unlike  snprintf(),  the
   format   string  does  not  have  a  length  modifier  character.   See
   snprintf(3) for a detailed description of these conversion specifiers.

   The implementation conforms to the C99 standard on  conversion  of  NaN
   and infinity values:

          If  fp  is  a  NaN,  +NaN,  or  -NaN,  and f (or a, e, g) is the
          conversion specifier, the conversion  is  to  "nan",  "nan",  or
          "-nan",  respectively.   If  F  (or  A,  E, G) is the conversion
          specifier, the conversion is to "NAN" or "-NAN".

          Likewise if fp is infinity, it is converted to [-]inf or [-]INF.

   A malformed format string results in undefined behavior.


   The strfromd(), strfromf(), and strfroml() functions return the  number
   of  characters  that  would  have  been  written in str if n had enough
   space, not counting the terminating null  character.   Thus,  a  return
   value of n or greater means that the output was truncated.


   The  strfromd(),  strfromf(), and strfroml() functions are available in
   glibc since version 2.25.


   For an explanation of the terms used in this section, see attributes(7)
   and the POSIX Safety Concepts section in GNU C Library manual.

   Interface    Attribute                         Value          
                Thread safety                     MT-Safe locale 
   strfromf(),  Asynchronous signal safety        AS-Unsafe heap 
                Asynchronous cancellation safety  AC-Unsafe mem  
   Note: these attributes are preliminary.


   C99, ISO/IEC TS 18661-1.


   The  strfromd(),  strfromf(),  and strfroml() functions take account of
   the LC_NUMERIC category of the current locale.


   To convert the value 12.1 as a float type to  a  string  using  decimal
   notation, resulting in "12.100000":

       #define __STDC_WANT_IEC_60559_BFP_EXT__
       #include <stdlib.h>
       int ssize = 10;
       char s[ssize];
       strfromf(s, ssize, "%f", 12.1);

   To  convert the value 12.3456 as a float type to a string using decimal
   notation with two digits of precision, resulting in "12.35":

       #define __STDC_WANT_IEC_60559_BFP_EXT__
       #include <stdlib.h>
       int ssize = 10;
       char s[ssize];
       strfromf(s, ssize, "%.2f", 12.3456);

   To convert the value 12.345e19 as a  double  type  to  a  string  using
   scientific  notation  with  zero  digits  of  precision,  resulting  in

       #define __STDC_WANT_IEC_60559_BFP_EXT__
       #include <stdlib.h>
       int ssize = 10;
       char s[ssize];
       strfromd(s, ssize, "%.E", 12.345e19);


   atof(3), snprintf(3), strtod(3)


   This page is part of release 4.09 of the Linux  man-pages  project.   A
   description  of  the project, information about reporting bugs, and the
   latest    version    of    this    page,    can     be     found     at


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.

Free Software

Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.

Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.

Free Books

The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.

Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.

Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.