++ed by:
XYF FAYLAND SKOLYCHEV POTATOGIM ILUX
7 non-PAUSE users
Author image Yuki Kimoto

NAME

SPVM::Comparator::Float - Comparator::Float in SPVM | a callback interface for float comparation

SYNOPSYS

  use Comparator::Float;
  
  my $comparator : Comparator::Float = method : int ($a : float, $b : float); {
    return $a <=> $b;
  };
  
  my $result = $comparator->(3, 5);

DESCRIPTION

Comparator::Float is a callback interface to compare two float values.

CALLBACK METHOD INTERFACE

  method : int ($a : float, $b : float);

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

This method is planned to be implemented in other classes.