🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #625

Re: C++: How to do floating point division?

#625
From: achacha
Date: Fri, 19 Feb 1999 00:00
19 lines
1384 bytes
In comp.lang.c++ Jules <julius@clara.net> wrote:
: 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*



You can use 22.0/7.0 or better yet:
const double pi = 3.141592654;


...ecaeP_Alex...
Technical Details
Message-ID: <7akhep$oif$2@news.panix.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7Riz2.11845$cQ5.6291@nnrp2.clara.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb1d5,e29ff327add874ff
X-Google-Attributes: gidfb1d5,public
X-Google-Thread: 114592,e29ff327add874ff
X-Google-Attributes: gid114592,public
X-Google-Thread: 143fed,e29ff327add874ff
X-Google-Attributes: gid143fed,public
X-Google-Thread: 109fba,e29ff327add874ff
X-Google-Attributes: gid109fba,public
From: achacha@REMOVETHIS.panix.com
Subject: Re: C++: How to do floating point division?
Date: 1999/02/19
Message-ID: <7akhep$oif$2@news.panix.com>
X-Deja-AN: 446179367
References: <7Riz2.11845$cQ5.6291@nnrp2.clara.net>
X-Complaints-To: usenet@panix.com
X-Trace: news.panix.com 919456025 25167 166.84.0.227 (19 Feb 1999 20:27:05 GMT)
Organization: http://www.panix.com/~achacha
User-Agent: tin/pre-1.4-981225 ("Volcane") (UNIX) (SunOS/4.1.4 (sun4m))
NNTP-Posting-Date: 19 Feb 1999 20:27:05 GMT
Newsgroups: alt.comp.lang.learn.c-c++,claranet.local.help,claranet.local.tech,comp.lang.c++