add a few integer math ops (sqrt, atan) to kernel headers?

From: Rick Niles
Date: Fri Apr 28 2006 - 12:35:55 EST


Forgive me if it's already in the kernel somewhere, but I need some basic (large) integer based math functions for a GPS device driver I maintain (OSGPS on sourceforge)and I've got to wonder if other drivers might be able use them. Right now we have: sqrt(x), atan2(y, x), and rss(x,y) [root-sum-squared]. The functions just deal with large integers to compute anything reasonable. Of course they're approximations since the output has to be an integer. The atan2() function returns an angle such that 1 radian == 16384. It seems like these should go in some integer math kernel header file for everyone to use.

I know what some of you are thinking right now. That sort of math belongs in userspace, but to close a correlator tracking loop in real-time you need it in the device driver. Either than or require your userland program be a real-time program, which I'd rather not do.

They're all less than 30 lines long. If people think this is a good idea, then I can submit a patch. Suggestions about what to call this header file or where to put it are appreciated. Also, if anyone wants to add more functions or improve the algorithm we use that would also be nice.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/