in reply to Coping with decimals

Given that you're dealing with phases, presumably with period 1, if your calculation can produce negative numbers, then I would recommend:

$x - POSIX::floor( $x );
instead of
$x - int( $x );
or
( POSIX::modf( $x ) )[ 0 ];

the lowliest monk