Re: How to use floating point in a module?

From: ndiamond
Date: Wed Jun 02 2004 - 01:07:42 EST


H. Peter Anvin replied to me:

>> (The CPU is an i686. I'll have to look up its opcodes and see if its
>> hardware will come close enough for everything the driver needs. If it
>> doesn't, I'll buy one of the books that some others kindly recommended
>> and do polynomial approximations.)
>
> On x86 (more specifically, on x87) if you can do it at all then you
> can do them all.

I'm not quite sure what that means. It was pretty easy to code a log2()
function using the built-in opcode, but it took me nearly a day to code
an exp2() function. The built-in f2xm1 opcode helps a lot but there's
no help for the other half exp2()'s lot.

I'm sure you and other x86 assembly experts can improve on this if
you ever have any need for it. The only consolation I get is that
for some reason gcc does library calls for log10 and pow. It would be
really trivial to inline log10, though maybe pow is too big to benefit
from inlining.
-
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/