Numbers in Property Lists

You cannot use C numeric data values directly in Core Foundation property lists. A CFNumber object serves simply as a wrapper for C numeric values. Utility Services includes functions to create a CFNumber, obtain its value, and compare two CFNumber objects. Note that CFNumber objects are immutable with respect to value, but type information may not be maintained. You can get information about a CFNumber object's type, but this is the type the CFNumber object used to store your value and may not be the same type as the original C data. The section Using Numbers in Property Lists shows you how to create and work with CFNumber objects.

When comparing CFNumber objects, conversion and comparison follow human expectations and not C promotion and comparison rules. Negative zero compares less than positive zero. Positive infinity compares greater than everything except itself, to which it compares equal. Negative infinity compares less than everything except itself, to which it compares equal. Unlike standard practice, if both numbers are NaNs, then they compare equal; if only one of the numbers is a NaN, then the NaN compares greater than the other number if it is negative, and smaller than the other number if it is positive.


© 2000 Apple Computer, Inc. (Last Updated 04 April 00)