1. A hardware accelerator comprising: a plurality of numeric inputs for receiving numeric values; a primary logic unit configured to output intermediate values and a first result, the first result determined by evaluating a first algebraic expression for the numeric values when a first mode signal is received and by evaluating a second algebraic expression when a second mode signal is received; and a secondary logic unit configured to output a second result determined by evaluating a third algebraic expression for the intermediate values.