bug-gnustep
[Top][All Lists]
Advanced

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

Re: use of floorf rather than floor in NSTableView.m


From: Pierre-Yves Rivaille
Subject: Re: use of floorf rather than floor in NSTableView.m
Date: Tue, 6 Nov 2001 00:13:44 +0100 (MET)

Please ignore my previous mail, I was a little bit confused.

> In gui/Source/NSTableView.m there is use of the function
> "floorf". I think it's the only time it's used in gnustep.
> It is not found on Windows 2000 with CygWin/MinGW.
> 
> Is there any reason why it can't just be "floor"?

Here are the different floor functions from the linux manpage
       double floor(double x);
       float floorf(float x);
       long double floorl(long double x);

As the argument we pass to "floor" is a float, it seems logical to use
the "floorf" functions rather than the "floor" function.
But
1. floor is POSIX, floorf & floorl are from C99 (i'm just reading the
    manpage) (I don't really know what we can conclude from this)
2. using "floor" instead of "floorf" does produce the expected result
    (there is maybe a very small performance cost due to the conversion
     from float to double)

> If not, could I please log this as a bug and request the
> change:
> 
> diff -r1.44 NSTableView.m
> 2270c2270
> <                 int remainingInt = floorf(remainingWidth);
> ---
> >                 int remainingInt = floor(remainingWidth);

This would work, but we could maybe do
#ifdef ...
#define floorf floor
#endif

This would be cleaner from a "theoretical" point of view.

*Anyway* I'll just replace "floorf" with "floor" because it feels so much
easier.

bye,
        Pierre-Yves Rivaille





reply via email to

[Prev in Thread] Current Thread [Next in Thread]