beta redution routines in C