Sommaire: Course how Java’s floating-point hurts everyone everywhere
Overview: Java has evolved to target markets to which its initial design decisions are ill-suited.
Pure Java’s Two Cruel Delusions, promises Java cannot keep
Example: Complex Arithmetic Classes; should misplotted fluid flows be exactly reproducible?
Example: Faster Matrix Multiply too valuable to forego for unneeded exact reproducibility
Self-Discipline, Reproducibility, Controllability
Java purports to fix what ain’t broken in Floating-point
Exceptions; Algebraical Completion; lack of Flags makes Java’s Floating-Point Dangerous
Misconceptions about Floating-point
Example: Disassociate “Catastrophic” from “Cancellation”; Computation as a Web
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 counter-example
What’s wrong with it (and another counter-example); how it got into so many programming languages
What to do instead; Four Rules of Thumb for best use of modern floating-point hardware
Example: Angle at the eye; old Kernighan-Ritchie C semantics are safer than Java’s
Three Williams contend for Java’s numerics, it should copy old Kernighan-Ritchie C semantics
Example: 3-dimensional rectilinear geometry; Cross-products work better as matrix products
Overloaded operators; Neat solutions for nearest-point problems, …
turned into numerical junk by Java’s floating-point, work well in Kernighan-Ritchie C
Dynamic Directed Rounding Modes; Debugging Numerical Instability
Example: Needle-like triangles’ area and angles
IEEE 754 Double Extended reduces the risk of chagrin, conserves monotonicity, …
… but not in Java. Three floating-point 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 intransigenc
How to support extra-precise arithmetic; anonymous indigenous ; Optimizations by the Compile
Conclusions: Java’s floating-point hurts Java vs. J++ , so repair Java’s floating-point soon.
Extrait du course how Java’s floating-point hurts everyone everywhere
Java’s floating-point 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 floating-point 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 floating-point 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.
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 power-assisted? 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 body-strength, lights, brakes,tires, seat-belts, air-bags, safety-glass, … 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 floating-point, 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 floating-point.” ( J.G., 28 Feb. 1998 ) 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 floating-point’s complexities. Like Coleridge’s Ancient Mariner afloat in “ Water, water every where, nor any drop to drink ”
The essence of programming is Control.
Control requires Predictability, which should be Java’s forte.
Java would impose “ Exact Reproducibility ” upon Floating-Point 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 floating-point 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 floating-point 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 Floating-Point 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 floating-point 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 in-house numerical expertise, which would have prevented their floating-point blunders.
Course how Java’s floating-point hurts everyone everywhere (362 KO) (Cours PDF)