Hyperdual number implementation