You may be right, points and such will be CGFloats ratherc than floats. Some
docs seem to say that it already is:

"The Cocoa frameworks use types consistently, giving higher impedance
matching across their API sets.
For example, the frameworks use float for coordinate values, CGFloat for
both graphical and coordinate values, NSPoint (consisting of two CGFloat
values) for a location in a coordinate system, NSString objects for string
values, NSRange for ranges (start and offset), and NSInteger and NSUInteger
for, respectively, signed and unsigned integral values. When you design your
own APIs, you should strive for similar type consistency."

Indeed, that's consistency! What's the difference between a 'coordinate
value' and a 'location in a coordinate system'? (note: this is *not* from
Leopard docs).

But NSPoint on my system is still defined as struct { float x; float y; }.

So perhaps we should use MIN, MAX, ABS instead, for future compatibility.

The main reason I changed it is that I was using fmin, fmax, fabs a lot,
wrongly thinking that the 'f' stands for float. And that use is clearly
wrong, as the values are floats (or CGFloats).

Christiaan

On 8/28/07, Christiaan Hofman <[EMAIL PROTECTED]> wrote:
>
>
> On 27 Aug 2007, at 11:58 PM, Adam R. Maxwell wrote:
>
> >
> > On Monday, August 27, 2007, at 02:47PM,
> > <[EMAIL PROTECTED]> wrote:
> >> Revision: 11003
> >>          http://bibdesk.svn.sourceforge.net/bibdesk/?
> >> rev=11003&view=rev
> >> Author:   hofman
> >> Date:     2007-08-27 14:47:35 -0700 (Mon, 27 Aug 2007)
> >>
> >> Log Message:
> >> -----------
> >> Use float math functions for float arguments.
> >
> > Okay, so I'm curious: was there any point in this since the MIN
> > macro uses __typeof to handle the types?  It seems to me that one
> > potential advantage of using the NSObjCRuntime.h macros is that
> > they might handle 64-bit types more correctly (google for "typedef
> > CGFloat"), but I haven't looked at it in detail.
> >
> > --
> > adam
>
> Not really. But e.g. minf is defined for double, while it is used on
> floats. So fminf is more correct. And it removes the extra check for
> the __typeof. Note that I only did it for cases where the arguments
> were explicitly floats (either declared as such or for components of
> rects etc which are declared as floats).  As for 64 bits, wouldn't
> that just change sizeof(float) ? And I cannot imagine that sizes and
> points will have an advantage from 64 bits, as float has more than
> enough capacity for its use.
>
> Christiaan
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Bibdesk-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-develop

Reply via email to