Assuming $v is in [0..1)
sub quant { my $v = shift; return int($v*9); } [download]
In reply to Re: sub as mathematical function by ikegami in thread sub as mathematical function by Anonymous Monk