> input: float 0 to 1 inclusive
It's int(9*$v)
Corrected off by one
Corrected correction ;)
The edge case 1=9/9 needs special treatment. Are you sure 8 is the maximum?
If yes max(8,int(9*$v))
max needs to be imported. (POSIX?)
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
In reply to Re: sub as mathematical function
by LanX
in thread sub as mathematical function
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |