Retired Document
Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Mathematical and Logical Utilities Reference (Legacy)
| Framework | CoreServices/CoreServices.h |
| Declared in | FixMath.h IOMacOSTypes.h Math64.h ToolUtils.h fenv.h fp.h syslog.h |
Overview
You can use the Mathematical and Logical Utilities to perform mathematical and logical operations in Mac OS X programming. This document describes functions you can use to:
Perform low-level logical manipulation of bits and bytes when using a compiler that does not directly support such manipulations.
Save disk space by using simple compression and decompression routines.
Obtain a pseudorandom number.
Perform mathematical operations with two fixed-point data types supported directly by the Operating System.
Convert numeric variables of different types.
With the exception of the mathematical operations and conversions, these utilities are intended for programmers who occasionally need to access some of these features and do not require that the algorithms used to implement them be sophisticated. For example, if you are developing an advanced mathematical application, the pseudorandom number generator built into Mac OS might be too simplistic to fit your needs. Similarly, if you wish to access individual bits of memory in a time-critical loop, these routines are probably too slow to be practical.
Carbon supports the Mathematical and Logical Utilities, with the exception of those functions that are 68K-specific. However there are several important differences between the implementation of the Mathematical and Logical Utilities in Mac OS 9 and its implementation in Mac OS X.
The implementation in Carbon on Mac OS X of many floating-point functions defined in fp.h is not as accurate as the implementation of those functions in MathLib on Mac OS 8 and 9 (as accessed either directly or through CarbonLib). There are a number of reasons for this difference, including the different expectations of Mac OS 9 and UNIX floating-point clients, compiler limitations, and the need in for an implementation that’s independent of assumptions about the size and layout of floating-point data types.
Functions which take parameters or return values of type long double are not exported by the Core Services framework on Mac OS X. Instead, these functions have been replaced with macros that map to the corresponding double-typed functions. While these functions are exported by CarbonLib, CFM applications calling these functions on Mac OS X should note that the implementations of the long double functions on Mac OS X actually have only double precision, with the following four exceptions: num2decl, dec2numl, x80told, and ldtox80.
Functions by Task
Converting Among 32-Bit Numeric Types
-
Fix2FracDeprecated in OS X v10.8 -
Fix2LongDeprecated in OS X v10.8 -
Frac2FixDeprecated in OS X v10.8 -
Long2FixDeprecated in OS X v10.8
Converting Between Fixed-Point and Floating-Point Values
-
FixedToFloat -
FractToFloat -
FloatToFixed -
FloatToFract -
Fix2XDeprecated in OS X v10.8 -
Frac2XDeprecated in OS X v10.8 -
X2FixDeprecated in OS X v10.8 -
X2FracDeprecated in OS X v10.8
Converting Between Fixed-Point and Integral Values
Getting and Setting Memory Values
Multiplying and Dividing Fixed-Point Numbers
-
FixDivDeprecated in OS X v10.8 -
FixMulDeprecated in OS X v10.8 -
FracDivDeprecated in OS X v10.8 -
FracMulDeprecated in OS X v10.8
Performing Calculations on Fixed-Point Numbers
-
FixATan2Deprecated in OS X v10.8 -
FracCosDeprecated in OS X v10.8 -
FracSinDeprecated in OS X v10.8 -
FracSqrtDeprecated in OS X v10.8
Performing Logical Operations
-
BitAndDeprecated in OS X v10.8 -
BitNotDeprecated in OS X v10.8 -
BitOrDeprecated in OS X v10.8 -
BitShiftDeprecated in OS X v10.8 -
BitXorDeprecated in OS X v10.8
Testing and Setting Bits
Miscellaneous Functions
-
acos -
acosh -
asin -
asinh -
atan -
atan2 -
atanh -
ceil -
copysign -
cos -
cosh -
erf -
erfc -
exp -
exp2 -
expm1 -
fabs -
fdim -
floor -
fmax -
fmin -
fmod -
fpclassify -
frexp -
gamma -
hypot -
isfinite -
isnan -
isnormal -
ldexp -
lgamma -
log -
log10 -
log1p -
log2 -
logb -
modf -
modff -
nan -
nanf -
nearbyint -
nextafterd -
nextafterf -
pi -
pow -
remainder -
remquo -
rint -
rinttol -
round -
roundtol -
S32Set -
S64Absolute -
S64Add -
S64And -
S64BitwiseAnd -
S64BitwiseEor -
S64BitwiseNot -
S64BitwiseOr -
S64Div -
S64Divide -
S64Eor -
S64Max -
S64Min -
S64Multiply -
S64Negate -
S64Not -
S64Or -
S64Set -
S64SetU -
S64ShiftLeft -
S64ShiftRight -
S64Subtract -
scalb -
signbit -
sin -
sinh -
SInt64ToUInt64 -
sqrt -
tan -
tanh -
trunc -
U32SetU -
U64Add -
U64And -
U64BitwiseAnd -
U64BitwiseEor -
U64BitwiseNot -
U64BitwiseOr -
U64Div -
U64Divide -
U64Eor -
U64Max -
U64Multiply -
U64Not -
U64Or -
U64Set -
U64SetU -
U64ShiftLeft -
U64ShiftRight -
U64Subtract -
UInt64ToSInt64 -
annuityDeprecated in OS X v10.8 -
compoundDeprecated in OS X v10.8 -
dec2fDeprecated in OS X v10.8 -
dec2lDeprecated in OS X v10.8 -
dec2numDeprecated in OS X v10.8 -
dec2sDeprecated in OS X v10.8 -
dec2strDeprecated in OS X v10.8 -
dtox80Deprecated in OS X v10.8 -
num2decDeprecated in OS X v10.8 -
randomxDeprecated in OS X v10.8 -
relationDeprecated in OS X v10.8 -
S64CompareDeprecated in OS X v10.8 -
str2decDeprecated in OS X v10.8 -
U64CompareDeprecated in OS X v10.8 -
WideAddDeprecated in OS X v10.8 -
WideBitShiftDeprecated in OS X v10.8 -
WideCompareDeprecated in OS X v10.8 -
WideDivideDeprecated in OS X v10.8 -
WideMultiplyDeprecated in OS X v10.8 -
WideNegateDeprecated in OS X v10.8 -
WideShiftDeprecated in OS X v10.8 -
WideSquareRootDeprecated in OS X v10.8 -
WideSubtractDeprecated in OS X v10.8 -
WideWideDivideDeprecated in OS X v10.8 -
x80todDeprecated in OS X v10.8
Functions
acos
double_t acos ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hacosh
double_t acosh ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hasin
double_t asin ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hasinh
double_t asinh ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hatan
double_t atan ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hatan2
double_t atan2 ( double_t y, double_t x );
Parameters
- y
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hatanh
double_t atanh ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hceil
double_t ceil ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hcopysign
double_t copysign ( double_t x, double_t y );
Parameters
- x
- y
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hcos
double_t cos ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hcosh
double_t cosh ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.herf
double_t erf ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.herfc
double_t erfc ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hexp
double_t exp ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hexp2
double_t exp2 ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hexpm1
double_t expm1 ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hfabs
double_t fabs ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hfdim
double_t fdim ( double_t x, double_t y );
Parameters
- x
- y
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hFixedToFloat
Converts a Fixed number to a float number.
float FixedToFloat ( Fixed x );
Parameters
- x
The
Fixednumber to be converted.
Return Value
The float equivalent of the Fixed number.
Discussion
This function is implemented as an inline macro.
Availability
- Available in Mac OS X version 10.3 and later.
Declared In
FixMath.hFloatToFixed
Converts a float number to a Fixed number.
Fixed FloatToFixed ( float x );
Parameters
- x
The
floatnumber to be converted.
Return Value
The Fixed equivalent of the float number.
Discussion
This function is implemented as an inline macro.
Availability
- Available in Mac OS X version 10.3 and later.
Declared In
FixMath.hFloatToFract
Converts a float number to a Fract number.
Fract FloatToFract ( float x );
Parameters
- x
The
floatnumber to be converted.
Return Value
The Fract equivalent of the float number.
Discussion
This function is implemented as an inline macro.
Availability
- Available in Mac OS X version 10.3 and later.
Declared In
FixMath.hfloor
double_t floor ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hfmax
double_t fmax ( double_t x, double_t y );
Parameters
- x
- y
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hfmin
double_t fmin ( double_t x, double_t y );
Parameters
- x
- y
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hfmod
double_t fmod ( double_t x, double_t y );
Parameters
- x
- y
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hfpclassify
long fpclassify ( float x );
Parameters
- x
A value of type
floatordouble.
Return Value
Returns one of the FP_ values. See FP_SNAN.
Discussion
This function is implemented as an inline macro.
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hFractToFloat
Converts a Fract number to a float number.
float FixedToFract ( Fract x );
Parameters
- x
The
Fractnumber to be converted.
Return Value
The float equivalent of the Fract number.
Discussion
This function is implemented as an inline macro.
Availability
- Available in Mac OS X version 10.3 and later.
Declared In
FixMath.hfrexp
double_t frexp ( double_t x, int *exponent );
Parameters
- x
- exponent
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hgamma
double_t gamma ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hHiWord
Obtains the high-order word of a long word.
SInt16 HiWord ( SInt32 x );
Parameters
- x
The long word whose high word is to be returned.
Return Value
The high-order word of the long word specified by the x parameter.
Discussion
One use of this function is to obtain the integral part of a fixed-point number.
To copy a range of bytes from one memory location to another, you should ordinarily use the Memory Manager function, BlockMove.
Availability
Declared In
ToolUtils.hhypot
double_t hypot ( double_t x, double_t y );
Parameters
- x
- y
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hisfinite
long isfinite ( float x );
Parameters
- x
A value of type
floatordouble.
Return Value
Returns a non-zero value only if the argument is finite.
Discussion
This function is implemented as an inline macro.
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hisnan
long isnan ( float x );
Parameters
- x
A value of type
floatordouble.
Return Value
Returns a non-zero value only if the argument is not a number (NaN).
Discussion
This function is implemented as an inline macro.
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hisnormal
long isnormal ( float x );
Parameters
- x
A value of type
floatordouble.
Return Value
Returns a non-zero value only if the argument is normalized.
Discussion
This function is implemented as an inline macro.
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hldexp
double_t ldexp ( double_t x, int n );
Parameters
- x
- n
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hlgamma
double_t lgamma ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hlog
double_t log ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
syslog.hlog10
double_t log10 ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hlog1p
double_t log1p ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hlog2
double_t log2 ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hlogb
double_t logb ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hLoWord
Obtains the low-order word of a long word.
SInt16 LoWord ( SInt32 x );
Parameters
- x
The long word whose low word is to be returned.
Return Value
The low-order word of the long word specified by the x parameter.
Discussion
One use of this function is to obtain the fractional part of a fixed-point number.
To copy a range of bytes from one memory location to another, you should ordinarily use the Memory Manager function, BlockMove.
Availability
Declared In
ToolUtils.hmodf
double_t modf ( double_t x, double_t *iptr );
Parameters
- x
- iptr
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hmodff
float modff ( float x, float *iptrf );
Parameters
- x
- iptrf
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hnan
double nan ( const char *tagp );
Parameters
- tagp
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hnanf
float nanf ( const char *tagp );
Parameters
- tagp
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hnearbyint
double_t nearbyint ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hnextafterd
double nextafterd ( double x, double y );
Parameters
- x
- y
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hnextafterf
float nextafterf ( float x, float y );
Parameters
- x
- y
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hpi
pi ();
Parameters
Return Value
Availability
Declared In
fp.hpow
double_t pow ( double_t x, double_t y );
Parameters
- x
- y
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hremainder
double_t remainder ( double_t x, double_t y );
Parameters
- x
- y
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hremquo
double_t remquo ( double_t x, double_t y, int *quo );
Parameters
- x
- y
- quo
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hrint
double_t rint ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hrinttol
long rinttol ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hround
double_t round ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hroundtol
long roundtol ( double_t round );
Parameters
- round
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hS32Set
SInt32 S32Set ( SInt64 value );
Parameters
- value
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64Absolute
SInt64 S64Absolute ( SInt64 value );
Parameters
- value
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64Add
SInt64 S64Add ( SInt64 left, SInt64 right );
Parameters
- x
- y
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64And
Boolean S64And ( SInt64 left, SInt64 right );
Parameters
- left
- right
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64BitwiseAnd
SInt64 S64BitwiseAnd ( SInt64 left, SInt64 right );
Parameters
- left
- right
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64BitwiseEor
SInt64 S64BitwiseEor ( SInt64 left, SInt64 right );
Parameters
- left
- right
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64BitwiseNot
SInt64 S64BitwiseNot ( SInt64 value );
Parameters
- value
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64BitwiseOr
SInt64 S64BitwiseOr ( SInt64 left, SInt64 right );
Parameters
- left
- right
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64Div
SInt64 S64Div ( SInt64 dividend, SInt64 divisor );
Parameters
- dividend
- divisor
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64Divide
SInt64 S64Divide ( SInt64 dividend, SInt64 divisor, SInt64 *remainder );
Parameters
- dividend
- divisor
- remainder
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64Eor
Boolean S64Eor ( SInt64 left, SInt64 right );
Parameters
- left
- right
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64Max
SInt64 S64Max ( void );
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64Min
SInt64 S64Min ( void );
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64Multiply
SInt64 S64Multiply ( SInt64 left, SInt64 right );
Parameters
- xparam
- yparam
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64Negate
SInt64 S64Negate ( SInt64 value );
Parameters
- value
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64Not
Boolean S64Not ( SInt64 value );
Parameters
- value
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64Or
Boolean S64Or ( SInt64 left, SInt64 right );
Parameters
- left
- right
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64Set
SInt64 S64Set ( SInt32 value );
Parameters
- value
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64SetU
SInt64 S64SetU ( UInt32 value );
Parameters
- value
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64ShiftLeft
SInt64 S64ShiftLeft ( SInt64 value, UInt32 shift );
Parameters
- value
- shift
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64ShiftRight
SInt64 S64ShiftRight ( SInt64 value, UInt32 shift );
Parameters
- value
- shift
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hS64Subtract
SInt64 S64Subtract ( SInt64 left, SInt64 right );
Parameters
- left
- right
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hscalb
double_t scalb ( double_t x, _scalb_n_type n );
Parameters
- x
- n
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hsignbit
long signbit ( float x );
Parameters
- x
A value of type
floatordouble, NaN, infinity, or zero.
Return Value
Returns a non-zero value only if the sign of the argument is negative.
Discussion
This function is implemented as an inline macro.
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hsin
double_t sin ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hsinh
double_t sinh ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hSInt64ToUInt64
UInt64 SInt64ToUInt64 ( SInt64 value );
Parameters
- value
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hsqrt
double_t sqrt ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.htan
double_t tan ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.htanh
double_t tanh ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.htrunc
_trunc_return_type trunc ( double_t x );
Parameters
- x
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
fp.hU32SetU
UInt32 U32SetU ( UInt64 value );
Parameters
- value
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64Add
UInt64 U64Add ( UInt64 left, UInt64 right );
Parameters
- x
- y
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64And
Boolean U64And ( UInt64 left, UInt64 right );
Parameters
- left
- right
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64BitwiseAnd
UInt64 U64BitwiseAnd ( UInt64 left, UInt64 right );
Parameters
- left
- right
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64BitwiseEor
UInt64 U64BitwiseEor ( UInt64 left, UInt64 right );
Parameters
- left
- right
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64BitwiseNot
UInt64 U64BitwiseNot ( UInt64 value );
Parameters
- value
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64BitwiseOr
UInt64 U64BitwiseOr ( UInt64 left, UInt64 right );
Parameters
- left
- right
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64Div
Under evaluation
UInt64 U64Div ( UInt64 dividend, UInt64 divisor );
Parameters
- dividend
- divisor
Return Value
Availability
Declared In
Math64.hU64Divide
UInt64 U64Divide ( UInt64 dividend, UInt64 divisor, UInt64 *remainder );
Parameters
- dividend
- divisor
- remainder
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64Eor
Boolean U64Eor ( UInt64 left, UInt64 right );
Parameters
- left
- right
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64Max
UInt64 U64Max ( void );
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64Multiply
UInt64 U64Multiply ( UInt64 left, UInt64 right );
Parameters
- xparam
- yparam
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64Not
Boolean U64Not ( UInt64 value );
Parameters
- value
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64Or
Boolean U64Or ( UInt64 left, UInt64 right );
Parameters
- left
- right
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64Set
UInt64 U64Set ( SInt32 value );
Parameters
- value
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64SetU
UInt64 U64SetU ( UInt32 value );
Parameters
- value
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64ShiftLeft
UInt64 U64ShiftLeft ( UInt64 value, UInt32 shift );
Parameters
- value
- shift
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64ShiftRight
UInt64 U64ShiftRight ( UInt64 value, UInt32 shift );
Parameters
- value
- shift
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hU64Subtract
UInt64 U64Subtract ( UInt64 left, UInt64 right );
Parameters
- left
- right
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hUInt64ToSInt64
SInt64 UInt64ToSInt64 ( UInt64 value );
Parameters
- value
Return Value
Availability
- Available in Mac OS X version 10.0 and later.
Declared In
Math64.hData Types
decform
struct decform {
char style;
char unused;
short digits;
};
typedef struct decform decform;
Fields
styleunuseddigits
Availability
- Available in OS X v10.0 and later.
Declared In
fp.hdecimal
struct decimal {
char sgn
char unused
short exp
struct {
unsigned char length;
unsigned char text[36];
unsigned char pad;
} sig;
};
typedef struct decimal decimal;
Fields
sgnunusedexplengthtextpad
Availability
- Available in OS X v10.0 and later.
Declared In
fp.hdouble_t
typedef double double_t;
Availability
- Available in OS X v10.0 through OS X v10.1.
Declared In
fp.hfenv_t
typedef SInt32 fenv_t;
Availability
- Available in OS X v10.0 through OS X v10.1.
Declared In
fenv.hfexcept_t
typedef SInt32 fexcept_t;
Availability
- Available in OS X v10.0 through OS X v10.1.
Declared In
fenv.hFixed
Defines a data type for fixed-point decimal numbers.
typedef SInt32 Fixed;
Discussion
This data type uses a 16-bit signed integer and a 16-bit fraction to represent fixed-point decimal numbers in the interval:

For example, the number 1.5 would be represented as 0x00018000, and the number -1.3 would be represented as 0xFFFEB334. To convert numbers between Fixed and float, you can use the functions FixedToFloat and FloatToFixed.
Availability
- Available in OS X v10.0 and later.
Declared In
IOMacOSTypes.hFract
Defines a high-precision data type for fixed-point decimal numbers.
typedef SInt32 Fract;
Discussion
This data type uses a 2-bit signed integer and a 30-bit fraction to represent fixed-point decimal numbers in the interval

with higher precision than the Fixed data type. For example, the number 1.5 would be represented as 0x60000000, and the number -1.3 would be represented as 0xACCCCCCD. To convert numbers between Fract and float, you can use the functions FractToFloat and FloatToFract.
Availability
- Available in OS X v10.0 and later.
Declared In
IOMacOSTypes.hfloat_t
typedef float float_t;
Availability
- Available in OS X v10.0 through OS X v10.1.
Declared In
fp.hrelop
typedef short relop;
Availability
- Available in OS X v10.0 and later.
Declared In
fp.h_scalb_n_type
typedef int _scalb_n_type;
_trunc_return_type
typedef double_t _trunc_return_type;
Constants
DECSTROUTLEN
enum {
DECSTROUTLEN = 80
};
Constants
DECSTROUTLEN
FE_INEXACT
Definitions of floating-point exception macros.
enum {
FE_INEXACT = 0x02000000,
FE_DIVBYZERO = 0x04000000,
FE_UNDERFLOW = 0x08000000,
FE_OVERFLOW = 0x10000000,
FE_INVALID = 0x20000000,
FE_ALL_EXCEPT = 0x3E000000
};
Constants
FE_INEXACTAvailable in OS X v10.0 through OS X v10.1.
Declared in
fenv.h.FE_DIVBYZEROAvailable in OS X v10.0 through OS X v10.1.
Declared in
fenv.h.FE_UNDERFLOWAvailable in OS X v10.0 through OS X v10.1.
Declared in
fenv.h.FE_OVERFLOWAvailable in OS X v10.0 through OS X v10.1.
Declared in
fenv.h.FE_INVALIDAvailable in OS X v10.0 through OS X v10.1.
Declared in
fenv.h.FE_ALL_EXCEPTAvailable in OS X v10.1 through OS X v10.1.
Declared in
fenv.h.
FE_LDBLPREC
enum {
FE_LDBLPREC = 0,
FE_DBLPREC = 1,
FE_FLTPREC = 2
};
Constants
FE_LDBLPRECFE_DBLPRECFE_FLTPREC
FE_TONEAREST
Definitions of rounding direction macros.
enum {
FE_TONEAREST = 0x00000000,
FE_TOWARDZERO = 0x00000001,
FE_UPWARD = 0x00000002,
FE_DOWNWARD = 0x00000003
};
Constants
FE_TONEARESTAvailable in OS X v10.0 through OS X v10.1.
Declared in
fenv.h.FE_TOWARDZEROAvailable in OS X v10.0 through OS X v10.1.
Declared in
fenv.h.FE_UPWARDAvailable in OS X v10.0 through OS X v10.1.
Declared in
fenv.h.FE_DOWNWARDAvailable in OS X v10.0 through OS X v10.1.
Declared in
fenv.h.
fixed1
enum {
fixed1 = 0x00010000,
fract1 = 0x40000000,
positiveInfinity = 0x7FFFFFFF,
negativeInfinity = 0x80000000
};
Constants
fixed1fract1positiveInfinitynegativeInfinity
FP_SNAN
enum {
FP_SNAN = 0,
FP_QNAN = 1,
FP_INFINITE = 2,
FP_ZERO = 3,
FP_NORMAL = 4,
FP_SUBNORMAL = 5
};
Constants
FP_SNANAvailable in OS X v10.0 through OS X v10.1.
Declared in
fp.h.FP_QNANAvailable in OS X v10.0 through OS X v10.1.
Declared in
fp.h.FP_INFINITEAvailable in OS X v10.0 through OS X v10.1.
Declared in
fp.h.FP_ZEROAvailable in OS X v10.0 through OS X v10.1.
Declared in
fp.h.FP_NORMALAvailable in OS X v10.0 through OS X v10.1.
Declared in
fp.h.FP_SUBNORMALAvailable in OS X v10.0 through OS X v10.1.
Declared in
fp.h.
Relational Operator
typedef short relop;
enum {
GREATERTHAN = 0,
LESSTHAN = 1,
EQUALTO = 2,
UNORDERED = 3
};
Constants
GREATERTHANAvailable in OS X v10.0 and later.
Declared in
fp.h.LESSTHANAvailable in OS X v10.0 and later.
Declared in
fp.h.EQUALTOAvailable in OS X v10.0 and later.
Declared in
fp.h.UNORDEREDAvailable in OS X v10.0 and later.
Declared in
fp.h.
SIGDIGLEN
enum {
SIGDIGLEN = 36
};
Constants
SIGDIGLEN
Special Values
#define HUGE_VAL #define INFINITY
Constants
HUGE_VALAvailable in OS X v10.0 and later.
Declared in
fp.h.INFINITYAvailable in OS X v10.0 and later.
Declared in
fp.h.
© 2003, 2005 Apple Computer, Inc. All Rights Reserved. (Last updated: 2005-11-09)