The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Hydrogen::Number - a standard library for numbers

VERSION

This documentation is for Hydrogen::Number 0.013, which is based on Sub::HandlesVia::HandlerLibrary::Number 0.036.

FUNCTIONS

Each function expects a numeric scalar as its first argument.

abs( $number )

Finds the absolute value of the current number, updating the original value.

add( $number, $addend )

Additional arguments: Num.

Adds a number to the existing number, updating the original value.

cmp( $number, $num )

Additional arguments: Num.

Returns $number <=> $num.

div( $number, $divisor )

Additional arguments: Num.

Divides the existing number by a number, updating the original value.

eq( $number, $num )

Additional arguments: Num.

Returns $number == $num.

ge( $number, $num )

Additional arguments: Num.

Returns $number >= $num.

get( $number )

Returns the current value of the number.

gt( $number, $num )

Additional arguments: Num.

Returns $number > $num.

le( $number, $num )

Additional arguments: Num.

Returns $number <= $num.

lt( $number, $num )

Additional arguments: Num.

Returns $number < $num.

mod( $number, $divisor )

Additional arguments: Num.

Finds the current number modulo a divisor, updating the original value.

mul( $number, $factor )

Additional arguments: Num.

Multiplies the existing number by a number, updating the original value.

ne( $number, $num )

Additional arguments: Num.

Returns $number != $num.

set( $number, $value )

Additional arguments: Num.

Sets the number to a new value.

sub( $number, $subtrahend )

Additional arguments: Num.

Subtracts a number from the existing number, updating the original value.

EXPORT

No functions are exported by this module by default. To import them all (this is usually a bad idea), use:

    use Hydrogen::Number -all;

To import a particular function, use:

    use Hydrogen::Number 'cmp';

To rename functions:

    use Hydrogen::Number 'cmp' => { -as => 'myfunc' };

On Perl 5.37.2+, you can import lexically:

    use Hydrogen::Number -lexical, 'cmp';

See Exporter::Tiny::Manual::Importing for more hints on importing.

BUGS

Please report any bugs to http://github.com/tobyink/p5-hydrogen/issues.

SEE ALSO

Hydrogen, Hydrogen::Curry::Number, Hydrogen::Topic::Number, Sub::HandlesVia::HandlerLibrary::Number.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2022 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.