Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #16336
| From | Lew <noone@lewscanon.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: floating point |
| Date | 2012-07-25 06:33 -0700 |
| Organization | albasani.net |
| Message-ID | <juosid$gnk$1@news.albasani.net> (permalink) |
| References | <d94d1dd0-deb5-4259-b5a0-fb3d57e99c55@googlegroups.com> <jumuu7$6np$1@dont-email.me> <fdecd225-042b-4aad-9cb3-b23fd669388e@googlegroups.com> <7g2u08dsv3dels3k2t28q9vvbp0l0v7bsv@4ax.com> |
Gene Wirchenko wrote: > Lew wrote: > > [snip] > >> So, yes, the parenthesized addition is done as an 'int' addition. >> >> "5.6. Numeric Promotions >> >> "Numeric promotion is applied to the operands of an arithmetic operator. >> Numeric promotion contexts allow the use of: >> >> " an identity conversion (§5.1.1) >> " a widening primitive conversion (§5.1.2) >> " an unboxing conversion (§5.1.8) >> >> "Numeric promotions are used to convert the operands of a numeric >> operator to a common type so that an operation can be performed. >> The two kinds of numeric promotion are unary numeric promotion >> (§5.6.1) and binary numeric promotion (§5.6.2)." >> >> So, by those sections you can see that the division must be evaluated >> as 'float'. >> >> For those who decry the use of the JLS to learn this, just note that the >> relevant sections are not especially obscure and they answer the >> question completely and authoritatively. But feel free to struggle with >> alternatives if you really want to work harder. > > This sort of thing is handled in many introductory programming > language texts so it is not harder at all to use them instead. > >> <http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html> >> <http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.7> >> <http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.6> >> <http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.6.2> > > Whereas in a text, it might be "Chapter 3: Datatypes and > Operations". A bit simpler, no? No. One place to find all the answers, authoritative and final. Versus many places of dubious quality that might at best indirectly hint at the answer. Victory: JLS. But you have a bug up your arse about the JLS and I recognize that from your continued efforts to speak against its use. I don't demand that anyone read the JLS. I just point out that it has the answers, that for the most part it's readable and that the more obscure parts are amenable to study, and that it's worthwhile. Those who excoriate its use, as opposed to, say, recommending that one work with additional material as well, are leading the rest astray. I really don't understand this rabid rejection of such a useful resource. Those of you without an irrational fear of the JLS should judge for yourselves. Don't be afraid of it because the Genes of the world are trying to frighten you away from its use. Oh, don't use it as your only source, not even after you've gained familiarity with it and with Java, but by all means use it. Gene is wrong to discourage that. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
floating point bob smith <bob@coolfone.comze.com> - 2012-07-24 12:57 -0700
Re: floating point markspace <-@.> - 2012-07-24 13:01 -0700
Re: floating point Lew <lewbloch@gmail.com> - 2012-07-24 13:21 -0700
Re: floating point Gene Wirchenko <genew@ocis.net> - 2012-07-24 13:50 -0700
Re: floating point Lew <noone@lewscanon.com> - 2012-07-25 06:33 -0700
Re: floating point Gene Wirchenko <genew@ocis.net> - 2012-07-25 10:44 -0700
Re: floating point Lew <lewbloch@gmail.com> - 2012-07-25 17:09 -0700
Re: floating point Gene Wirchenko <genew@ocis.net> - 2012-07-25 17:42 -0700
Re: floating point Jan Burse <janburse@fastmail.fm> - 2012-07-26 03:15 +0200
Re: floating point Arne Vajhøj <arne@vajhoej.dk> - 2012-07-25 21:05 -0400
Re: floating point Martin Gregorie <martin@address-in-sig.invalid> - 2012-07-24 20:34 +0000
Re: floating point Patricia Shanahan <pats@acm.org> - 2012-07-24 13:29 -0700
Re: floating point Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2012-07-25 12:22 +0300
Re: floating point Arne Vajhøj <arne@vajhoej.dk> - 2012-07-25 10:54 -0400
Re: floating point Roedy Green <see_website@mindprod.com.invalid> - 2012-07-25 13:29 -0700
csiph-web