Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #11138
| From | 88888 Dihedral <dihedral88888@googlemail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: float |
| Date | 2011-10-28 23:27 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <5339181.3288.1319869626025.JavaMail.geo-discussion-forums@prog16> (permalink) |
| References | <fa3c19f8-c2ed-4d12-b18e-e40b574cdd31@g16g2000yqi.googlegroups.com> <30622906.1033.1319861173538.JavaMail.geo-discussion-forums@prfk19> <j8g236$agd$2@dont-email.me> |
red floyd於 2011年10月29日星期六UTC+8下午1時14分07秒寫道: > On 10/28/2011 9:06 PM, 88888 Dihedral wrote: > > float d1= 4/3 ; /* promote to inetger only in the right hand side result */ > No, that's integer arithmetic, result promoted to float. > > > > > float d2= 4.0/3 ; /* promote to float */ > > float d3= 4/3.0 ; > > float d4= 4.0/3.0; > > Technically, the first two are promote to double, truncate to float. > The third is already double, truncate to float. ------------------------------------------------------ int x=3; int y=4; float d = x/y ; float d= ((float)x)/y ; /* whether the compiler knows x,y are constants up to now ? */
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
float ramtin <tom.t.2090@gmail.com> - 2011-10-17 12:40 -0700
Re: float Dombo <dombo@disposable.invalid> - 2011-10-17 21:47 +0200
Re: float Thomas Boell <tboell@domain.invalid> - 2011-10-17 21:50 +0200
Re: float Sjouke Burry <S@P.NL> - 2011-10-26 23:13 +0000
Re: float Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-10-17 13:05 -0700
Re: float Ian Collins <ian-news@hotmail.com> - 2011-10-18 09:23 +1300
Re: float Leigh Johnston <leigh@i42.co.uk> - 2011-10-17 21:25 +0100
Re: float Leigh Johnston <leigh@i42.co.uk> - 2011-10-17 21:31 +0100
Re: float Leigh Johnston <leigh@i42.co.uk> - 2011-10-17 21:33 +0100
Re: float Ian Collins <ian-news@hotmail.com> - 2011-10-18 09:35 +1300
Re: float ramtin <tom.t.2090@gmail.com> - 2011-10-17 13:49 -0700
Re: float Ian Collins <ian-news@hotmail.com> - 2011-10-18 09:19 +1300
Re: float "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-10-18 00:55 +0100
Re: float SG <s.gesemann@gmail.com> - 2011-10-18 05:34 -0700
Re: float Christopher <cpisz@austin.rr.com> - 2011-10-27 14:29 -0700
Re: float Dombo <dombo@disposable.invalid> - 2011-10-28 18:14 +0200
Re: float 88888 Dihedral <dihedral88888@googlemail.com> - 2011-10-28 21:06 -0700
Re: float red floyd <no.spam.here@its.invalid> - 2011-10-28 22:14 -0700
Re: float 88888 Dihedral <dihedral88888@googlemail.com> - 2011-10-28 23:27 -0700
Re: float red floyd <no.spam.here@its.invalid> - 2011-10-29 08:24 -0700
Re: float ptyxs <kerloch@gmail.com> - 2011-10-30 01:40 -0700
Re: float Ian Collins <ian-news@hotmail.com> - 2011-10-30 22:27 +1300
csiph-web