🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#627
From: Jim Cobban
Date: Fri, 19 Feb 1999 00:00
17 lines
1221 bytes
In article <7Riz2.11845$cQ5.6291@nnrp2.clara.net>,
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?
>
#include <math.h>

const double pi = M_PI;	/* much more accurate */
      ^^^^^^


-- 
Jim Cobban   |  jcobban@nortel.ca                   |  Phone: (613) 763-8013
Nortel Networks (MED)                               |  FAX:   (613) 763-5199
Technical Details
Message-ID: <7akkrr$gh5$1@bcarh8ab.ca.nortel.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: 109fba,e29ff327add874ff
X-Google-Attributes: gid109fba,public
X-Google-Thread: 114592,e29ff327add874ff
X-Google-Attributes: gid114592,public
X-Google-Thread: fb1d5,e29ff327add874ff
X-Google-Attributes: gidfb1d5,public
X-Google-Thread: 143fed,e29ff327add874ff
X-Google-Attributes: gid143fed,public
From: jcobban@bnr.ca (Jim Cobban)
Subject: Re: C++: How to do floating point division?
Date: 1999/02/19
Message-ID: <7akkrr$gh5$1@bcarh8ab.ca.nortel.com>
X-Deja-AN: 446201617
References: <7Riz2.11845$cQ5.6291@nnrp2.clara.net>
Organization: Nortel Networks
Newsgroups: alt.comp.lang.learn.c-c++,claranet.local.help,claranet.local.tech,comp.lang.c++