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

NAME

SPVM::Comparator::Double - a callback type for double comparation

SYNOPSYS

  use SPVM::Comparator::Double;
  
  my $comparator : SPVM::Comparator::Double = sub : int ($self : self, $a : double, $b : double); {
    return $a <=> $b;
  };
  
  my $result = $comparator->(3, 5);

DESCRIPTION

SPVM::Comparator is a callback type to compare two numbers.

CALLBACK METHOD

  sub : int ($self : self, $a : double, $b : double);

This method should receive two numbers and return 1 if $a is more than $b, -1 if $x is lass than $b, 0 if $a equals $b in the implementation.