Website hosting service by Active-Venture.com
  

 Back to Index

Numeric functions

grok_bin

converts a string representing a binary number to numeric form.

On entry start and *len give the string to scan, *flags gives conversion flags, and result should be NULL or a pointer to an NV. The scan stops at the end of the string, or the first invalid character. On return *len is set to the length scanned string, and *flags gives output flags.

If the value is <= UV_MAX it is returned as a UV, the output flags are clear, and nothing is written to *result. If the value is > UV_MAX grok_bin returns UV_MAX, sets PERL_SCAN_GREATER_THAN_UV_MAX in the output flags, and writes the value to *result (or the value is discarded if result is NULL).

The hex number may optionally be prefixed with "0b" or "b" unless PERL_SCAN_DISALLOW_PREFIX is set in *flags on entry. If PERL_SCAN_ALLOW_UNDERSCORES is set in *flags then the binary number may use '_' characters to separate digits.

 
	UV	grok_bin(char* start, STRLEN* len, I32* flags, NV *result)  

grok_hex

converts a string representing a hex number to numeric form.

On entry start and *len give the string to scan, *flags gives conversion flags, and result should be NULL or a pointer to an NV. The scan stops at the end of the string, or the first non-hex-digit character. On return *len is set to the length scanned string, and *flags gives output flags.

If the value is <= UV_MAX it is returned as a UV, the output flags are clear, and nothing is written to *result. If the value is > UV_MAX grok_hex returns UV_MAX, sets PERL_SCAN_GREATER_THAN_UV_MAX in the output flags, and writes the value to *result (or the value is discarded if result is NULL).

The hex number may optionally be prefixed with "0x" or "x" unless PERL_SCAN_DISALLOW_PREFIX is set in *flags on entry. If PERL_SCAN_ALLOW_UNDERSCORES is set in *flags then the hex number may use '_' characters to separate digits.

 
	UV	grok_hex(char* start, STRLEN* len, I32* flags, NV *result)  

grok_number

Recognise (or not) a number. The type of the number is returned (0 if unrecognised), otherwise it is a bit-ORed combination of IS_NUMBER_IN_UV, IS_NUMBER_GREATER_THAN_UV_MAX, IS_NUMBER_NOT_INT, IS_NUMBER_NEG, IS_NUMBER_INFINITY, IS_NUMBER_NAN (defined in perl.h).

If the value of the number can fit an in UV, it is returned in the *valuep IS_NUMBER_IN_UV will be set to indicate that *valuep is valid, IS_NUMBER_IN_UV will never be set unless *valuep is valid, but *valuep may have been assigned to during processing even though IS_NUMBER_IN_UV is not set on return. If valuep is NULL, IS_NUMBER_IN_UV will be set for the same cases as when valuep is non-NULL, but no actual assignment (or SEGV) will occur.

IS_NUMBER_NOT_INT will be set with IS_NUMBER_IN_UV if trailing decimals were seen (in which case *valuep gives the true value truncated to an integer), and IS_NUMBER_NEG if the number is negative (in which case *valuep holds the absolute value). IS_NUMBER_IN_UV is not set if e notation was used or the number is larger than a UV.

 
	int	grok_number(const char *pv, STRLEN len, UV *valuep)  

grok_numeric_radix

Scan and skip for a numeric decimal separator (radix).

 
	bool	grok_numeric_radix(const char **sp, const char *send)  

grok_oct

 
	UV	grok_oct(char* start, STRLEN* len, I32* flags, NV *result)  

scan_bin

For backwards compatibility. Use grok_bin instead.

 
	NV	scan_bin(char* start, STRLEN len, STRLEN* retlen)  

scan_hex

For backwards compatibility. Use grok_hex instead.

 
	NV	scan_hex(char* start, STRLEN len, STRLEN* retlen)  

scan_oct

For backwards compatibility. Use grok_oct instead.

 
	NV	scan_oct(char* start, STRLEN len, STRLEN* retlen)  

 

  

 

Domain name registration - 
Register cheap domain name from $7.95 and enjoy free domain services 
 

Cheap domain name search service -
Domain name services at just
$8.95/year only
 

Register domain name -
Buy domain name registration and cheap domain transfer at low, affordable price.

© 2002-2004 Active-Venture.com Web Site Hosting Service

 

[ How the mind works is still a mystery. We understand the hardware, but we don't have a clue about the operating system.   ]

 

 
 
 

Disclaimer: This documentation is provided only for the benefits of our web hosting customers.
For authoritative source of the documentation, please refer to http://www.perldoc.com