if (speed < 0)
comspeed(speed, frequency)	long speed, frequency;{#define	divrnd(n, q)	(((n)*2/(q)+1)/2)	/* divide and round off */	int x, err;#if 0	if (speed == 0)		return 0;#endif	if (speed <= 0)		return -1;	x = divrnd((frequency / 16), speed);	if (x <= 0)		return -1;	err = divrnd((frequency / 16) * 1000, speed * x) - 1000;	if (err < 0)		err = -err;	if (err > COM_TOLERANCE)		return -1;	return x;#undef	divrnd(n, q)}