⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atof.c

📁 标准c库代码,可以应用于各个系统提供了大量的基本函数
💻 C
字号:
/*FUNCTION   <<atof>>, <<atoff>>---string to double or floatINDEX	atofINDEX	atoffANSI_SYNOPSIS	#include <stdlib.h>        double atof(const char *<[s]>);        float atoff(const char *<[s]>);TRAD_SYNOPSIS	#include <stdlib.h>        double atof(<[s]>)        char *<[s]>;        float atoff(<[s]>)        char *<[s]>;DESCRIPTION<<atof>> converts the initial portion of a string to a <<double>>.<<atoff>> converts the initial portion of a string to a <<float>>.The functions parse the character string <[s]>,locating a substring which can be converted to a floating pointvalue. The substring must match the format:. [+|-]<[digits]>[.][<[digits]>][(e|E)[+|-]<[digits]>]The substring converted is the longest initialfragment of <[s]> that has the expected format, beginning withthe first non-whitespace character.  The substringis empty if <<str>> is empty, consists entirelyof whitespace, or if the first non-whitespace character issomething other than <<+>>, <<->>, <<.>>, or a digit.<<atof(<[s]>)>> is implemented as <<strtod(<[s]>, NULL)>>.<<atoff(<[s]>)>> is implemented as <<strtodf(<[s]>, NULL)>>.RETURNS<<atof>> returns the converted substring value, if any, as a<<double>>; or <<0.0>>,  if no conversion could be performed.If the correct value is out of the range of representable values, plusor minus <<HUGE_VAL>> is returned, and <<ERANGE>> is stored in<<errno>>.If the correct value would cause underflow, <<0.0>> is returnedand <<ERANGE>> is stored in <<errno>>.<<atoff>> obeys the same rules as <<atof>>, except that itreturns a <<float>>.PORTABILITY<<atof>> is ANSI C. <<atof>>, <<atoi>>, and <<atol>> are subsumed by <<strod>>and <<strol>>, but are used extensively in existing code. These functions areless reliable, but may be faster if the argument is verified to be in a validrange.Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,<<lseek>>, <<read>>, <<sbrk>>, <<write>>.*/#include <stdlib.h>#include <_ansi.h>double_DEFUN (atof, (s),	_CONST char *s){  return strtod (s, NULL);}float_DEFUN (atoff, (s),	_CONST char *s){  return strtodf (s, NULL);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -