FREALTOA C-3

NAME

frealtoa - format REAL to ASCII

SYNOPSIS

#include <cbase/dtypes.h>

int frealtoa (r, format, dest, len, dec)

REAL r;

char *format;

char *dest;

int len;

int dec;

DESCRIPTION

Frealtoa converts the floating point value r to an ASCII string with format, storing the result in dest: a string of len bytes. The number of bytes used in the formatted result is returned.

If there are more than 15 digits to the left of the decimal point, scientific notation of the form [-]n.n[n...]e[-]nn is forced.

If dec is a zero or positive value, it is taken as the number of decimal places to be formatted. This number overrides the number of decimal places in the format string. If the value to be converted contains fewer than dec decimal places, zeros are inserted at the end of the number. If the value contains more decimal places, the value is rounded at dec decimal places.

SEE ALSO

getfreal(C-3), realtoa(C-3)

C/Base Reference Manual Chapter 13, "Formatting Data Values"

DIAGNOSTICS

If an error occurs, frealtoa returns a negative number and the contents of dest are undefined. The following symbolic error codes are defined in <cbase/dtypes.h>:

FTOOBIG the formatted result is longer than the destination length,

len

FFORMAT format is empty or contains invalid key letters