NAME

Util::Underscore::Numbers - Functions for dealing with numbers

VERSION

version v1.4.2

FUNCTION REFERENCE

$bool = _::is_numeric $scalar
$bool = _::is_numeric

Check whether Perl considers the $scalar to be numeric in any way.

This includes integers and various floating point formats, but usually also NaN and inf and some other special strings.

wrapper for 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).

$scalar: the scalar to be checked. If omitted, uses $_.

returns: a boolean value indicating whether the $scalar is an unsigned integer.

$int = _::ceil $float
$int = _::ceil

wrapper for 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.

$int = _::floor $float
$int = _::floor

wrapper for POSIX::floor

This is different from the int() builtin in that int() truncates a float towards zero, and that int() actually returns an integer.

$float: any number. If omitted, uses $_.

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.

BUGS

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.

AUTHOR

Lukas Atkinson (cpan: AMON) <amon@cpan.org>

COPYRIGHT AND LICENSE

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.