home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / MATH.ZIP / ATOF.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-07  |  1.9 KB  |  54 lines

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