---
name: "strfromf"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/strfromd"
---

# strfromf(3)

convert floating point value to ASCII string

Part of [strfromd(3)](/strfromd/3.md).

## NAME

**strfromd**, **strfromf**, **strfroml** – convert floating point value to ASCII string

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<stdlib.h\>**

*int*\

**strfromd**(*char \* restrict str*, *size\_t size*, *const char \* restrict format*, *double fp*);

*int*\

**strfromf**(*char \* restrict str*, *size\_t size*, *const char \* restrict format*, *float fp*);

*int*\

**strfroml**(*char \* restrict str*, *size\_t size*, *const char \* restrict format*, *long double fp*);

## DESCRIPTION

Functions **strfromd**(), **strfromf**(), and **strfroml**() convert the floating-point value *fp* to a null terminated string, storing at most *size* bytes (including the terminating null character) into the array pointed to by *str*.

These functions are equivalent to **snprintf**(*s*, *n*, *format*, *fp*), except that default argument promotions are not applied to *fp*, and the *format* string is restricted. It shall consist of exactly the character ‘%’, followed by an optional precision that does not contain an asterisk ‘\*’, followed by one of the conversion specifiers **a**, **A**, **e**, **E**, **f**, **F**, **g**, or **G**. The conversion specifier applies to the type indicated by the function suffix, rather than by a length modifier.

Use of any other format string results in undefined behaviour, as does any undefined behaviour inherited from [snprintf(3)](/snprintf/3.md) per se. In case of a format string not specified by the standard, the string ‘EDOOFUS’ is written to *str*, subject to the same truncation rules as a successful conversion, and *errno* is set to EDOOFUS.

## RETURN VALUES

The **strfromd**(), **strfromf**(), and **strfroml**() functions, as per [snprintf(3)](/snprintf/3.md), return the number of characters( not counting the terminating null character) that would have been written had *n* been sufficiently large. Thus, the null terminated output has been completely written if and only if the returned value is both nonnegative and less than *size*.

## ERRORS

- \[EDOOFUS\]

  The *format* string is not of the form the standard specifies.

## SEE ALSO

[snprintf(3)](/snprintf/3.md), [strtod(3)](/strtod/3.md), [strtol(3)](/strtol/3.md), [strtoul(3)](/strtoul/3.md)

## STANDARDS

Functions **strfromd**(), **strfromf**(), and **strfroml**() conform to ISO/IEC 9899:2024 (“ISO C23”).
