How Java s FloatingPoint Hurts Everyone Everywhere


 Kerrie Cunningham
 2 years ago
 Views:
Transcription
1 How Java s FloatingPoint Hurts Everyone Everywhere by Prof. W. Kahan and Joseph D. Darcy Elect. Eng. & Computer Science Univ. of Berkeley Originally presented 1 March 1998 at the invitation of the ACM 1998 Workshop on Java for High Performance Network Computing held at Stanford University This document: or July 30, :28 pm Work in Progress Subject to Supersession Page 1
2 Pages Topics 3 Abstract 49 Overview: Java has evolved to target markets to which its initial design decisions are illsuited. 10 Pure Java s Two Cruel Delusions, promises Java cannot keep Example: Complex Arithmetic Classes; should misplotted fluid flows be exactly reproducible? 16 Example: Faster Matrix Multiply too valuable to forego for unneeded exact reproducibility SelfDiscipline, Reproducibility, Controllability 19 Java purports to fix what ain t broken in Floatingpoint Exceptions; Algebraical Completion; lack of Flags makes Java s FloatingPoint Dangerous Misconceptions about Floatingpoint Example: Disassociate Catastrophic from Cancellation ; Computation as a Web 31 An old Rule of Thumb is wrong because of misconceptions about Precision and Accuracy Why so many still believe this wrong rule of thumb; another counterexample What s wrong with it (and another counterexample); how it got into so many programming languages What to do instead; Four Rules of Thumb for best use of modern floatingpoint hardware 44 Example: Angle at the eye; old KernighanRitchie C semantics are safer than Java s Three Williams contend for Java s numerics, it should copy old KernighanRitchie C semantics Example: 3dimensional rectilinear geometry; Crossproducts work better as matrix products Overloaded operators; Neat solutions for nearestpoint problems, turned into numerical junk by Java s floatingpoint, work well in KernighanRitchie C Dynamic Directed Rounding Modes; Debugging Numerical Instability Example: Needlelike triangles area and angles IEEE 754 Double Extended reduces the risk of chagrin, conserves monotonicity, but not in Java. Three floatingpoint formats run fast; the widest is valuable for Example: Cantilever calculation; Iterative refinement s accuracy improves spectacularly more than 11 bits The cheaper machines would always get better results but for Java s and Microsoft s intransigence How to support extraprecise arithmetic; anonymous indigenous ; Optimizations by the Compiler 81 Conclusions: Java s floatingpoint hurts Java vs. J++, so repair Java s floatingpoint soon. July 30, :28 pm Work in Progress Subject to Supersession Page 2
3 Abstract: Java s floatingpoint arithmetic is blighted by five gratuitous mistakes: 1. Linguistically legislated exact reproducibility is at best mere wishful thinking. 2. Of two traditional policies for mixed precision evaluation, Java chose the worse. 3. Infinities and NaNs unleashed without the protection of floatingpoint traps and flags mandated by IEEE Standards 754/854 belie Java s claim to robustness. 4. Every programmer s prospects for success are diminished by Java s refusal to grant access to capabilities built into over 95% of today's floatingpoint hardware. 5. Java has rejected even mildly disciplined infix operator overloading, without which extensions to arithmetic with everyday mathematical types like complex numbers, intervals, matrices, geometrical objects and arbitrarily high precision become extremely inconvenient. To leave these mistakes uncorrected would be a tragic sixth mistake The following pages expand upon material presented on Sunday morning 1 March 1998 partly to rebut Dr. James Gosling s keynote address Extensions to Java for Numerical Computation the previous morning (Sat. 28 Feb.); see his For a better idea of what is in store for us in the future unless we can change it, see and July 30, :28 pm Work in Progress Subject to Supersession Page 3
4 We agree with James Gosling about some things like Some kind of infix operator overloading will have to be added to Java. Some kind of Complex class will have to be added to Java. Some changes to the JVM are unavoidable. 95% of the folks out there are completely clueless about floatingpoint. ( J.G., 28 Feb ) ( Maybe more than 95%?) and disagree with him about other things like A proposal to enhance Java s numerics would split the Java community into three parts: 1. Numerical Analysts, who would unanimously be enthusiastically FOR it, 2. Others, who would be vehemently AGAINST it, and 3. Others who wouldn t care. ( J.G., 28 Feb ) Actually, Numerical Analysts would be as confused as everyone else and even more divided. Complex arithmetic like Fortran s? That s not the best way. The C9X proposal is better. Loose Numerics? Sloppy numerics! IEEE 754 DoubleExtended supported properly is better. and many more July 30, :28 pm Work in Progress Subject to Supersession Page 4
5 To cure Java s numerical deficiencies, we too propose to modify it but not the way Gosling would modify it. We call our modified Java language Borneo. Borneo s design was constrained to be Upward Compatible with Java : Compiling Java programs with Borneo semantics should leave integer arithmetic unchanged and should change floatingpoint arithmetic at most very slightly. Any old Java class already compiled to bytecode should be unable to tell whether other bytecode was compiled under Java s semantics or Borneo s. Borneo is designed to require the least possible change to the Java Virtual Machine ( JVM ) that can remedy Java s floatingpoint deficiencies. Borneo adds to Java as little infix operator overloading, exception flag and trap handling, control over rounding directions and choice of precisions as is essential for good floatingpoint programming. If you wish not to know about them, don t mention them in your program. For more information about Borneo : For more information about FloatingPoint : What follows is NOT about Borneo. What follows explains why Java has to be changed. By Sun. Urgently. July 30, :28 pm Work in Progress Subject to Supersession Page 5
6 + + Anne and Pete use the same program. But they do not use the same platform. See Pat. How? How can this be? Pat wrote one program. It can run on all platforms. They have 100% Pure Java. It works with the platforms Pat used 100% Pure Java (TM) they have. to write the program. Anne and Pete are happy. Run program, run! They can work. Work, work, work! mul ti plat form lan guage no non Java (TM) code write once, run a ny where (TM) 100% Pure JAVA Pure and Simple This parody of puffery promoting 100% Pure Java for everyone everywhere filled page C6 in the San Franisco Chronicle Business Section of Tues. May 6, It was paid for and copyrighted by Sun Microsystems. Behind Sun s corporate facade must have twinkled a wicked sense of humor. July 30, :28 pm Work in Progress Subject to Supersession Page 6
7 Whom does Sun expect to use Java? Everybody. Everybody falls into one of two groups: 1. A roundup of the usual suspects These numerical experts, engineers, scientists, statisticians, are used to programming in C, Fortran, Ada, or to using programs written in those languages. Among their programs are many that predate IEEE Standard 754 (1985) for Binary FloatingPoint Arithmetic; these programs, many written to be Portable to the computers of the 1970s, demand no more from floatingpoint than Java provides, so their translation into Java is almost mechanical. 2. Everybody else 95% of the folks out there are completely clueless about floatingpoint. ( J.G., 28 Feb ) Their numerical inexpertise will not deter clever folks from writing Java programs that depend upon floatingpoint arithmetic to perform parts of their computations: Materials lists and blueprints for roofing, carpentry, plumbing, wiring, painting. Numerically controlled machine tools and roboticized manufacturing, farming and recycling. Customizable designs for homebuilt furniture, sailboats, light aircraft, gokarts, irrigation. Navigation for sailboats, light aircraft and spaceships while their pilots doze at the wheel. Economic and financial forecasts, estimated yield on investments, and portfolio management. Predictions of supply and demand, predictive inventory management, justintime delivery. There is no end to this list. July 30, :28 pm Work in Progress Subject to Supersession Page 7
8 Q & A about selling computing to Everyone Everywhere: What would happen to the market for automobiles if transmissions and chokes were not automatic, and if brakes and steering were not not powerassisted? Would all drivers be dextrous and strong, or would there be fewer cars and more chauffeurs as in the good old days? What if standards for vehicular bodystrength, lights, brakes, tires, seatbelts, airbags, safetyglass, were relaxed? Would cheaper cars and trucks compensate us for the cost of caring for more cripples? Are such questions irrelevant to our industry? What will happen to the market for our computer hard and software if we who design them fail to make them as easy to use as we can and also robust in the face of misuse? Misuse is unavoidable. Our industry s vigor depends upon a vast army of programmers to cope with innumerable messy details some of which, like floatingpoint, are also complicated; and In every army large enough, someone fails to get the message, or gets it wrong, or forgets it. Most programmers never take a competent course in Numerical Analysis, or else forget it. Over 95% of the folks out there are completely clueless about floatingpoint. ( J.G., 28 Feb ) Amidst an overabundance of Java Beans and Class Libraries, we programmers usually hasten to do our job without finding the information we need to cope well with floatingpoint s complexities. Like Coleridge s Ancient Mariner afloat in Water, water every where, nor any drop to drink we are awash in (mis and dis)information. To filter what we need from the worldwide web, we must know first that we need the information, then its name. No Open Sesame! reveals what we need to know and no more. We trust some information: Experience tells us how programmers are likely to use floatingpoint. Modern erroranalysis tells us how to enhance our prospects for success. It s more than merely a way for experts to validate ( we hope ) the software we distribute through prestigious numerical libraries like LAPACK and fdlibm. Erroranalysis tells us how to design floatingpoint arithmetic, like IEEE Standard 754, moderately tolerant of wellmeaning ignorance among programmers though not yet among programming language designers and implementors. July 30, :28 pm Work in Progress Subject to Supersession Page 8
9 Java has evolved How Java s FloatingPoint Hurts Everyone Everywhere from a small language targeted towards TVsettop boxes and networked toasterovens to a large language and operating system targeted towards to challenge Microsoft s hegemony. Everybody Everything Everywhere Microsoft is vulnerable because its flaky Windows system is not one system but many. Wouldbe vendors of software for MS Windows have to cope with innumerable versions, a legacy of partially corrected bugs, unresolved incompatibilities,. Software often fails to install or later malfunctions because diversity among Windows systems has become unmanageable by the smaller software developers who cannot afford to pretest their work upon every kind of Windows system. Java s Write Once, Run Anywhere tantalizes software vendors with the prospect of substantially less debugging and testing than they have had to undertake in the past. This prospect has been invoked spuriously to rationalize Java s adherence to bad floatingpoint design decisions that mattered little in Java s initial niche market but now can t be reconciled with Java s expanded scope. Later we shall see why Java s expanded market would be served better by actual conformity to the letter and spirit of IEEE Standard 754 for Binary FloatingPoint Arithmetic. July 30, :28 pm Work in Progress Subject to Supersession Page 9
10 Pure Java s Two Cruel Delusions: Write Once, Run Anywhere and Linguistically Enforced Exact Reproducibility of all FloatingPoint Results These do figure among ideals that should influence our decisions. So does Universal Peace. But some ideals are better approached than reached, and best not approached too directly. ( How do you feel about Universal Death as a direct approach to Universal Peace? ) Pure Java s two cruel delusions are inconsistent with three facts of computing life: RushtoMarket engenders mistakes, bugs, versions, incompatibilities, conflicts, as in Java s oft revised AWT ( Window interface ), disputes between Sun and Microsoft,. Intentionally and unintentionally divergent implementations of the JVM will exist inevitably. Compliance with standards that reinforce commercial disparities can be enforced only by the kind of power to punish heretics for which emperors and popes used to yearn. JavaSoft lacks even the power to prevent heretic versions of Java from becoming preponderant in some markets. A healthy balance between Stability and Progress requires an approach to the Management of Change more thoughtful than can be expected from business entities battling for market share. Perfect uniformity and stability, if taken literally, are promises beyond Java s power to fulfill. Suppose for argument s sake that the two cruel delusions were not delusions. Suppose they became actuality at some moment in time. This situation couldn t last long. To understand why consider Complex Arithmetic Classes. July 30, :28 pm Work in Progress Subject to Supersession Page 10
11 Complex Arithmetic Classes. Why More than One? JavaSoft would promulgate its 100% Pure Java Complex Arithmetic Class Library, and the Free Software Foundation would promulgate another ( you d have to install it yourself ), and the Regents of the University of California would offer Kahan s Complex Arithmetic Class Library. How would Kahan s differ from JavaSoft s? In line with the C9X proposal before ANSI X3J11, he includes an Imaginary Class and allows complex variables to be written as x + ı*y or x + y*ı ( where ı := ( 1) is the declared imaginary unit ) instead of sticking to Fortranlike (x, y) as James Gosling has proposed. Kahan s imaginary class allows real and complex to mix without forcing coercions of real to complex. Thus his classes avoid a little wasteful arithmetic ( with zero imaginary parts ) that compilers can have trouble optimizing away. Other than that, with overloaded infix arithmetic operators, you can t tell the difference between Kahan s syntax and Gosling s. Imagine now that you are developing software intended to work upon your customer s Complex functions, perhaps to compute their contour integrals numerically and to plot them in interesting ways. Can you assume that your market will use only JavaSoft s Complex classes? Why should you have to test your software s compatibility with all the competing Complex classes? Wouldn t you rather write just once, debug just once, and then run anywhere that the official Pure JavaSoft Complex Classes are in use, and ignore potential customers who use those heretic alternatives? But some heresies cannot be ignored. July 30, :28 pm Work in Progress Subject to Supersession Page 11
12 Example: Borda s Mouthpiece, a classical two dimensional fluid flow Define complex analytic functions g( z) = z 2 + z z 2 + 1, and Fz () = 1+ gz () +log ( gz ()). Plot the values taken by F(z) as complex variable z runs along eleven rays z = r i, z = r e 4i π/10, z = r e 3i π/10, z = r e 2i π/10, z = r e i π/10, z = r and their Complex Conjugates, taking positive r from near 0 to near +. These rays are streamlines of an ideal fluid flowing in the right halfplane into a sink at the origin. The left halfplane is filled with air flowing into the sink. The vertical axis is a free boundary; its darker parts are walls inserted into the flow without changing it. The function F(z) maps this flow conformally to a flow with the sink moved to and the walls, pivoting around their innermost ends, turned into the left halfplane but kept straight to form the parallel walls of a long channel. ( Perhaps the Physics is idealized excessively, but that doesn t matter here.) The expected picture, Borda s Mouthpiece, should show eleven streamlines of an ideal fluid flowing into a channel under pressure so high that the fluid s surface tears free from the inside of the channel. July 30, :28 pm Work in Progress Subject to Supersession Page 12
13 Borda s Mouthpiece Correctly plotted Streamlines Streamlines should not cut across each other! 5 5 Y( I, U ) 0 y( I, U ) X( I, U ) x( I, U) Plotted using C9X like Complex and Imaginary Misplotted using Fortran like Complex An Ideal Fluid under high pressure escapes to the left through a channel with straight horizontal sides. Inside the channel, the flow's boundary is free, it does not touch the channel walls. But when 0 is mishandled, as Fortranstyle Complex arithmetic must mishandle it, that streamline of the flow along and underneath the lower channel wall is misplotted across the inner mouth of the channel and, though it does not show above, also as a short segment in the upper wall at its inside end. Both plots come from the same program using different Complex Class libraries, first with and second without an Imaginary Class. July 30, :28 pm Work in Progress Subject to Supersession Page 13
14 Lifting Flow past Joukowski s Aerofoil Correctly Plotted Streamlines Where is this wing s bottom? Plotted using C9X like Complex and Imaginary Misplotted using Fortran like Complex A circulating component, necessary to generate lift, speeds the flow of an idealized fluid above the wing and slows it below. One streamline splits at the wing s leading edge and recombines at the trailing edge. But when 0 is mishandled, as Fortranstyle Complex arithmetic must mishandle it, that streamline goes only over the wing. The computation solves numerically nontrivial transcendental equations involving complex logarithms. Both plots come from the same program using different Complex Class libraries, first with and second without an Imaginary Class. Experienced practitioners programming in Fortran or C++ have learned to replace the split streamline by two streamlines, one above and one below, separated by as few rounding errors as produce a goodlooking plot. July 30, :28 pm Work in Progress Subject to Supersession Page 14
15 Why such plots malfunction, and a very simple way to correct them, were explained long ago in Branch Cuts for Complex Elementary Functions, or Much Ado About Nothing's Sign Bit by W. Kahan, ch. 7 in The State of the Art in Numerical Analysis ( 1987 ) ed. by M. Powell and A. Iserles for Oxford U.P. A streamline goes astray when the complex functions SQRT and LOG are implemented, as is necessary in Fortran and in libraries currently distributed with C/C++ compilers, in a way that disregards the sign of ± 0.0 in IEEE 754 arithmetic and consequently violates identities like SQRT( CONJ( Z ) ) = CONJ( SQRT( Z ) ) and LOG( CONJ( Z ) ) = CONJ( LOG( Z ) ) whenever the COMPLEX variable Z takes negative real values. Such anomalies are unavoidable if Complex Arithmetic operates on pairs (x, y) instead of notional sums x + ı y of real and imaginary variables. The language of pairs is incorrect for Complex Arithmetic; it needs the Imaginary type. A controversial Complex Arithmetic Extension to the programming language C incorporating that correction, among other things, has been put before ANSI X3J11, custodian of the C language standard, as part of the C9X proposal. It is controversial because it purports to help programmers cope with certain physically important discontinuities by suspending thereat ( and nowhere else ) the logical proposition that x == y implies f(x) == f(y). Many a programmer will prefer this anomaly to its alternatives The moral of this story: There will always be good reasons ( and bad ) to call diverse versions of hard and software, including mathematical software, by the same name. Nobody can copyright Complex Class. July 30, :28 pm Work in Progress Subject to Supersession Page 15
16 Besides programs with the same name but designed for slightly different results, there are programs with the same name designed to produce essentially the same results as quickly as possible which must therefore produce slightly different results on different computers. Roundoff causes results to differ slightly not because different computers round arithmetic differently but because they manage memory, caches and register files differently. Example: Matrix multiplication C := A B i.e. c ij := k a ik b kj = a i1 b 1j + a i2 b 2j + a i3 b 3j + To keep pipelines full and avoid unnecessary cache misses, different computer architectures have to perform multiplications a ik b kj and their subsequent additions in different orders. In the absence of roundoff the order would not affect C because addition would be associative. Order affects accuracy only a little in the presence of roundoff because, for all suitable matrix norms, C  A B /( A B ) cannot much exceed the roundoff threshold regardless of order, and this constraint upon C suffices for most applications even if C varies very noticeably from one computer to another. Ordering affects speed a lot. On most processors today, the most obvious matrix multiply program runs at least three times slower than a program with optimal blocking and loopunrolling. Optimization depends delicately upon processor and cache details. For matrices of large dimensions, a code optimized for an UltraSPARC, about three times faster thereon than an unoptimized code, runs on a Pentium Pro ( after recompilation ) slower than a naive code and about six times slower than its optimal code. Speed degradation becomes worse on multiprocessors. Faster matrix multiplication is usually too valuable to forego for unneeded exact reproducibility. Conclusion: Linguistically legislated exact reproducibility is unenforceable. July 30, :28 pm Work in Progress Subject to Supersession Page 16
17 The merely Difficult we do immediately; the Impossible will take slightly longer. Royal Navy maxim adopted during WW II by American Seabees. Everincreasing diversity in hardware and software compounds the difficulty of testing new software intended for the widest possible market. Soon Difficult must become Impossible unless the computing industry collectively and programmers individually share a burden of SelfDiscipline: Modularize designs, so that diversity will add to your testing instead of multiplying it. Know your market, or target only the markets you know; exploit only capabilities you know to be available in all of your targeted markets. Eliminate needless diversity wherever possible, though this is easier said than done; Things should be as simple as possible, but no simpler. Albert Einstein. Java s designers, by pursuing the elimination of diversity beyond the point of oversimplification, have turned a very desirable design goal into an expendable fetish. They have mixed up two ideas: Exact Reproducibility, needed by some floatingpoint programmers sometimes, and Predictability within Controllable Limits, needed by all programmers all the time. By pushing Exact Reproducibility of FloatingPoint to an illogical extreme, the designers ensure it will be disparaged, disregarded and finally jettisoned, perhaps carrying Predictability away too in the course of a Business Decision that could all too easily achieve what the British call Throwing Baby out with the bath water. July 30, :28 pm Work in Progress Subject to Supersession Page 17
18 The essence of programming is Control. Control requires Predictability, which should be Java s forte. Java would impose Exact Reproducibility upon FloatingPoint to make it Predictable. But Exact Reproducibility is JavaSoft s euphemism for Do as Sun s SPARCs do. Thus it denies programmers the choice of better floatingpoint running on most other hardware. Denied better choices, the programmer is not exercising Control but being controlled. Throwing Baby out with the bath water: When Exact Reproducibility of floatingpoint becomes too burdensome to implementors whose first priority is high speed, they will jettison Exact Reproducibility and, for lack of sound guidance, they will most likely abandon Predictability along with it. That s happening now. That s what Gosling s Loose Numerics amounts to; a better name for it is Sloppy Numerics. To achieve FloatingPoint Predictability: Limit programmers choices to what is reasonable and necessary as well as parsimonious, and Limit language implementors choices so as always to honor the programmer s choices. To do so, language designers must understand floatingpoint well enough to validate their determination of what is reasonable and necessary, or else must entrust that determination to someone else with the necessary competency. But Java s designers neglected timely engagement of Sun s inhouse numerical expertise, which would have prevented their floatingpoint blunders. Footnote: Validate a programming language s design? The thought appalls people who think such design is a Black Art. Many people still think FloatingPoint is a Black Art. They are wrong too. July 30, :28 pm Work in Progress Subject to Supersession Page 18
19 Java purports to fix what ain t broken in Floatingpoint. Floatingpoint arithmetic hardware conforming to IEEE Standard 754, as does practically all today s commercially significant hardware on desktops, is already among the least diverse things, hard or software, so ubiquitous in computers. Now Java, mistakenly advertised as conforming to IEEE 754 too, pretends to lessen its diversity by adding another one to the few extant varieties of floatingpoint. How many significantly different floatingpoint hardware architectures matter today? Four : #0: Signal processors that may provide float and/or floatextended but not double. #1: RISCbased computers that provide 4byte float and 8byte double but nothing wider. #2: PowerPC; MIPS R10000; HP 8000 : same as #1 plus fused multiplyadd operation. #3: Intel x86, Pentium; clones by AMD and Cyrix; Intel 80960KB; new Intel/HP IA64; and Motorola 680x0 and : the same as #1 plus a 10+byte long double. Over 95% of the computers on desktops have architecture #3. Most of the rest have #2. Both #3 and #2 can be and are used in restricted ways that match #1 as nearly as matters. All of #1, #2, #3 support Exception Flags and Directed Roundings, capabilities mandated by IEEE Standard 754 but generally omitted from architecture #0 because they have little value in its specialized market. Java would add a fifth floatingpoint architecture #0.5 between #0 and #1. It omits from architecture #1 the Exception Flags and Directed Roundings IEEE 754 requires. July 30, :28 pm Work in Progress Subject to Supersession Page 19
20 Java linguistically confuses the issues about floatingpoint Exceptions: Java, like C++, misuses the word Exception to mean what IEEE 754 calls a Trap. Java has no words for the five floatingpoint Events that IEEE 754 calls Exceptions : Invalid Operation, Overflow, DivisionbyZero, Underflow, Inexact Result These events are not errors unless they are handled badly. They are called Exceptions because to any policy for handling them, imposed in advance upon all programmers by the computer system, some programmers will have good reasons to take exception. IEEE 754 specifies a default policy for each exception, and allows system implementors the option of offering programmers an alternative policy, which is to Trap ( jump ) with specified information about the exception to a programmerselected traphandler. We shall not go into traps here; they would complicate every language issue without adding much more than speed, and little of that, to what flags add to floatingpoint programming. ( Borneo would provide some support for traps.) IEEE 754 specifies five flags, one named for each exception: Invalid Operation, Overflow, DivisionbyZero, Underflow, Inexact Result A flag is a type of global variable raised as a sideeffect of exceptional floatingpoint operations. Also it can be sensed, saved, restored and lowered by a program. When raised it may, in some systems, serve an extralinguistic diagnostic function by pointing to the first or last operation that raised it. Java lacks these flags and cannot conform to IEEE 754 without them. July 30, :28 pm Work in Progress Subject to Supersession Page 20
21 Invalid Operation, Overflow, DivisionbyZero, Underflow, Inexact Result IEEE 754 specifies a default policy for each of these kinds of floatingpoint exception: ı Signal the event by raising an appropriate one of the five flags, if it has not already been raised. ıı (Pre)substitute a default value for what would have been the result of the exceptional operation: Name of Flag and Exception Invalid Operation Overflow DivisionbyZero (Pre)substituted Default Value NotaNumber (NaN), which arithmetic propagates; or a huge integer on overflowed flt.pt. integer conversion ± approximately, depending on Rounding Direction ± Infinity exactly from finite operands. Underflow Inexact Result Gradual Underflow to a Subnormal (very tiny) value Rounded or Over/Underflowed result as usual ııı Resume execution of the program as if nothing exceptional had occurred. With these default values, IEEE 754 s floatingpoint becomes an Algebraically Completed system; this means the computer s every algebraic operation produces a welldefined result for all operands. Why should computer arithmetic be Algebraically Completed? What s wrong with the Defaults specified for these Exceptions by IEEE 754? Why does IEEE 754 specify a flag for each of these kinds of exception? The next three pages answer these three questions and a fourth: What should Java do?. July 30, :28 pm Work in Progress Subject to Supersession Page 21
Numerical Matrix Analysis
Numerical Matrix Analysis Lecture Notes #10 Conditioning and / Peter Blomgren, blomgren.peter@gmail.com Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research
More informationTwoState Options. John Norstad. jnorstad@northwestern.edu http://www.norstad.org. January 12, 1999 Updated: November 3, 2011.
TwoState Options John Norstad jnorstad@northwestern.edu http://www.norstad.org January 12, 1999 Updated: November 3, 2011 Abstract How options are priced when the underlying asset has only two possible
More informationHow to get profitcreating information from your accountant
How to get profitcreating information from your accountant What a tailored accounting service can do for you How could you get much more out of the accounting service you re already paying for? Possibly
More informationIN THE HANDS OF TIME
MATHS BDAY 2006 Friday 24 November IN THE HANDS OF TIME The Maths BDay is sponsored by and Maths Bday 20061 Wiskunde Bdag 2006 0 Introduction The maths Bday assignment this year is totally focused
More informationSolution of Linear Systems
Chapter 3 Solution of Linear Systems In this chapter we study algorithms for possibly the most commonly occurring problem in scientific computing, the solution of linear systems of equations. We start
More informationFloatingPoint Numbers. Floatingpoint number system characterized by four integers: base or radix precision exponent range
FloatingPoint Numbers Floatingpoint number system characterized by four integers: β p [L, U] base or radix precision exponent range Number x represented as where x = ± ( d 0 + d 1 β + d 2 β 2 + + d p
More informationPerformance Basics; Computer Architectures
8 Performance Basics; Computer Architectures 8.1 Speed and limiting factors of computations Basic floatingpoint operations, such as addition and multiplication, are carried out directly on the central
More informationComputer Organization and Architecture
Computer Organization and Architecture Chapter 9 Computer Arithmetic Arithmetic & Logic Unit Performs arithmetic and logic operations on data everything that we think of as computing. Everything else in
More informationSin #1  Not Establishing a Clear and Realistic Goal
A s a B2B lead generation tool, search engine marketing (SEM) is all the rage everyone wants a piece of the pie. Unfortunately, countless companies lose time and money trying to cash in on the alluring
More information[Refer Slide Time: 05:10]
Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture
More informationWhite Paper. Java versus Ruby Frameworks in Practice STATE OF THE ART SOFTWARE DEVELOPMENT 1
White Paper Java versus Ruby Frameworks in Practice STATE OF THE ART SOFTWARE DEVELOPMENT 1 INTRODUCTION...3 FRAMEWORKS AND LANGUAGES...3 SECURITY AND UPGRADES...4 Major Upgrades...4 Minor Upgrades...5
More informationAttention: This material is copyright 19951997 Chris Hecker. All rights reserved.
Attention: This material is copyright 19951997 Chris Hecker. All rights reserved. You have permission to read this article for your own education. You do not have permission to put it on your website
More information#5. Show and the AND function can be constructed from two NAND gates.
Study Questions for Digital Logic, Processors and Caches G22.0201 Fall 2009 ANSWERS Digital Logic Read: Sections 3.1 3.3 in the textbook. Handwritten digital lecture notes on the course web page. Study
More informationTHE WINDOWS AZURE PROGRAMMING MODEL
THE WINDOWS AZURE PROGRAMMING MODEL DAVID CHAPPELL OCTOBER 2010 SPONSORED BY MICROSOFT CORPORATION CONTENTS Why Create a New Programming Model?... 3 The Three Rules of the Windows Azure Programming Model...
More information> 2. Error and Computer Arithmetic
> 2. Error and Computer Arithmetic Numerical analysis is concerned with how to solve a problem numerically, i.e., how to develop a sequence of numerical calculations to get a satisfactory answer. Part
More informationTHE NAS KERNEL BENCHMARK PROGRAM
THE NAS KERNEL BENCHMARK PROGRAM David H. Bailey and John T. Barton Numerical Aerodynamic Simulations Systems Division NASA Ames Research Center June 13, 1986 SUMMARY A benchmark test program that measures
More informationAvailability and Disaster Recovery: Basic Principles
Availability and Disaster Recovery: Basic Principles by Chuck Petch, WVS Senior Technical Writer At first glance availability and recovery may seem like opposites. Availability involves designing computer
More informationarxiv:1112.0829v1 [math.pr] 5 Dec 2011
How Not to Win a Million Dollars: A Counterexample to a Conjecture of L. Breiman Thomas P. Hayes arxiv:1112.0829v1 [math.pr] 5 Dec 2011 Abstract Consider a gambling game in which we are allowed to repeatedly
More informationSummation Algebra. x i
2 Summation Algebra In the next 3 chapters, we deal with the very basic results in summation algebra, descriptive statistics, and matrix algebra that are prerequisites for the study of SEM theory. You
More informationHarmonic Sum Calculation: Sneaking Finite Precision Principles into CS1
Harmonic Sum Calculation: Sneaking Finite Precision Principles into CS1 Andrew A. Anda Department of Computer Science St. Cloud State University aanda@eeyore.stcloudstate.edu Abstract We describe using
More informationMonday January 19th 2015 Title: "Transmathematics  a survey of recent results on division by zero" Facilitator: TheNumberNullity / James Anderson, UK
Monday January 19th 2015 Title: "Transmathematics  a survey of recent results on division by zero" Facilitator: TheNumberNullity / James Anderson, UK It has been my pleasure to give two presentations
More informationLies My Calculator and Computer Told Me
Lies My Calculator and Computer Told Me 2 LIES MY CALCULATOR AND COMPUTER TOLD ME Lies My Calculator and Computer Told Me See Section.4 for a discussion of graphing calculators and computers with graphing
More informationAnswerNow Guides Why Live Service Matters!
Consider this: a 2% increase in customer retention has the same effect as cutting costs by 10%. That means that simply by keeping a small number of your customers from jumping ship, you can save money
More informationDigital Electronics. 1.0 Introduction to Number Systems. Module
Module 1 www.learnaboutelectronics.org Digital Electronics 1.0 Introduction to What you ll learn in Module 1 Section 1.0. Recognise different number systems and their uses. Section 1.1 in Electronics.
More informationCommunication Protocol
Analysis of the NXT Bluetooth Communication Protocol By Sivan Toledo September 2006 The NXT supports Bluetooth communication between a program running on the NXT and a program running on some other Bluetooth
More informationEncoding Text with a Small Alphabet
Chapter 2 Encoding Text with a Small Alphabet Given the nature of the Internet, we can break the process of understanding how information is transmitted into two components. First, we have to figure out
More informationCHAPTER 5 Roundoff errors
CHAPTER 5 Roundoff errors In the two previous chapters we have seen how numbers can be represented in the binary numeral system and how this is the basis for representing numbers in computers. Since any
More informationFloatingpoint computation
Real values and floating point values Floatingpoint representation IEEE 754 standard representation rounding special values Floatingpoint computation 1 Real values Not all values can be represented exactly
More informationCHAPTER THREE. 3.1 Binary Addition. Binary Math and Signed Representations
CHAPTER THREE Binary Math and Signed Representations Representing numbers with bits is one thing. Doing something with them is an entirely different matter. This chapter discusses some of the basic mathematical
More informationcomp 180 Lecture 21 Outline of Lecture Floating Point Addition Floating Point Multiplication HKUST 1 Computer Science
Outline of Lecture Floating Point Addition Floating Point Multiplication HKUST 1 Computer Science IEEE 754 floatingpoint standard In order to pack more bits into the significant, IEEE 754 makes the leading
More informationFloating Point Numbers. Question. Learning Outcomes. Number Representation  recap. Do you have your laptop here?
Question Floating Point Numbers 6.626068 x 1034 Do you have your laptop here? A yes B no C what s a laptop D where is here? E none of the above Eddie Edwards eedwards@doc.ic.ac.uk https://www.doc.ic.ac.uk/~eedwards/compsys
More information(Refer Slide Time: 00:00:56 min)
Numerical Methods and Computation Prof. S.R.K. Iyengar Department of Mathematics Indian Institute of Technology, Delhi Lecture No # 3 Solution of Nonlinear Algebraic Equations (Continued) (Refer Slide
More informationBinary Representation and Computer Arithmetic
Binary Representation and Computer Arithmetic The decimal system of counting and keeping track of items was first created by Hindu mathematicians in India in A.D. 4. Since it involved the use of fingers
More informationOptimization Techniques in C. Team Emertxe
Optimization Techniques in C Team Emertxe Optimization Techniques Basic Concepts Programming Algorithm and Techniques Optimization Techniques Basic Concepts What is Optimization Methods Space and Time
More informationDIGGING DEEPER: What Really Matters in Data Integration Evaluations?
DIGGING DEEPER: What Really Matters in Data Integration Evaluations? It s no surprise that when customers begin the daunting task of comparing data integration products, the similarities seem to outweigh
More informationCOLLEGE ALGEBRA. Paul Dawkins
COLLEGE ALGEBRA Paul Dawkins Table of Contents Preface... iii Outline... iv Preliminaries... Introduction... Integer Exponents... Rational Exponents... 9 Real Exponents...5 Radicals...6 Polynomials...5
More informationComputer is a binary digital system. Data. Unsigned Integers (cont.) Unsigned Integers. Binary (base two) system: Has two states: 0 and 1
Computer Programming Programming Language Is telling the computer how to do something Wikipedia Definition: Applies specific programming languages to solve specific computational problems with solutions
More informationBUSINESS RULES AND GAP ANALYSIS
Leading the Evolution WHITE PAPER BUSINESS RULES AND GAP ANALYSIS Discovery and management of business rules avoids business disruptions WHITE PAPER BUSINESS RULES AND GAP ANALYSIS Business Situation More
More informationDivide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1
Divide: Paper & Pencil Computer Architecture ALU Design : Division and Floating Point 1001 Quotient Divisor 1000 1001010 Dividend 1000 10 101 1010 1000 10 (or Modulo result) See how big a number can be
More informationData Quality Assurance
CHAPTER 4 Data Quality Assurance The previous chapters define accurate data. They talk about the importance of data and in particular the importance of accurate data. They describe how complex the topic
More informationThe programming language C. sws1 1
The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan
More informationInterpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Treebased interpreters. Textbased interpreters
Interpreters and virtual machines Michel Schinz 2007 03 23 Interpreters Interpreters Why interpreters? An interpreter is a program that executes another program, represented as some kind of datastructure.
More informationIn this chapter, you will learn improvement curve concepts and their application to cost and price analysis.
7.0  Chapter Introduction In this chapter, you will learn improvement curve concepts and their application to cost and price analysis. Basic Improvement Curve Concept. You may have learned about improvement
More informationInformation Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay
Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Lecture  17 ShannonFanoElias Coding and Introduction to Arithmetic Coding
More informationIEEE floating point numbers. FloatingPoint Representation and Approximation. floating point numbers with base 10. Errors
EE103 (Shinnerl) FloatingPoint Representation and Approximation Errors Cancellation Instability Simple onevariable examples Swamping IEEE floating point numbers floating point numbers with base 10 floating
More informationCharacteristics of Java (Optional) Y. Daniel Liang Supplement for Introduction to Java Programming
Characteristics of Java (Optional) Y. Daniel Liang Supplement for Introduction to Java Programming Java has become enormously popular. Java s rapid rise and wide acceptance can be traced to its design
More informationThe Mathematics School Teachers Should Know
The Mathematics School Teachers Should Know Lisbon, Portugal January 29, 2010 H. Wu *I am grateful to Alexandra AlvesRodrigues for her many contributions that helped shape this document. Do school math
More informationThe Dirty Little Secret of Software Pricing
WHITEPAPER The Dirty Little Secret of Software Pricing Stan Schneider Mr. Customer, our price is $13,349 dollars per floating development seat. Larger teams need more support, so we charge 20% maintenance
More informationThe ROI of Test Automation
The ROI of Test Automation by Michael Kelly www.michaeldkelly.com Introduction With the exception of my first project team out of college, in every project team since, I ve had to explain either what automated
More informationDNA Data and Program Representation. Alexandre David 1.2.05 adavid@cs.aau.dk
DNA Data and Program Representation Alexandre David 1.2.05 adavid@cs.aau.dk Introduction Very important to understand how data is represented. operations limits precision Digital logic built on 2valued
More informationA framework for creating custom rules for static analysis tools
A framework for creating custom rules for static analysis tools Eric Dalci John Steven Cigital Inc. 21351 Ridgetop Circle, Suite 400 Dulles VA 20166 (703) 4049293 edalci,jsteven@cigital.com Abstract Code
More informationHigh School Algebra Reasoning with Equations and Inequalities Solve equations and inequalities in one variable.
Performance Assessment Task Quadratic (2009) Grade 9 The task challenges a student to demonstrate an understanding of quadratic functions in various forms. A student must make sense of the meaning of relations
More informationUsing simulation to calculate the NPV of a project
Using simulation to calculate the NPV of a project Marius Holtan Onward Inc. 5/31/2002 Monte Carlo simulation is fast becoming the technology of choice for evaluating and analyzing assets, be it pure financial
More informationAdaptive Tolerance Algorithm for Distributed TopK Monitoring with Bandwidth Constraints
Adaptive Tolerance Algorithm for Distributed TopK Monitoring with Bandwidth Constraints Michael Bauer, Srinivasan Ravichandran University of WisconsinMadison Department of Computer Sciences {bauer, srini}@cs.wisc.edu
More informationECE 0142 Computer Organization. Lecture 3 Floating Point Representations
ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floatingpoint arithmetic We often incur floatingpoint programming. Floating point greatly simplifies working with large (e.g.,
More informationIntroduction to Statistics for Computer Science Projects
Introduction Introduction to Statistics for Computer Science Projects Peter Coxhead Whole modules are devoted to statistics and related topics in many degree programmes, so in this short session all I
More informationDemystifying the Cloud
Demystifying the Cloud A nontechnical explanation of the cloud By Kevin M. Massey, CPA It seems that everywhere you turn these days someone is talking about the cloud. Originally, the cloud was a topic
More informationIf A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C?
Problem 3 If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C? Suggested Questions to ask students about Problem 3 The key to this question
More informationTips for writing good use cases.
Transforming software and systems delivery White paper May 2008 Tips for writing good use cases. James Heumann, Requirements Evangelist, IBM Rational Software Page 2 Contents 2 Introduction 2 Understanding
More informationTopics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives
Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,
More informationWhether you re new to trading or an experienced investor, listed stock
Chapter 1 Options Trading and Investing In This Chapter Developing an appreciation for options Using option analysis with any market approach Focusing on limiting risk Capitalizing on advanced techniques
More informationPGR Computing Programming Skills
PGR Computing Programming Skills Dr. I. Hawke 2008 1 Introduction The purpose of computing is to do something faster, more efficiently and more reliably than you could as a human do it. One obvious point
More informationCompass Interdisciplinary Virtual Conference 1930 Oct 2009
Compass Interdisciplinary Virtual Conference 1930 Oct 2009 10 Things New Scholars should do to get published Duane Wegener Professor of Social Psychology, Purdue University Hello, I hope you re having
More informationThe Two Envelopes Problem
1 The Two Envelopes Problem Rich Turner and Tom Quilter The Two Envelopes Problem, like its better known cousin, the Monty Hall problem, is seemingly paradoxical if you are not careful with your analysis.
More informationThe power of money management
The power of money management One trader lost ($3000) during the course of a year trading one contract of system A. Another trader makes $25,000 trading the same system that year. One trader makes $24,000
More informationI d Rather Stay Stupid: The Advantage of Having Low Utility
I d Rather Stay Stupid: The Advantage of Having Low Utility Lior Seeman Department of Computer Science Cornell University lseeman@cs.cornell.edu Abstract Motivated by cost of computation in game theory,
More informationTips for Solving Mathematical Problems
Tips for Solving Mathematical Problems Don Byrd Revised late April 2011 The tips below are based primarily on my experience teaching precalculus to highschool students, and to a lesser extent on my other
More informationExpert Reference Series of White Papers. What Is Formal Project Management and Who Needs It?
Expert Reference Series of White Papers What Is Formal Project Management and Who Needs It? 1800COURSES www.globalknowledge.com What Is Formal Project Management and Who Needs It? Brian Denis Egan, Global
More information11.3 BREAKEVEN ANALYSIS. Fixed and Variable Costs
385 356 PART FOUR Capital Budgeting a large number of NPV estimates that we summarize by calculating the average value and some measure of how spread out the different possibilities are. For example, it
More informationTO WHAT DOES THE HARMONIC SERIES CONVERGE?
Irish Math. Soc. Bulletin Number 7, Summer 203, 59 66 ISSN 0795578 TO WHAT DOES THE HARMONIC SERIES CONVERGE? DAVID MALONE Abstract. We consider what value the harmonic series will converge to if evaluated
More informationArbs2U Is it right for me? 17 October 2014
17 October 2014 Contents Section 1 Preface... 3 Document Feedback... 3 Section 2 Introducing Arbitrage... 4 A brief discussion on Betting... 4 What is Arbitrage?... 5 What are the risks involved?... 7
More informationHow Java Software Solutions Outperform Hardware Accelerators
How Java Software Solutions Outperform Hardware Accelerators MIPS Technologies, Inc. April 2005 Java is a programming language which has one big advantage and one big disadvantage: the big advantage is
More informationCHAPTER 1. Compound Interest
CHAPTER 1 Compound Interest 1. Compound Interest The simplest example of interest is a loan agreement two children might make: I will lend you a dollar, but every day you keep it, you owe me one more penny.
More informationMaster Data Management (MDM)
the way we do it Master Data Management (MDM) Mastering the Information Ocean Mastery of information gives business control In the modern business, the volume of information is increasing and the value
More informationLecture 8 The Subjective Theory of Betting on Theories
Lecture 8 The Subjective Theory of Betting on Theories Patrick Maher Philosophy 517 Spring 2007 Introduction The subjective theory of probability holds that the laws of probability are laws that rational
More informationNew Generation of Software Development
New Generation of Software Development Terry Hon University of British Columbia 2012366 Main Mall Vancouver B.C. V6T 1Z4 tyehon@cs.ubc.ca ABSTRACT In this paper, I present a picture of what software development
More informationThis Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers
This Unit: Floating Point Arithmetic CIS 371 Computer Organization and Design Unit 7: Floating Point App App App System software Mem CPU I/O Formats Precision and range IEEE 754 standard Operations Addition
More informationChapter 11 Number Theory
Chapter 11 Number Theory Number theory is one of the oldest branches of mathematics. For many years people who studied number theory delighted in its pure nature because there were few practical applications
More informationRepresentation of Data
Representation of Data In contrast with higherlevel programming languages, C does not provide strong abstractions for representing data. Indeed, while languages like Racket has a rich notion of data type
More informationMIPS floatingpoint arithmetic
MIPS floatingpoint arithmetic Floatingpoint computations are vital for many applications, but correct implementation of floatingpoint hardware and software is very tricky. Today we ll study the IEEE
More informationWriting Portable Programs COS 217
Writing Portable Programs COS 217 1 Goals of Today s Class Writing portable programs in C Sources of heterogeneity Data types, evaluation order, byte order, char set, Reading period and final exam Important
More informationDouble Deck Blackjack
Double Deck Blackjack Double Deck Blackjack is far more volatile than Multi Deck for the following reasons; The Running & True Card Counts can swing drastically from one Round to the next So few cards
More informationMoney and the Single Parent. Apprisen. 800.355.2227 www.apprisen.com
Money and the Single Parent Apprisen 800.355.2227 www.apprisen.com Money and the Single Parent Being a single parent is not easy. As a matter of fact, it is really hard. Single parents are stretched in
More informationScheduling is a DRAG
Scheduling is a DRAG Better project management does not mean making schedules longer but rather making projects shorter. By William R. Duncan and Stephen A. Devaux Most organizations have realized that
More informationMaster Data Management (MDM)
Business Information Management the way we see it Master Data Management (MDM) Mastering the Information Ocean Business Information Management the way we see it Mastery of information gives business control
More informationWorkers compensation finances crisis or smokescreen?
Workers compensation finances crisis or smokescreen? Over the past 20 years, the unfunded liability has been offered as the reason for eliminating full costofliving adjustment of injured worker benefits
More informationY = abc = a b c.2 0
Chapter 2 Bits, Data Types & Operations Integer Representation Floatingpoint Representation Other data types Why do Computers use Base 2? Base 10 Number Representation Natural representation for human
More informationCS 16: Assembly Language Programming for the IBM PC and Compatibles
CS 16: Assembly Language Programming for the IBM PC and Compatibles First, a little about you Your name Have you ever worked with/used/played with assembly language? If so, talk about it Why are you taking
More informationChapter 7D The Java Virtual Machine
This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly
More informationUSING CREDIT WISELY AFTER BANKRUPTCY
USING CREDIT WISELY AFTER BANKRUPTCY Copyright April 2011, Legal Aid Society of Hawai`i All rights reserved. These materials may be reproduced. However, under no circumstances are persons receiving these
More informationLimits. Graphical Limits Let be a function defined on the interval [6,11] whose graph is given as:
Limits Limits: Graphical Solutions Graphical Limits Let be a function defined on the interval [6,11] whose graph is given as: The limits are defined as the value that the function approaches as it goes
More informationProcess, Workflow, and Rules Why do you need to care????
Process, Workflow, and Rules Why do you need to care???? Dan Morris and Joel Brandon Authors of Relational Systems Development, McGraw Hill, 1998 Reengineering Your Business, McGraw Hill, 1994 and Just
More informationSchool of Informatics, University of Edinburgh
CS1Ah Lecture Note 5 Java Expressions Many Java statements can contain expressions, which are program phrases that tell how to compute a data value. Expressions can involve arithmetic calculation and method
More informationMinimizing code defects to improve software quality and lower development costs.
Development solutions White paper October 2008 Minimizing code defects to improve software quality and lower development costs. IBM Rational Software Analyzer and IBM Rational PurifyPlus software Kari
More informationWhat is Application Lifecycle Management?
What is Application Lifecycle Management? David Chappell Sponsored by Microsoft Corporation Copyright 2014 Chappell & Associates Defining application lifecycle management (ALM) isn t easy. Different people
More informationThe Classes P and NP
The Classes P and NP We now shift gears slightly and restrict our attention to the examination of two families of problems which are very important to computer scientists. These families constitute the
More informationModule 3: Functional Requirements
smart BA Distance Learning Programme Module 3: Functional Requirements Hello and welcome to the smart BA distance learning programme Module 3 in this module you are going to analyse the requirements of
More informationTesting Rails. by Josh Steiner. thoughtbot
Testing Rails by Josh Steiner thoughtbot Testing Rails Josh Steiner April 10, 2015 Contents thoughtbot Books iii Contact us................................ iii Introduction 1 Why test?.................................
More information8 Square matrices continued: Determinants
8 Square matrices continued: Determinants 8. Introduction Determinants give us important information about square matrices, and, as we ll soon see, are essential for the computation of eigenvalues. You
More information