1.\" $NetBSD: math.3,v 1.25 2011/09/22 18:14:09 njoly Exp $ 2.\" 3.\" Copyright (c) 1985 Regents of the University of California. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" from: @(#)math.3 6.10 (Berkeley) 5/6/91 31.\" 32.Dd February 23, 2007 33.Dt MATH 3 34.Os 35.ds If Infinity 36.if t .ds If \(if 37.Sh NAME 38.Nm math 39.Nd introduction to mathematical library functions 40.Sh LIBRARY 41.Lb libm 42.Sh SYNOPSIS 43.In math.h 44.Sh DESCRIPTION 45These functions constitute the C 46.Nm libm . 47Declarations for these functions may be obtained from the include file 48.In math.h . 49.\" The Fortran math library is described in ``man 3f intro''. 50.Ss List of Functions 51.Bl -column "copysignX" "gammaX3XX" "inverse trigonometric funcX" 52.It Sy Name Ta Sy Man page Ta Sy Description Ta Sy Error Bound Dv ( ULP Ns No s) 53.It acos Ta Xr acos 3 Ta inverse trigonometric function Ta 3 54.It acosh Ta Xr acosh 3 Ta inverse hyperbolic function Ta 3 55.It asin Ta Xr asin 3 Ta inverse trigonometric function Ta 3 56.It asinh Ta Xr asinh 3 Ta inverse hyperbolic function Ta 3 57.It atan Ta Xr atan 3 Ta inverse trigonometric function Ta 1 58.It atanh Ta Xr atanh 3 Ta inverse hyperbolic function Ta 3 59.It atan2 Ta Xr atan2 3 Ta inverse trigonometric function Ta 2 60.It cbrt Ta Xr sqrt 3 Ta cube root Ta 1 61.It ceil Ta Xr ceil 3 Ta integer no less than Ta 0 62.It copysign Ta Xr copysign 3 Ta copy sign bit Ta 0 63.It cos Ta Xr cos 3 Ta trigonometric function Ta 1 64.It cosh Ta Xr cosh 3 Ta hyperbolic function Ta 3 65.It erf Ta Xr erf 3 Ta error function Ta ??? 66.It erfc Ta Xr erf 3 Ta complementary error function Ta ??? 67.It exp Ta Xr exp 3 Ta exponential Ta 1 68.It expm1 Ta Xr exp 3 Ta exp(x)\-1 Ta 1 69.It fabs Ta Xr fabs 3 Ta absolute value Ta 0 70.It finite Ta Xr finite 3 Ta test for finity Ta 0 71.It floor Ta Xr floor 3 Ta integer no greater than Ta 0 72.It fmod Ta Xr fmod 3 Ta remainder Ta ??? 73.It hypot Ta Xr hypot 3 Ta Euclidean distance Ta 1 74.It ilogb Ta Xr ilogb 3 Ta exponent extraction Ta 0 75.It isinf Ta Xr isinf 3 Ta test for infinity Ta 0 76.It isnan Ta Xr isnan 3 Ta test for not-a-number Ta 0 77.It j0 Ta Xr j0 3 Ta Bessel function Ta ??? 78.It j1 Ta Xr j0 3 Ta Bessel function Ta ??? 79.It jn Ta Xr j0 3 Ta Bessel function Ta ??? 80.It lgamma Ta Xr lgamma 3 Ta log gamma function Ta ??? 81.It log Ta Xr log 3 Ta natural logarithm Ta 1 82.It log10 Ta Xr log 3 Ta logarithm to base 10 Ta 3 83.It log1p Ta Xr log 3 Ta log(1+x) Ta 1 84.It nan Ta Xr nan 3 Ta return quiet \*(Na Ta 0 85.It nextafter Ta Xr nextafter 3 Ta next representable number Ta 0 86.It pow Ta Xr pow 3 Ta exponential x**y Ta 60\-500 87.It remainder Ta Xr remainder 3 Ta remainder Ta 0 88.It rint Ta Xr rint 3 Ta round to nearest integer Ta 0 89.It scalbn Ta Xr scalbn 3 Ta exponent adjustment Ta 0 90.It sin Ta Xr sin 3 Ta trigonometric function Ta 1 91.It sinh Ta Xr sinh 3 Ta hyperbolic function Ta 3 92.It sqrt Ta Xr sqrt 3 Ta square root Ta 1 93.It tan Ta Xr tan 3 Ta trigonometric function Ta 3 94.It tanh Ta Xr tanh 3 Ta hyperbolic function Ta 3 95.It trunc Ta Xr trunc 3 Ta nearest integral value Ta 3 96.It y0 Ta Xr j0 3 Ta Bessel function Ta ??? 97.It y1 Ta Xr j0 3 Ta Bessel function Ta ??? 98.It yn Ta Xr j0 3 Ta Bessel function Ta ??? 99.El 100.Ss List of Defined Values 101.Bl -column "M_2_SQRTPIXX" "1.12837916709551257390XX" "2/sqrt(pi)XXX" 102.It Sy Name Ta Sy Value Ta Sy Description 103.It M_E 2.7182818284590452354 e 104.It M_LOG2E 1.4426950408889634074 log 2e 105.It M_LOG10E 0.43429448190325182765 log 10e 106.It M_LN2 0.69314718055994530942 log e2 107.It M_LN10 2.30258509299404568402 log e10 108.It M_PI 3.14159265358979323846 pi 109.It M_PI_2 1.57079632679489661923 pi/2 110.It M_PI_4 0.78539816339744830962 pi/4 111.It M_1_PI 0.31830988618379067154 1/pi 112.It M_2_PI 0.63661977236758134308 2/pi 113.It M_2_SQRTPI 1.12837916709551257390 2/sqrt(pi) 114.It M_SQRT2 1.41421356237309504880 sqrt(2) 115.It M_SQRT1_2 0.70710678118654752440 1/sqrt(2) 116.El 117.Sh NOTES 118In 4.3 BSD, distributed from the University of California 119in late 1985, most of the foregoing functions come in two 120versions, one for the double\-precision "D" format in the 121DEC VAX\-11 family of computers, another for double\-precision 122arithmetic conforming to the IEEE Standard 754 for Binary 123Floating\-Point Arithmetic. 124The two versions behave very 125similarly, as should be expected from programs more accurate 126and robust than was the norm when UNIX was born. 127For instance, the programs are accurate to within the numbers 128of 129.Dv ULPs 130tabulated above; an 131.Dv ULP 132is one Unit in the Last Place. 133And the programs have been cured of anomalies that 134afflicted the older math library 135in which incidents like 136the following had been reported: 137.Bd -literal -offset indent 138sqrt(\-1.0) = 0.0 and log(\-1.0) = \-1.7e38. 139cos(1.0e\-11) \*(Gt cos(0.0) \*(Gt 1.0. 140pow(x,1.0) \(!= x when x = 2.0, 3.0, 4.0, ..., 9.0. 141pow(\-1.0,1.0e10) trapped on Integer Overflow. 142sqrt(1.0e30) and sqrt(1.0e\-30) were very slow. 143.Ed 144However the two versions do differ in ways that have to be 145explained, to which end the following notes are provided. 146.Ss DEC VAX\-11 D_floating\-point 147This is the format for which the original math library 148was developed, and to which this manual is still principally dedicated. 149It is 150.Em the 151double\-precision format for the PDP\-11 152and the earlier VAX\-11 machines; VAX\-11s after 1983 were 153provided with an optional "G" format closer to the IEEE 154double\-precision format. 155The earlier DEC MicroVAXs have no D format, only G double\-precision. 156(Why? 157Why not?) 158.Pp 159Properties of D_floating\-point: 160.Bl -hang -offset indent 161.It Wordsize : 16264 bits, 8 bytes. 163.It Radix : 164Binary. 165.It Precision : 16656 significant bits, roughly like 17 significant decimals. 167If x and x' are consecutive positive D_floating\-point 168numbers (they differ by 1 169.Dv ULP ) , 170then 171.Dl 1.3e\-17 \*(Lt 0.5**56 \*(Lt (x'\-x)/x \*(Le 0.5**55 \*(Lt 2.8e\-17. 172.It Range : 173.Bl -column "Underflow thresholdX" "2.0**127X" 174.It Overflow threshold = 2.0**127 = 1.7e38. 175.It Underflow threshold = 0.5**128 = 2.9e\-39. 176.El 177.Em NOTE: THIS RANGE IS COMPARATIVELY NARROW. 178.Pp 179Overflow customarily stops computation. 180Underflow is customarily flushed quietly to zero. 181.Em CAUTION : 182It is possible to have x 183\(!= 184y and yet x\-y = 0 because of underflow. 185Similarly x \*(Gt y \*(Gt 0 cannot prevent either x\(**y = 0 186or y/x = 0 from happening without warning. 187.It Zero is represented ambiguously : 188Although 2**55 different representations of zero are accepted by 189the hardware, only the obvious representation is ever produced. 190There is no \-0 on a VAX. 191.It \*(If is not part of the VAX architecture . 192.It Reserved operands : 193of the 2**55 that the hardware 194recognizes, only one of them is ever produced. 195Any floating\-point operation upon a reserved 196operand, even a MOVF or MOVD, customarily stops 197computation, so they are not much used. 198.It Exceptions : 199Divisions by zero and operations that 200overflow are invalid operations that customarily 201stop computation or, in earlier machines, produce 202reserved operands that will stop computation. 203.It Rounding : 204Every rational operation (+, \-, \(**, /) on a 205VAX (but not necessarily on a PDP\-11), if not an 206over/underflow nor division by zero, is rounded to 207within half an 208.Dv ULP , 209and when the rounding error is 210exactly half an 211.Dv ULP 212then rounding is away from 0. 213.El 214.Pp 215Except for its narrow range, D_floating\-point is one of the 216better computer arithmetics designed in the 1960's. 217Its properties are reflected fairly faithfully in the elementary 218functions for a VAX distributed in 4.3 BSD. 219They over/underflow only if their results have to lie out of range 220or very nearly so, and then they behave much as any rational 221arithmetic operation that over/underflowed would behave. 222Similarly, expressions like log(0) and atanh(1) behave 223like 1/0; and sqrt(\-3) and acos(3) behave like 0/0; 224they all produce reserved operands and/or stop computation! 225The situation is described in more detail in manual pages. 226.Pp 227.Em This response seems excessively punitive, so it is destined 228.Em to be replaced at some time in the foreseeable future by a 229.Em more flexible but still uniform scheme being developed to 230.Em handle all floating\-point arithmetic exceptions neatly. 231.Pp 232How do the functions in 4.3 BSD's new math library for UNIX 233compare with their counterparts in DEC's VAX/VMS library? 234Some of the VMS functions are a little faster, some are 235a little more accurate, some are more puritanical about 236exceptions (like pow(0.0,0.0) and atan2(0.0,0.0)), 237and most occupy much more memory than their counterparts in 238libm. 239The VMS codes interpolate in large table to achieve 240speed and accuracy; the libm codes use tricky formulas 241compact enough that all of them may some day fit into a ROM. 242.Pp 243More important, DEC regards the VMS codes as proprietary 244and guards them zealously against unauthorized use. 245But the libm codes in 4.3 BSD are intended for the public domain; 246they may be copied freely provided their provenance is always 247acknowledged, and provided users assist the authors in their 248researches by reporting experience with the codes. 249Therefore no user of UNIX on a machine whose arithmetic resembles 250VAX D_floating\-point need use anything worse than the new libm. 251.Ss IEEE STANDARD 754 Floating\-Point Arithmetic 252This standard is on its way to becoming more widely adopted 253than any other design for computer arithmetic. 254VLSI chips that conform to some version of that standard have been 255produced by a host of manufacturers, among them ... 256.Bl -column "Intel i8070, i80287XX" 257.It Intel i8087, i80287 National Semiconductor 32081 258.It 68881 Weitek WTL-1032, ... , -1165 259.It Zilog Z8070 Western Electric (AT\*(AmT) WE32106. 260.El 261Other implementations range from software, done thoroughly 262in the Apple Macintosh, through VLSI in the Hewlett\-Packard 2639000 series, to the ELXSI 6400 running ECL at 3 Megaflops. 264Several other companies have adopted the formats 265of IEEE 754 without, alas, adhering to the standard's way 266of handling rounding and exceptions like over/underflow. 267The DEC VAX G_floating\-point format is very similar to the IEEE 268754 Double format, so similar that the C programs for the 269IEEE versions of most of the elementary functions listed 270above could easily be converted to run on a MicroVAX, though 271nobody has volunteered to do that yet. 272.Pp 273The codes in 4.3 BSD's libm for machines that conform to 274IEEE 754 are intended primarily for the National Semiconductor 32081 275and WTL 1164/65. 276To use these codes with the Intel or Zilog 277chips, or with the Apple Macintosh or ELXSI 6400, is to 278forego the use of better codes provided (perhaps freely) by 279those companies and designed by some of the authors of the 280codes above. 281Except for 282.Fn atan , 283.Fn cbrt , 284.Fn erf , 285.Fn erfc , 286.Fn hypot , 287.Fn j0-jn , 288.Fn lgamma , 289.Fn pow , 290and 291.Fn y0\-yn , 292the Motorola 68881 has all the functions in libm on chip, 293and faster and more accurate; 294it, Apple, the i8087, Z8070 and WE32106 all use 64 significant bits. 295The main virtue of 4.3 BSD's 296libm codes is that they are intended for the public domain; 297they may be copied freely provided their provenance is always 298acknowledged, and provided users assist the authors in their 299researches by reporting experience with the codes. 300Therefore no user of UNIX on a machine that conforms to 301IEEE 754 need use anything worse than the new libm. 302.Pp 303Properties of IEEE 754 Double\-Precision: 304.Bl -hang -offset indent 305.It Wordsize : 30664 bits, 8 bytes. 307.It Radix : 308Binary. 309.It Precision : 31053 significant bits, roughly like 16 significant decimals. 311If x and x' are consecutive positive Double\-Precision 312numbers (they differ by 1 313.Dv ULP ) , 314then 315.Dl 1.1e\-16 \*(Lt 0.5**53 \*(Lt (x'\-x)/x \*(Le 0.5**52 \*(Lt 2.3e\-16. 316.It Range : 317.Bl -column "Underflow thresholdX" "2.0**1024X" 318.It Overflow threshold = 2.0**1024 = 1.8e308 319.It Underflow threshold = 0.5**1022 = 2.2e\-308 320.El 321Overflow goes by default to a signed \*(If. 322Underflow is 323.Sy Gradual , 324rounding to the nearest 325integer multiple of 0.5**1074 = 4.9e\-324. 326.It Zero is represented ambiguously as +0 or \-0: 327Its sign transforms correctly through multiplication or 328division, and is preserved by addition of zeros 329with like signs; but x\-x yields +0 for every 330finite x. 331The only operations that reveal zero's 332sign are division by zero and copysign(x,\(+-0). 333In particular, comparison (x \*(Gt y, x \*(Ge y, etc.) 334cannot be affected by the sign of zero; but if 335finite x = y then \*(If 336\&= 1/(x\-y) 337\(!= 338\-1/(y\-x) = 339\- \*(If . 340.It \*(If is signed : 341it persists when added to itself 342or to any finite number. 343Its sign transforms 344correctly through multiplication and division, and 345\*(If (finite)/\(+- \0=\0\(+-0 346(nonzero)/0 = 347\(+- \*(If. 348But 349\(if\-\(if, \(if\(**0 and \(if/\(if 350are, like 0/0 and sqrt(\-3), 351invalid operations that produce \*(Na. 352.It Reserved operands : 353there are 2**53\-2 of them, all 354called \*(Na (Not A Number). 355Some, called Signaling \*(Nas, trap any floating\-point operation 356performed upon them; they are used to mark missing 357or uninitialized values, or nonexistent elements of arrays. 358The rest are Quiet \*(Nas; they are 359the default results of Invalid Operations, and 360propagate through subsequent arithmetic operations. 361If x 362\(!= 363x then x is \*(Na; every other predicate 364(x \*(Gt y, x = y, x \*(Lt y, ...) is FALSE if \*(Na is involved. 365.Pp 366.Em NOTE : 367Trichotomy is violated by \*(Na. 368Besides being FALSE, predicates that entail ordered 369comparison, rather than mere (in)equality, 370signal Invalid Operation when \*(Na is involved. 371.It Rounding : 372Every algebraic operation (+, \-, \(**, /, 373\(sr) 374is rounded by default to within half an 375.Dv ULP , 376and when the rounding error is exactly half an 377.Dv ULP 378then the rounded value's least significant bit is zero. 379This kind of rounding is usually the best kind, 380sometimes provably so; for instance, for every 381x = 1.0, 2.0, 3.0, 4.0, ..., 2.0**52, we find 382(x/3.0)\(**3.0 == x and (x/10.0)\(**10.0 == x and ... 383despite that both the quotients and the products 384have been rounded. 385Only rounding like IEEE 754 can do that. 386But no single kind of rounding can be 387proved best for every circumstance, so IEEE 754 388provides rounding towards zero or towards 389+\*(If 390or towards 391\-\*(If 392at the programmer's option. 393And the same kinds of rounding are specified for 394Binary\-Decimal Conversions, at least for magnitudes 395between roughly 1.0e\-10 and 1.0e37. 396.It Exceptions : 397IEEE 754 recognizes five kinds of floating\-point exceptions, 398listed below in declining order of probable importance. 399.Bl -column "Invalid OperationX" "Gradual OverflowX" 400.It Sy Exception Ta Sy Default Result 401.It Invalid Operation \*(Na, or FALSE 402.It Overflow \(+-\(if 403.It Divide by Zero \(+-\(if 404.It Underflow Gradual Underflow 405.It Inexact Rounded value 406.El 407.Pp 408.Em NOTE : 409An Exception is not an Error unless handled badly. 410What makes a class of exceptions exceptional 411is that no single default response can be satisfactory 412in every instance. 413On the other hand, if a default 414response will serve most instances satisfactorily, 415the unsatisfactory instances cannot justify aborting 416computation every time the exception occurs. 417.El 418.Pp 419For each kind of floating\-point exception, IEEE 754 420provides a Flag that is raised each time its exception 421is signaled, and stays raised until the program resets it. 422Programs may also test, save and restore a flag. 423Thus, IEEE 754 provides three ways by which programs 424may cope with exceptions for which the default result 425might be unsatisfactory: 426.Bl -enum 427.It 428Test for a condition that might cause an exception 429later, and branch to avoid the exception. 430.It 431Test a flag to see whether an exception has occurred 432since the program last reset its flag. 433.It 434Test a result to see whether it is a value that only 435an exception could have produced. 436.Em CAUTION : 437The only reliable ways to discover 438whether Underflow has occurred are to test whether 439products or quotients lie closer to zero than the 440underflow threshold, or to test the Underflow flag. 441(Sums and differences cannot underflow in 442IEEE 754; if x 443\(!= 444y then x\-y is correct to 445full precision and certainly nonzero regardless of 446how tiny it may be.) 447Products and quotients that 448underflow gradually can lose accuracy gradually 449without vanishing, so comparing them with zero 450(as one might on a VAX) will not reveal the loss. 451Fortunately, if a gradually underflowed value is 452destined to be added to something bigger than the 453underflow threshold, as is almost always the case, 454digits lost to gradual underflow will not be missed 455because they would have been rounded off anyway. 456So gradual underflows are usually 457.Em provably 458ignorable. 459The same cannot be said of underflows flushed to 0. 460.Pp 461At the option of an implementor conforming to IEEE 754, 462other ways to cope with exceptions may be provided: 463.It 464ABORT. 465This mechanism classifies an exception in 466advance as an incident to be handled by means 467traditionally associated with error\-handling 468statements like "ON ERROR GO TO ...". 469Different languages offer different forms of this statement, 470but most share the following characteristics: 471.Bl -dash 472.It 473No means is provided to substitute a value for 474the offending operation's result and resume 475computation from what may be the middle of an expression. 476An exceptional result is abandoned. 477.It 478In a subprogram that lacks an error\-handling 479statement, an exception causes the subprogram to 480abort within whatever program called it, and so 481on back up the chain of calling subprograms until 482an error\-handling statement is encountered or the 483whole task is aborted and memory is dumped. 484.El 485.It 486STOP. 487This mechanism, requiring an interactive 488debugging environment, is more for the programmer 489than the program. 490It classifies an exception in 491advance as a symptom of a programmer's error; the 492exception suspends execution as near as it can to 493the offending operation so that the programmer can 494look around to see how it happened. 495Quite often 496the first several exceptions turn out to be quite 497unexceptionable, so the programmer ought ideally 498to be able to resume execution after each one as if 499execution had not been stopped. 500.It 501\&... Other ways lie beyond the scope of this document. 502.El 503.Pp 504The crucial problem for exception handling is the problem of 505Scope, and the problem's solution is understood, but not 506enough manpower was available to implement it fully in time 507to be distributed in 4.3 BSD's libm. 508Ideally, each elementary function should act 509as if it were indivisible, or atomic, in the sense that ... 510.Bl -enum 511.It 512No exception should be signaled that is not deserved by 513the data supplied to that function. 514.It 515Any exception signaled should be identified with that 516function rather than with one of its subroutines. 517.It 518The internal behavior of an atomic function should not 519be disrupted when a calling program changes from 520one to another of the five or so ways of handling 521exceptions listed above, although the definition 522of the function may be correlated intentionally 523with exception handling. 524.El 525.Pp 526Ideally, every programmer should be able 527.Em conveniently 528to turn a debugged subprogram into one that appears atomic to 529its users. 530But simulating all three characteristics of an 531atomic function is still a tedious affair, entailing hosts 532of tests and saves\-restores; work is under way to ameliorate 533the inconvenience. 534.Pp 535Meanwhile, the functions in libm are only approximately atomic. 536They signal no inappropriate exception except possibly ... 537.Bl -ohang -offset indent 538.It Over/Underflow 539when a result, if properly computed, might have lain barely within range, and 540.It Inexact in Fn cbrt , Fn hypot , Fn log10 and Fn pow 541when it happens to be exact, thanks to fortuitous cancellation of errors. 542.El 543Otherwise, ... 544.Bl -ohang -offset indent 545.It Invalid Operation is signaled only when 546any result but \*(Na would probably be misleading. 547.It Overflow is signaled only when 548the exact result would be finite but beyond the overflow threshold. 549.It Divide\-by\-Zero is signaled only when 550a function takes exactly infinite values at finite operands. 551.It Underflow is signaled only when 552the exact result would be nonzero but tinier than the underflow threshold. 553.It Inexact is signaled only when 554greater range or precision would be needed to represent the exact result. 555.El 556.\" .Sh FILES 557.\" .Bl -tag -width /usr/lib/libm_p.a -compact 558.\" .It Pa /usr/lib/libm.a 559.\" the static math library 560.\" .It Pa /usr/lib/libm.so 561.\" the dynamic math library 562.\" .It Pa /usr/lib/libm_p.a 563.\" the static math library compiled for profiling 564.\" .El 565.Sh SEE ALSO 566An explanation of IEEE 754 and its proposed extension p854 567was published in the IEEE magazine MICRO in August 1984 under 568the title "A Proposed Radix\- and Word\-length\-independent 569Standard for Floating\-point Arithmetic" by W. J. Cody et al. 570The manuals for Pascal, C and BASIC on the Apple Macintosh 571document the features of IEEE 754 pretty well. 572Articles in the IEEE magazine COMPUTER vol. 14 no. 3 (Mar. 1981), 573and in the ACM SIGNUM Newsletter Special Issue of 574Oct. 1979, may be helpful although they pertain to 575superseded drafts of the standard. 576.Sh BUGS 577When signals are appropriate, they are emitted by certain 578operations within the codes, so a subroutine\-trace may be 579needed to identify the function with its signal in case 580method 5) above is in use. 581And the codes all take the 582IEEE 754 defaults for granted; this means that a decision to 583trap all divisions by zero could disrupt a code that would 584otherwise get correct results despite division by zero. 585