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

Clownfish::Integer - Immutable 64-bit signed integer.

SYNOPSIS

    my $integer = Clownfish::Integer->new(7);
    my $value = $integer->get_value;

DESCRIPTION

CONSTRUCTORS

new

    my $integer = Clownfish::Integer->new($value);

Return a new Integer.

  • value - Initial value.

METHODS

get_value

    my $int = $integer->get_value();

Return the value of the Integer.

to_f64

    my $float = $integer->to_f64();

Convert the Integer to floating point.

compare_to

    my $int = $integer->compare_to($other);

Indicate whether one number is less than, equal to, or greater than another. Throws an exception if other is neither an Integer nor a Float.

Returns: 0 if the numbers are equal, a negative number if self is less than other, and a positive number if self is greater than other.

clone

    my $result = $integer->clone();

Return a clone of the object.

INHERITANCE

Clownfish::Integer isa Clownfish::Obj.