Important: The information in this document is obsolete and should not be used for new development.
Comparison of SANE and PowerPC Numerics
This section goes chapter by chapter through Part 1 of the Apple Numerics Manual, second edition, and tells where the two environments are alike and where they differ.Floating-Point Data Formats
The single and double data formats supported by PowerPC Numerics are identical to the single and double data formats supported by SANE. PowerPC Numerics adds the double-double format not supported in SANE. PowerPC Numerics does not support the SANE floating-point formats comp (integral value) and 80-bit (and 96-bit) extended.Conversions
PowerPC Numerics converts any floating-point format or integer format to any other floating-point format. SANE supports only conversions to and from the extended data format because it performs all floating-point operations in extended precision.Conversions between binary and decimal in SANE are accurate up to a certain number of decimal digits for each floating-point data format. All conversions in PowerPC Numerics except conversions to or from double-double are correctly rounded.
Expression Evaluation
SANE uses the extended data format as the minimum evaluation format for all floating-point operations. All operations are evaluated with the greatest amount of precision possible, which ensures against midexpression overflow and underflow.PowerPC Numerics does not specify one evaluation method but strongly recommends a single or double minimum evaluation format with widest-need evaluation. This method permits all expressions to be evaluated in as wide a format as is necessary without forcing a wider format on expressions that could be done more quickly and as accurately with a narrower format.
Note that with PowerPC Numerics, you are not ensured against midexpression overflow and underflow as you are with SANE. For example, suppose you have the following expression:
double d1, d2, d3, result; d1 = d2 = d3 = 1.7E308; /* maximum number in double */ result = (d1 + d2) / d3;With PowerPC Numerics, the expression d1 + d2 will overflow the double format, thus producing + . Infinity divided by the variabled3
will still be + , and so the variableresult
will be assigned + . With SANE,d1
,d2
, andd3
are converted to extended format. The expression d1 + d2 will not overflow the extended format, and so the variableresult
will be assigned the value 2.Infinities, NaNs, and Denormalized Numbers
Infinities, NaNs, and denormalized numbers are represented and used identically in SANE and PowerPC Numerics.Arithmetic and Comparison Operations
SANE and PowerPC Numerics support the same seven basic arithmetic operations (add, subtract, multiply, divide, square root, remainder, and round-to-integer). SANE has only one version of the remainder and round-to-integer functions. PowerPC Numerics has two versions of the remainder function and several round-to-integer functions.
Both SANE and PowerPC Numerics support the following comparison operators: <, <=, >=, >, ==, and !=. All other comparison operators shown in Table 6-1 on page 6-4 in this book are not supported by SANE.
- Note
- SANE's square root, remainder, and round-to-integer functions return type
extended
and take typeextended
as input. PowerPC Numerics uses typedouble
instead.Environmental Controls
SANE and PowerPC Numerics support the same rounding direction modes and the same floating-point exception flags.SANE supports dynamic rounding precision modes because it performs all operations in extended and is therefore required by IEEE to support dynamic rounding precision modes. PowerPC Numerics does not support rounding precision modes.
SANE supports halts for each of the five floating-point exceptions. PowerPC Numerics does not currently support halts, although it might in the future.
Transcendental (Elementary) Functions
In SANE, all transcendental functions are in extended format. That is, all of them take typeextended
for floating-point input and all of them return typeextended
. In PowerPC Numerics, all transcendental functions take double for floating-point input and return typedouble
. Some of the functions have a version that performs the same operation in double-double precision.SANE supports a subset of the transcendental functions that PowerPC Numerics supports. The functions not supported by SANE are
erf erfc fdim fmax fmin gamma lgamma nearbyint rinttol round roundtol trunc Of the functions supported by both SANE and PowerPC Numerics, a few are implemented differently in the two environments. See the section "Differences in Transcendental Functions" on page A-5 for details.