Cast number of segments to int so that when automatic number of segments is desired, cat's magic formula works even when it doesn't return a whole number