home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 2.ddi / MATHSRC.ZIP / ATOF.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.7 KB  |  52 lines

  1. /*------------------------------------------------------------------------
  2.  * filename - atof.c
  3.  *
  4.  * function(s)
  5.  *        atof - converts a string to a floating point number
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #include <stdio.h>
  18. #include <stddef.h>
  19. #include <_math.h>
  20. #include <math.h>
  21. #include <stdlib.h>
  22.  
  23. /*--------------------------------------------------------------------------*
  24.  
  25. Name            atof - converts a string to a floating point number
  26.  
  27. Usage           double atof(const char *strP);
  28.  
  29. Prototype in    stdlib.h & math.h
  30.  
  31. Description     atof converts a string pointed to by strP to a double; this
  32.                 functions recognizes:
  33.                         - an optional string of tabs and spaces
  34.                         - an optional sign
  35.                         - the  a string of  digits and an  optional decimal
  36.                           point
  37.                         - the  an optional e  or E followed  by an optional
  38.                           signed integer
  39.  
  40.                 The first unrecognized character ends the conversion. There
  41.                 are no provisions for overflow.
  42.  
  43. Return value    atof returns  the converted value  of the input  string. If
  44.                 the  string cannot  be converted  to a  number of  the type
  45.                 double, the return value is 0.
  46.  
  47. *---------------------------------------------------------------------------*/
  48. double atof(const char *strP)
  49. {
  50.     return strtod(strP, NULL);
  51. }
  52.