sin()/cos()/tan() for kernel code? '_ 'a

Alexander Leidinger Alexander at
Mon Feb 12 09:39:33 UTC 2007

Quoting Stephen Montgomery-Smith <stephen at> (from  
Sun, 11 Feb 2007 12:00:12 -0600 (CST)):

> On Sun, 11 Feb 2007, Stephen Montgomery-Smith wrote:
>> On Sun, 11 Feb 2007, Daniel Eischen wrote:

>>> Can't you do this in userland?  Teach moused?
>> Since you will only need sin and cos evaluated to the nearest   
>> degree, if that, I suggest a simple look up table.  There is also   
>> something called the CORDIC method, I think, but I suspect that the  
>>  look up table will be so much easier to program, and negligable   
>> extra space overhead.
>> Stephen
> And if you do need more accuracy than the nearest degree, the formulae
> sin(x+h) = sin(x) + h cos(x);
> cos(x+h) = cos(x) - h sin(x)
> for small h (say |h| less than half a degree) should provide way more
> accuracy than you should need.

There's work underway which moves the hard work of the mouse drivers  
from the kernel to moused. The kernel just has a simple hardware  
interface there, and the real interpretion of all the stuff from the  
mouse happens in the userland.

See for more.

So maybe it would be better to implement this in moused right from the  


Love is never asking why?    Alexander @ PGP ID = B0063FE7       netchild @  : PGP ID = 72077137

More information about the freebsd-hackers mailing list