Article View: alt.comp.lang.learn.c-c++
Article #630Re: How to do floating point division?
From: Mike White
Date: Mon, 22 Feb 1999 00:00
Date: Mon, 22 Feb 1999 00:00
25 lines
1422 bytes
1422 bytes
Well this works: const float pi = (float)22/7; but bear in mind I'm not exactly C++ qualified so I bet there is a better answer!! Mike Jules wrote in message <7Riz2.11845$cQ5.6291@nnrp2.clara.net>... >Dear all, I want to do a const line like this in C++: > >const float pi = 22/7; > >but '/' will only return an int, so how do I have a float to store in pi? > >Thanks, > Jules > >*There is not enough darkness to extinguish the light of a small candle* > > > > > >
Technical Details
Message-ID:
<l3dA2.6$uJ1.150@nnrp3.clara.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7Riz2.11845$cQ5.6291@nnrp2.clara.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114592,e29ff327add874ff X-Google-Attributes: gid114592,public X-Google-Thread: 109fba,e29ff327add874ff X-Google-Attributes: gid109fba,public X-Google-Thread: fb1d5,e29ff327add874ff X-Google-Attributes: gidfb1d5,public X-Google-Thread: 143fed,e29ff327add874ff X-Google-Attributes: gid143fed,public From: "Mike White" <mikewhite_hates_spam@clara.net> Subject: Re: How to do floating point division? Date: 1999/02/22 Message-ID: <l3dA2.6$uJ1.150@nnrp3.clara.net> X-Deja-AN: 447064443 References: <7Riz2.11845$cQ5.6291@nnrp2.clara.net> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 X-Complaints-To: abuse@clara.net X-Trace: nnrp3.clara.net 919690577 195.8.75.210 (Mon, 22 Feb 1999 13:36:17 BST) NNTP-Posting-Date: Mon, 22 Feb 1999 13:36:17 BST Newsgroups: alt.comp.lang.learn.c-c++,claranet.local.help,claranet.local.tech,comp.lang.c++