ecvt man page on DigitalUNIX

Man page or keyword search:  
man Server   12896 pages
apropos Keyword Search (all sections)
Output format
DigitalUNIX logo
[printable version]

ecvt(3)								       ecvt(3)

NAME
       ecvt, ecvt_r, fcvt, fcvt_r, gcvt - Convert a floating-point number to a
       string

SYNOPSIS
       #include <stdlib.h>

       char *ecvt(
	       double value,
	       int num_digits,
	       int *decimal_ptr,
	       int *sign ); char *fcvt(
	       double value,
	       int num_digits,
	       int *decimal_ptr,
	       int *sign ); char *gcvt(
	       double value,
	       int num_digits,
	       char *buffer );

       The following obsolete functions are supported  in  order  to  maintain
       backward	 compatibility with previous versions of the operating system.
       You should not use them in new designs.	int ecvt_r(
	       double value,
	       int num_digits,
	       int *decimal_ptr,
	       int *sign,
	       char *buffer,
	       int len ); int fcvt_r(
	       double value,
	       int num_digits,
	       int *decimal_ptr,
	       int *sign,
	       char *buffer,
	       int len );

LIBRARY
       Standard C Library (libc)

PARAMETERS
       Specifies the double value to be converted.  Specifies  the  number  of
       digits  in  the	resulting  string.   Holds the position of the decimal
       point relative to the beginning of the string. A negative number	 means
       the  decimal  point  is	to the left of the digits given in the string.
       Holds a value of 0 (zero) if the value  is  positive  or	 zero,	and  a
       nonzero	value  if it is negative.  Specifies the character array to be
       used as scratch space in calculations and  for  storing	the  resulting
       string.	 Specifies  the	 length	 of  buffer.  Because ecvt temporarily
       stores intermediate results of its calculations in the buffer, you must
       specify a len greater than 370. A value of 400 is recommended.

DESCRIPTION
       The ecvt(), fcvt(), and gcvt() functions convert floating-point numbers
       to null-terminated strings.

       The ecvt() function converts the value specified by the value parameter
       to a null-terminated string of length num_digits, and returns a pointer
       to it.  The resulting low-order digit is rounded according to the  cur‐
       rent  rounding mode. The decimal_ptr parameter is assigned to the posi‐
       tion of the decimal point relative to the position of the  string.  The
       sign  parameter is assigned a value of 0 (zero) if value is positive or
       zero, and a nonzero value if value is negative. The decimal  point  and
       sign are not included in the string.

       The  fcvt() function is the same as the ecvt() function, except that it
       rounds to the correct digit for outputting num_digits of digits in C or
       FORTRAN F-format. In the F-format, num_digits is taken as the number of
       digits desired after the decimal point.

       The gcvt() function converts the value specified by the value parameter
       to  a  null-terminated string, stores it in the array pointed to by the
       buffer parameter, and then returns buffer. The gcvt() function attempts
       to  produce a string of num_digits significant digits in FORTRAN F-for‐
       mat. If this is not possible, then E-format  is	used.  The  string  is
       ready  for  printing, complete with minus sign, decimal point, or expo‐
       nent, as appropriate. Trailing zeros are suppressed.

       In the F-format, num_digits is the number of digits desired  after  the
       decimal	point. Very large numbers produce a very long string of digits
       before the decimal point, and then num_digits of digits after the deci‐
       mal  point.  For	 large	numbers, it is preferable to use the gcvt() or
       ecvt() function so that the E-format will be used.

       The ecvt(), fcvt(), and gcvt() functions represent the  following  spe‐
       cial  values that are specified in IEEE Standard 754-1985 for floating-
       point arithmetic according to the following table.

								       ecvt(3)
[top]

List of man pages available for DigitalUNIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net