Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Mar 2001 21:37:28 -0800
From:      Farooq Mela <fmela0@sm.socccd.cc.ca.us>
To:        Jordan DeLong <fracture@allusion.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Kernel area libmish stuff
Message-ID:  <3AAB0F18.E93A0506@sm.socccd.cc.ca.us>
References:  <20010309175233.A6880@cx420564-b.tucson1.az.home.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Jordan DeLong wrote:
> I was thinking of just getting a sintable array and making a few simple
> functions, so the whole of libm doesn't need to be statically linked into the
> module (from my understanding, once loaded, this module wont ever get paged out,
> and thus it'd be _bad_ for it to be big).

Well, you can't do any FP stuff inside the kernel, as stated by others.
But what you can do is use the fact that:

sin(x) = x - (x^3)/3! + (x^5)/5! - (x^7)/7! ...

and things like sin(-x) = -sin(x), etc, and integer arithmetic. You'd
have to multiply X by a suitably large "base" value so that you dont
have underflow, and compute it that way, and then divide the final
answer by the base. Throughout your program, you'd have to change all
your floating point arithmetic to use this sort of arithmetic - first
multiplying by the base, doing all calculations, and dividing by the
base once you arrive at the _final_ answer. A real pain, at best. The
rest of the transcendental trig's can be built using identities like
cos(x) = sin(x + pi/2), tan(x) = sin(x)/cos(x), etc.

HTH

-- 
farooq <fmela0@sm.socccd.cc.ca.us>
"Life's not fair, but the root password helps." -BOFH

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3AAB0F18.E93A0506>