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:

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

Converting Between Fixed-Point and Floating-Point Values

Converting Between Fixed-Point and Integral Values

Getting and Setting Memory Values

Multiplying and Dividing Fixed-Point Numbers

Performing Calculations on Fixed-Point Numbers

Performing Logical Operations

Testing and Setting Bits

Miscellaneous Functions

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.h

acosh

double_t acosh (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

asin

double_t asin (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

asinh

double_t asinh (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

atan

double_t atan (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

atan2

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.h

atanh

double_t atanh (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

ceil

double_t ceil (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

copysign

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.h

cos

double_t cos (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

cosh

double_t cosh (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

erf

double_t erf (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

erfc

double_t erfc (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

exp

double_t exp (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

exp2

double_t exp2 (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

expm1

double_t expm1 (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

fabs

double_t fabs (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

fdim

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.h

FixedToFloat

Converts a Fixed number to a float number.

float FixedToFloat (
   Fixed x
);
Parameters
x

The Fixed number to be converted.

Return Value

The float equivalent of the Fixed number.

Discussion

This function is implemented as an inline macro.

Declared In
FixMath.h

FloatToFixed

Converts a float number to a Fixed number.

Fixed FloatToFixed (
   float x
);
Parameters
x

The float number to be converted.

Return Value

The Fixed equivalent of the float number.

Discussion

This function is implemented as an inline macro.

Declared In
FixMath.h

FloatToFract

Converts a float number to a Fract number.

Fract FloatToFract (
   float x
);
Parameters
x

The float number to be converted.

Return Value

The Fract equivalent of the float number.

Discussion

This function is implemented as an inline macro.

Declared In
FixMath.h

floor

double_t floor (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

fmax

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.h

fmin

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.
Related Sample Code
Declared In
fp.h

fmod

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.h

fpclassify

long fpclassify (
   float x
);
Parameters
x

A value of type float or double.

Return Value

Returns one of the FP_ values. See FP_SNAN.

Discussion

This function is implemented as an inline macro.

Declared In
fp.h

FractToFloat

Converts a Fract number to a float number.

float FixedToFract (
   Fract x
);
Parameters
x

The Fract number to be converted.

Return Value

The float equivalent of the Fract number.

Discussion

This function is implemented as an inline macro.

Declared In
FixMath.h

frexp

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.h

gamma

double_t gamma (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

HiWord

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.

Declared In
ToolUtils.h

hypot

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.h

isfinite

long isfinite (
   float x
);
Parameters
x

A value of type float or double.

Return Value

Returns a non-zero value only if the argument is finite.

Discussion

This function is implemented as an inline macro.

Declared In
fp.h

isnan

long isnan (
   float x
);
Parameters
x

A value of type float or double.

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.

Declared In
fp.h

isnormal

long isnormal (
   float x
);
Parameters
x

A value of type float or double.

Return Value

Returns a non-zero value only if the argument is normalized.

Discussion

This function is implemented as an inline macro.

Declared In
fp.h

ldexp

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.h

lgamma

double_t lgamma (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

log

double_t log (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Related Sample Code
Declared In
syslog.h

log10

double_t log10 (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

log1p

double_t log1p (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

log2

double_t log2 (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

logb

double_t logb (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

LoWord

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.

Declared In
ToolUtils.h

modf

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.h

modff

float modff (
   float x,
   float *iptrf
);
Parameters
x
iptrf
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

nan

double nan (
   const char *tagp
);
Parameters
tagp
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

nanf

float nanf (
   const char *tagp
);
Parameters
tagp
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

nearbyint

double_t nearbyint (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

nextafterd

double nextafterd (
   double x,
   double y
);
Parameters
x
y
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

nextafterf

float nextafterf (
   float x,
   float y
);
Parameters
x
y
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

pi

pi ();
Parameters
Return Value
Declared In
fp.h

pow

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.h

remainder

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.
Related Sample Code
Declared In
fp.h

remquo

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.h

rint

double_t rint (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

rinttol

long rinttol (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Related Sample Code
Declared In
fp.h

round

double_t round (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

roundtol

long roundtol (
   double_t round
);
Parameters
round
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Related Sample Code
Declared In
fp.h

S32Set

SInt32 S32Set (
   SInt64 value
);
Parameters
value
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

S64Absolute

SInt64 S64Absolute (
   SInt64 value
);
Parameters
value
Return Value
Declared In
Math64.h

S64Add

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.h

S64And

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.h

S64BitwiseAnd

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.h

S64BitwiseEor

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.h

S64BitwiseNot

SInt64 S64BitwiseNot (
   SInt64 value
);
Parameters
value
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

S64BitwiseOr

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.h

S64Div

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.h

S64Divide

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.h

S64Eor

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.h

S64Max

SInt64 S64Max (
   void
);
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

S64Min

SInt64 S64Min (
   void
);
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

S64Multiply

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.h

S64Negate

SInt64 S64Negate (
   SInt64 value
);
Parameters
value
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

S64Not

Boolean S64Not (
   SInt64 value
);
Parameters
value
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

S64Or

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.h

S64Set

SInt64 S64Set (
   SInt32 value
);
Parameters
value
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

S64SetU

SInt64 S64SetU (
   UInt32 value
);
Parameters
value
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

S64ShiftLeft

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.h

S64ShiftRight

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.h

S64Subtract

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.h

scalb

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.h

signbit

long signbit (
   float x
);
Parameters
x

A value of type float or double, 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.

Declared In
fp.h

sin

double_t sin (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

sinh

double_t sinh (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

SInt64ToUInt64

UInt64 SInt64ToUInt64 (
   SInt64 value
);
Parameters
value
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

sqrt

double_t sqrt (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

tan

double_t tan (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

tanh

double_t tanh (
   double_t x
);
Parameters
x
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
fp.h

trunc

_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.h

U32SetU

UInt32 U32SetU (
   UInt64 value
);
Parameters
value
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

U64Add

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.h

U64And

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.h

U64BitwiseAnd

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.h

U64BitwiseEor

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.h

U64BitwiseNot

UInt64 U64BitwiseNot (
   UInt64 value
);
Parameters
value
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

U64BitwiseOr

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.h

U64Div

Under evaluation

UInt64 U64Div (
   UInt64 dividend,
   UInt64 divisor
);
Parameters
dividend
divisor
Return Value
Availability
Declared In
Math64.h

U64Divide

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.h

U64Eor

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.h

U64Max

UInt64 U64Max (
   void
);
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

U64Multiply

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.h

U64Not

Boolean U64Not (
   UInt64 value
);
Parameters
value
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

U64Or

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.h

U64Set

UInt64 U64Set (
   SInt32 value
);
Parameters
value
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

U64SetU

UInt64 U64SetU (
   UInt32 value
);
Parameters
value
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

U64ShiftLeft

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.h

U64ShiftRight

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.h

U64Subtract

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.h

UInt64ToSInt64

SInt64 UInt64ToSInt64 (
   UInt64 value
);
Parameters
value
Return Value
Availability
  • Available in Mac OS X version 10.0 and later.
Declared In
Math64.h

Data Types

decform

struct decform {
   char style;
   char unused;
   short digits;
};
typedef struct decform decform;
Fields
style
unused
digits
Availability
  • Available in OS X v10.0 and later.
Declared In
fp.h

decimal

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
sgn
unused
exp
length
text
pad
Availability
  • Available in OS X v10.0 and later.
Declared In
fp.h

double_t

typedef double double_t;
Availability
  • Available in OS X v10.0 through OS X v10.1.
Declared In
fp.h

fenv_t

typedef SInt32 fenv_t;
Availability
  • Available in OS X v10.0 through OS X v10.1.
Declared In
fenv.h

fexcept_t

typedef SInt32 fexcept_t;
Availability
  • Available in OS X v10.0 through OS X v10.1.
Declared In
fenv.h

Fixed

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:

../art/fixeddomain.gif

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.h

Fract

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

../art/fractdomain.gif

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.h

float_t

typedef float float_t;
Availability
  • Available in OS X v10.0 through OS X v10.1.
Declared In
fp.h

relop

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_INEXACT

Available in OS X v10.0 through OS X v10.1.

Declared in fenv.h.

FE_DIVBYZERO

Available in OS X v10.0 through OS X v10.1.

Declared in fenv.h.

FE_UNDERFLOW

Available in OS X v10.0 through OS X v10.1.

Declared in fenv.h.

FE_OVERFLOW

Available in OS X v10.0 through OS X v10.1.

Declared in fenv.h.

FE_INVALID

Available in OS X v10.0 through OS X v10.1.

Declared in fenv.h.

FE_ALL_EXCEPT

Available 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_LDBLPREC
FE_DBLPREC
FE_FLTPREC

FE_TONEAREST

Definitions of rounding direction macros.

enum {
   FE_TONEAREST                  = 0x00000000,
   FE_TOWARDZERO                 = 0x00000001,
   FE_UPWARD                     = 0x00000002,
   FE_DOWNWARD                   = 0x00000003
};
Constants
FE_TONEAREST

Available in OS X v10.0 through OS X v10.1.

Declared in fenv.h.

FE_TOWARDZERO

Available in OS X v10.0 through OS X v10.1.

Declared in fenv.h.

FE_UPWARD

Available in OS X v10.0 through OS X v10.1.

Declared in fenv.h.

FE_DOWNWARD

Available 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
fixed1
fract1
positiveInfinity
negativeInfinity

FP_SNAN

enum {
   FP_SNAN = 0,
   FP_QNAN = 1,
   FP_INFINITE = 2,
   FP_ZERO = 3,
   FP_NORMAL = 4,
   FP_SUBNORMAL = 5
};
Constants
FP_SNAN

Available in OS X v10.0 through OS X v10.1.

Declared in fp.h.

FP_QNAN

Available in OS X v10.0 through OS X v10.1.

Declared in fp.h.

FP_INFINITE

Available in OS X v10.0 through OS X v10.1.

Declared in fp.h.

FP_ZERO

Available in OS X v10.0 through OS X v10.1.

Declared in fp.h.

FP_NORMAL

Available in OS X v10.0 through OS X v10.1.

Declared in fp.h.

FP_SUBNORMAL

Available 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
GREATERTHAN

Available in OS X v10.0 and later.

Declared in fp.h.

LESSTHAN

Available in OS X v10.0 and later.

Declared in fp.h.

EQUALTO

Available in OS X v10.0 and later.

Declared in fp.h.

UNORDERED

Available 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_VAL

Available in OS X v10.0 through OS X v10.5.

Declared in fp.h.

INFINITY

Available in OS X v10.0 through OS X v10.5.

Declared in fp.h.