Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: floating point Date: Tue, 24 Jul 2012 13:01:11 -0700 Organization: A noiseless patient Spider Lines: 13 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 24 Jul 2012 20:01:11 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="61282af8d6595e8d991edb5ac03d6e00"; logging-data="6905"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/aQjnoCG3f9CWvaIFRfV10zABHrhcOSHc=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: Cancel-Lock: sha1:XM2xsSzswAnLJNZhdje5WAPGwh0= Xref: csiph.com comp.lang.java.programmer:16310 On 7/24/2012 12:57 PM, bob smith wrote: > I can never remember this. > > Let's say you have an integer and a float in an operation. Is the result always a float? You can just try this to see what you get, or read the JLS. From memory, I'm 90% sure that ints will be promoted to floats. I'm not sure how order of operations affects this. In the expression (1+1)/2.0f, does the addition use floats or ints? I'm not sure, but I think ints.