Back to index

glibc  2.9
Defines | Functions | Variables
efgcvt.c File Reference
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/param.h>
#include <float.h>
#include <bits/libc-lock.h>
#include <math_ldbl_opt.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define FLOAT_TYPE   double
#define FUNC_PREFIX
#define FLOAT_FMT_FLAG
#define MAXDIG   (NDIGIT_MAX + 3)
#define FCVT_MAXDIG   (DBL_MAX_10_EXP + MAXDIG)
#define NDIGIT_MAX   (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0)))
#define APPEND(a, b)   APPEND2 (a, b)
#define APPEND2(a, b)   a##b
#define __APPEND(a, b)   __APPEND2 (a, b)
#define __APPEND2(a, b)   __##a##b
#define FCVT_BUFFER   APPEND (FUNC_PREFIX, fcvt_buffer)
#define FCVT_BUFPTR   APPEND (FUNC_PREFIX, fcvt_bufptr)
#define ECVT_BUFFER   APPEND (FUNC_PREFIX, ecvt_buffer)
#define cvt_symbol(symbol)   strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))

Functions

 libc_freeres_ptr (static char *FCVT_BUFPTR)
char * __APPEND (FUNC_PREFIX, fcvt)
char * __APPEND (FUNC_PREFIX, ecvt)
char * __APPEND (FUNC_PREFIX, gcvt)
 cvt_symbol (fcvt)
 cvt_symbol (ecvt)
 cvt_symbol (gcvt)

Variables

static char FCVT_BUFFER [MAXDIG]
static char ECVT_BUFFER [MAXDIG]

Define Documentation

#define __APPEND (   a,
  b 
)    __APPEND2 (a, b)

Definition at line 55 of file efgcvt.c.

#define __APPEND2 (   a,
  b 
)    __##a##b

Definition at line 56 of file efgcvt.c.

#define APPEND (   a,
  b 
)    APPEND2 (a, b)

Definition at line 53 of file efgcvt.c.

#define APPEND2 (   a,
  b 
)    a##b

Definition at line 54 of file efgcvt.c.

#define cvt_symbol (   symbol)    strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))

Definition at line 128 of file efgcvt.c.

#define ECVT_BUFFER   APPEND (FUNC_PREFIX, ecvt_buffer)

Definition at line 61 of file efgcvt.c.

#define FCVT_BUFFER   APPEND (FUNC_PREFIX, fcvt_buffer)

Definition at line 59 of file efgcvt.c.

#define FCVT_BUFPTR   APPEND (FUNC_PREFIX, fcvt_bufptr)

Definition at line 60 of file efgcvt.c.

#define FCVT_MAXDIG   (DBL_MAX_10_EXP + MAXDIG)

Definition at line 36 of file efgcvt.c.

#define FLOAT_FMT_FLAG

Definition at line 32 of file efgcvt.c.

#define FLOAT_TYPE   double

Definition at line 30 of file efgcvt.c.

#define FUNC_PREFIX

Definition at line 31 of file efgcvt.c.

#define MAXDIG   (NDIGIT_MAX + 3)

Definition at line 35 of file efgcvt.c.

#define NDIGIT_MAX   (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0)))

Definition at line 47 of file efgcvt.c.


Function Documentation

char* __APPEND ( FUNC_PREFIX  ,
fcvt   
)

Definition at line 69 of file efgcvt.c.

{
  if (FCVT_BUFPTR == NULL)
    {
      if (__APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign,
                                     FCVT_BUFFER, MAXDIG) != -1)
       return FCVT_BUFFER;

      FCVT_BUFPTR = (char *) malloc (FCVT_MAXDIG);
      if (FCVT_BUFPTR == NULL)
       return FCVT_BUFFER;
    }

  (void) __APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign,
                                    FCVT_BUFPTR, FCVT_MAXDIG);

  return FCVT_BUFPTR;
}
char* __APPEND ( FUNC_PREFIX  ,
ecvt   
)

Definition at line 92 of file efgcvt.c.

{
  (void) __APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign,
                                    ECVT_BUFFER, MAXDIG);

  return ECVT_BUFFER;
}
char* __APPEND ( FUNC_PREFIX  ,
gcvt   
)

Definition at line 103 of file efgcvt.c.

{
  sprintf (buf, "%.*" FLOAT_FMT_FLAG "g", MIN (ndigit, NDIGIT_MAX), value);
  return buf;
}
cvt_symbol ( fcvt  )
cvt_symbol ( ecvt  )
cvt_symbol ( gcvt  )
libc_freeres_ptr ( static char *  FCVT_BUFPTR)

Variable Documentation

char ECVT_BUFFER[MAXDIG] [static]

Definition at line 65 of file efgcvt.c.

char FCVT_BUFFER[MAXDIG] [static]

Definition at line 64 of file efgcvt.c.