Apple 1.1.2 manual NaNs, Zeroes

Page 45

Technical Considerations

NaNs

When a numeric operation cannot produce a meaningful result, the operation delivers a special bit pattern called a NaN (Not-a- Number). For example, zero divided by zero, +° added to -°, and Ã-1 yield NaNs. A NaN can occur in any of the numeric data formats (single, double, and double-double), but generally, system-specific integer types (non-numeric types exclusively for integer values) have no representation for NaNs.

A NaN may have an associated code that indicates its origin.

NaN Meaning

1 Invalid square root, such as Ã-1

2Invalid addition, such as (+°) + (-°)

4 Invalid division, such as 0Ö0

8 Invalid multiplication, such as 0x°

9 Invalid remainder or modulo, such as x rem 0 17 Attempt to convert invalid ASCII string

21 Attempt to create a NaN with a zero code

33 Invalid argument to trigonometric function (such as cos, sin, tan)

34 Invalid argument to inverse trigonometric function (such as acos, asin, atan)

36 Invalid argument to logarithmic function (such as log,

log10)

37Invalid argument to exponential function (such as exp, expm1)

38Invalid argument to financial function (compound or annuity)

40Invalid argument to inverse hyperbolic function (such as acosh, asinh)

42 Invalid argument to gamma function (gamma or lgamma)

Zeroes

Each floating-point format has two representations for zero: +0 and -0. Although the two zeros compare as equal (+0)=(-0), their behaviours in IEEE arithmetic are slightly different.

Ordinarily, the sign of zero does not matter except (possibly) for a function discontinuous at zero. Though the two forms are numerically equal, a program can distinguish +0 from -0 by operations such as division by zero or by performing the numeric copysign function.

The sign of zero obeys the usual sign laws for multiplication and division. For example, (+0)x(-1) = -0 and 1/(-0)= -°. Because

Technical Considerations

39

iMalc Manual

Image 45
Contents Calculate Different Eyecatcher IMalc System requirements ConventionsAssumptions Contents List of illustrations Introduction Introduction Calculator operation Quick StartDisplay Hidden functionsUsing the keyboard Error codesChanging the appearance Preferences file Icons InterfaceWindows Interface Interface Interface Interface Interface Interface Menus Interface Interface Calculator Operation Calculator OperationCalculator Operation Keys Operation Log natural ln becomes e Display Using the keyboard Preferences File Flavours Bondi iMalc Strawberry iMalc G3Calc Blueberry iBookCalc How computers handle maths Technical ConsiderationsTechnical Considerations Careful Rounding =x2, x=Ãy y=375x, x=yÖ375About the Fpce Technical Report Exception HandlingAbout Floating-Point Data Formats PowerPC Numerics Versus SaneInterpreting Floating-Point Values Normalized Numbers Infinities Denormalized NumbersZeroes NaNsRanges Range of numbersRanges of functions Technical Considerations Trigonometry units Error codesThird release, 12th October Version HistoryProposed future enhancements Where to get the latest versionShareware RegistrationPricing Registering Registering OnlineRegistering by email, fax or post Payment Instructions Using Register iMalcRegistration Payment by cash or US$ check/money order Payment by credit card or First VirtualAfter you have registered USASupport@kagi.com Technical SupportContacting Eyecatcher About EyecatcherLegal Information CopyrightTrademarks Software License Legal Information Legal Information Bibliography Other InformationCredits Eyecatcher@kagi.com Useful contactsHttp//hyperarchive.lcs.mit.edu/HyperArchive.html Ansi IndexIndex Sign change key Index