Name

SPVM::Comparator::Double - Interface Type for double Comparation Callback

Usage

use Comparator::Double;

my $comparator = (Comparator::Double)method : int ($a : double, $b : double); {
  return $a <=> $b;
};

my $result = $comparator->(3, 5);

Description

Comparator::Double is the interface type for the double comparation callback.

Interface Methods

required method : int ($a : double, $b : double);

This method must receive two values that types are double and return the following value.

If the first argument is greater than the second argument, returns 1. If the first argument is lower than the second argument, returns -1. If the first argument is equal to the second argument, returns 0.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License