Mail Archives: cygwin/2005/09/03/12:31:58
Brian Dessent wrote:
> Yes, this does in fact seem to be a bug in lrintf. A reduced testcase
> is:
>
> #include <stdio.h>
> #include <math.h>
>
> int main ()
> {
> float f = -8399916.0;
> printf ("f = %f, k = %ld\n", f, lrintf (f));
> }
>
> The value -8399916.0 in binary is
>
> 1 10010110 00000000010110000101100
>
> The exponent (j0) is 23 (150 - 127 = 23).
>
> In lrintf, the problem is the part of the algorithm that acts on the
> case of 23 <= j0 < 31. In this case, the mantissa is simply extracted
> and shifted left by (j0 - 23). This is handled by line 66 of
> sf_lrint.c:
Err, what??????????????
On Linux, the lrintf() function is an inline function that reduces to
a single asm instruction.
I'm using lrintf() to convert huge arrays of floats to ints. I'd like
that to be reasonably quick :-). Any chance of replacing all that code
you've got with a single inline asm instruction like Linux has?
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo nospam AT mega-nerd DOT com (Yes it's valid)
+-----------------------------------------------------------+
"Who would have believed that reading and writing would pay
off?" -- Homer Simpson
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -