[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Implementation of log(x) for SPARC32



On Tue, Dec 25, 2001, Shlomi Fish wrote about "Re: Implementation of log(x) for SPARC32":
> I think they do. Congrats for Intel. Even though from what I understood of
> the glibc code the log() is a base 2 logarithm for some reason. (even
> though the tailor series is for log(e)).

It's easier to calculate base 2 logarithms because you can do most of the
work using integer operations (dividing by 2 is *much* easier for the
processor to do than dividing my "e"!). See the URL I quoted in an earlier
message for a discussion about how to calculate base 2 logarithms efficiently.

> > Inventing your own wheels again, are you? :)
> > Your algorithm works, no doubt. So will nearly any other algorithm you'll
> > divise. What I doubt is that you can't do the same thing with half the number
> > of floating-point calculations (divisions, additions, comparisons), so
>...
> Performance is not that critical. The algorithm seems to be very fast,
> even in Perl. One thing I can do is to totally unroll the for($a...) loop,
> but I think I'll skip it because with the loop the code can be modified
> more easily.

If performance is not critical, than just ignore me and use your code.

About optimizations, it's not just loop unrolling - more important
optimizations are replacing many of the floating point calculations by
table lookups and by interpolations. I bet that the Sparc code is obfuscated
for a reason (typically, such codes contain "magical" tables, for example)
not just because the programmer was an idiot. But then again, if he or she
didn't include comments to explain what they were doing, they are idiots...
(I'm just saying this based on your complaints - I admit I didn't look at
the code).

-- 
Nadav Har'El                        |      Tuesday, Dec 25 2001, 10 Tevet 5762
nyh@math.technion.ac.il             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |If the universe is expanding, why can't I
http://nadav.harel.org.il           |find a parking space?

=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il