Util::Underscore::Numbers - Functions for dealing with numbers
version v1.4.2
$bool = _::is_numeric $scalar
$bool = _::is_numeric
Check whether Perl considers the $scalar to be numeric in any way.
$scalar
This includes integers and various floating point formats, but usually also NaN and inf and some other special strings.
NaN
inf
wrapper for Scalar::Util::looks_like_number
Scalar::Util::looks_like_number
$scalar: the scalar to check for numericness. If omitted, uses $_.
$_
returns: a boolean value indicating whether the $scalar can be used as a numeric value.
$bool = _::is_int $scalar
$bool = _::is_int
Checks that the argument is a plain scalar, and its stringification matches a signed integer.
$scalar: the scalar to be checked. If omitted, uses $_.
returns: a boolean value indicating whether the $scalar is an integer.
$bool = _::is_uint $scalar
$bool = _::is_uint
Like _::is_int, but the stringification must match an unsigned integer (i.e. the number is zero or positive).
_::is_int
returns: a boolean value indicating whether the $scalar is an unsigned integer.
$int = _::ceil $float
$int = _::ceil
wrapper for POSIX::ceil
POSIX::ceil
$float: any number. If omitted, uses $_.
returns: a float representing the smallest integral value greater than or equal to the $float. If the $float is not a finite number (i.e. infinite or NaN), then that input is returned.
$float
$int = _::floor $float
$int = _::floor
wrapper for POSIX::floor
POSIX::floor
This is different from the int() builtin in that int() truncates a float towards zero, and that int() actually returns an integer.
int()
returns: a float representing the smallest integral value smaller than or equal to the argument. If the $float is not a finite number (i.e. infinite or NaN), then that input is returned.
Please report any bugs or feature requests on the bugtracker website https://github.com/latk/p5-Util-Underscore/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Lukas Atkinson (cpan: AMON) <amon@cpan.org>
This software is copyright (c) 2017 by Lukas Atkinson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Util::Underscore, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Util::Underscore
CPAN shell
perl -MCPAN -e shell install Util::Underscore
For more information on module installation, please visit the detailed CPAN module installation guide.