📄 atopkge.par.lib
字号:
ATOPKGE - convert ascii to arithmetic and with error checking eatoh ascii to shorteatou ascii to unsigned shorteatoi ascii to inteatop ascii to unsignedeatol ascii to longeatov ascii to unsigned longeatof ascii to floateatod ascii to doubleFunction Prototypes:short eatoh(char *s);unsigned short eatou(char *s);int eatoi(char *s);unsigned int eatop(char *s);long eatol(char *s);unsigned long eatov(char *s);float eatof(char *s);double eatod(char *s);Input:s string Returned: type indicated Notes:Each of these routines acts like atoi, but has error checking:This is a major revision of the tedious code required beforevendors implemented the ANSI C strtol, strtoul and strtod.In addition to the size checks for each integer type, aspecific test on errno is required. For example, INT_MAXmay (and probably does) equal LONG_MAX. In this case,if fed a number exceeding INT_MAX (and LONG_MAX), strtolwill make a quiet return with the wrong answer and it is upto the user to check if errno == ERANGE.Size limits are machine dependent and are read from theANSI C include files limits.h and float.h.Bug Report: With NeXT c and Gnucc, when x > DBL_MAX (x <-DBL_MAX),the return value from strtod was +Infinity (-Infinity), not HUGE_VALand more important, errno was not set to ERANGE. To cope with this,I put explicit size checks in eatod (which would not be needed iferrno were set as it should be in ANSI C. jkc 01/29/94On IBM RS6000, the return value from strtod was +-Inf onoverflow, but errno was set correctly.References:For old code:Plum: Reliable Data Structures in C, p. 2-17.Kernighan and Ritchie: The C Programming Language, p. 58.CWP: Jack K. Cohen, Brian Sumner For new code:ANSI C routines with a little help from JackAuthor: Jack Cohen, Center for Wave Phenomena, 1994.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -