The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Clownfish::Float - Immutable double precision floating point number.

SYNOPSIS

    my $float = Clownfish::Float->new(2.5);
    my $value = $float->get_value;

DESCRIPTION

CONSTRUCTORS

new

    my $float = Clownfish::Float->new($value);

Return a new Float.

  • value - Initial value.

METHODS

get_value

    my $result = $float->get_value();

Return the value of the Float.

to_i64

    my $int = $float->to_i64();

Convert the Float to an integer, truncating toward zero. Throw an exception if the value is out of the range of an int64_t.

compare_to

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

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

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 = $float->clone();

Return a clone of the object.

INHERITANCE

Clownfish::Float isa Clownfish::Obj.