UCS::Expression::Func - Utility functions for UCS expressions


  use UCS::Expression::Func;

  $min_x = min($x1, $x2, ...);     # minimum of two or more values
  $max_y = max(@y);                # maximum of two or more values

  $log_prob = -log10($prob);       # base 10 logarithm

  $log_prob = inf()                # replace log(Infinity) = -log(0)
    if $prob == 0;                 #   by a very large value 


This module provides a collection of simple but useful functions, which are automatically imported into the UCS::Expression namespace so that they can be used in UCS expressions without full qualification.


$min_x = min($x1, $x2, ...);

Minimum of two or more numbers. The argument could also be an array @x.

$max_x = max($x1, $x2, ...);

Maximum of two or more numbers. The argument could also be an array @x.

$log_prob = -log10($prob);

Base 10 logarithm, which is used for all logarithmic scales in UCS (especially logarithmic p-values). Returns -inf() if $prob is zero or negative.

$log_infinity = inf();

The inf function returns a large positive floating-point value that represents the logarithm of Infinity in UCS/Perl. Note that the logarithm of 0 should consequently be represented by -inf(), as does the log10 function. In order to find out the exact value on your system, you can use the command line

  ucs-config -e 'print inf(),"\n"'


Copyright 2004 Stefan Evert.

This software is provided AS IS and the author makes no warranty as to its use and performance. You may use the software, redistribute and modify it under the same terms as Perl itself.