220 31424 <7327f25a-3d77-4d97-808e-678b3458ee52@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: lev@compuserve.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Math constants
Date: Sat, 4 Mar 2017 12:30:40 -0800 (PST)
Lines: 88
Approved: news@gmane.org
Message-ID: <7327f25a-3d77-4d97-808e-678b3458ee52@isocpp.org>
References: <ad05f2f2-609d-4fd3-90f7-d66c74e168b7@isocpp.org>
 <8aec2d3e-60e3-4dbf-890d-3450a32ca6d3@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1002_1497323857.1488659440206"
X-Trace: blaine.gmane.org 1488659441 25645 195.159.176.226 (4 Mar 2017 20:30:41 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 4 Mar 2017 20:30:41 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCL6TUMOQUJRB4GH5TCQKGQEQCDIS7A@isocpp.org Sat Mar 04 21:30:37 2017
Return-path: <std-proposals+bncBCL6TUMOQUJRB4GH5TCQKGQEQCDIS7A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pg0-f71.google.com ([74.125.83.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCL6TUMOQUJRB4GH5TCQKGQEQCDIS7A@isocpp.org>)
	id 1ckGK3-00064L-On
	for gclcip-std-proposals@m.gmane.org; Sat, 04 Mar 2017 21:30:35 +0100
Original-Received: by mail-pg0-f71.google.com with SMTP id b2sf164909604pgc.6
        for <gclcip-std-proposals@m.gmane.org>; Sat, 04 Mar 2017 12:30:42 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=CatW40likYH7Z+yaSVQS6HQPbZ/2guYoOky45jCo19E=;
        b=ertuV4lVFZlVjDWvgK/xbCOHFtmKfKPfgc5Si8sdzNt/4BkVSjqmMNHmqByRU+rKCq
         +6ETczFP94CWlF5OagYf229gkNwfGC8TyCjXPkls6JobYg+Rv9A7fxw9fhZhp2T9zwfv
         MZJdZJXAG3zHwFi0txSTGuq6Or4O3Lmenz38cgB35yTVxe7tM2S0Qw42MebsPbD8usgo
         yisJXO+DSfE54IrdwCgp6KOwOm4+TiiMlPUnYUAHuX19fzLVhhFW2uHHU9yVnTZItDYP
         P2e2OETQgI1yIBpeCEs/cDTKHFAF4BUDb343c97sFW7WJaev26qb3oVS0LPEuOS6t7Jq
         eDfw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=CatW40likYH7Z+yaSVQS6HQPbZ/2guYoOky45jCo19E=;
        b=QjcYq1c1FMQUK+3lMT+WqcljYWdvPPJhOUxIAOUjp95dqJHtTkH1OjZHOF0Mf6dmmG
         MNlIW11rY4h2m8C+G0koJoYfv3Dj9O0jxyMkOHqZ3J9aD+joXs/W0VGcMJkHyTs+qIJx
         oMWB8qWDCzDr/bup5RFBDI8v3znXzGJ6HdHG+1YdLtodTeWOnt7LSlq1vZZLvkvgA43o
         97VV+Zube5LnUB1WUEm2/t1oHiPGDRslsg2cKkxTlEpPfVHFfcGEhI+m3iNSuwlEsmMB
         hbgR6v0Z2KnVwSeHAoovA9cqnsBGW2HoXbxuuBGEcKhK33uAtOyiIjybKcXGW6pH1Q/y
         J7+g==
X-Gm-Message-State: AMke39mfNFkVFQ+eTXO/HKqQ9voo0uTmp4d+TRYxI2KRqSylzLWsZ7LS/BpW3Geg/3dfbg==
X-Received: by 10.99.174.78 with SMTP id e14mr61221pgp.74.1488659441575;
        Sat, 04 Mar 2017 12:30:41 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.63.218 with SMTP id i26ls12698843ote.48.gmail; Sat, 04 Mar
 2017 12:30:40 -0800 (PST)
X-Received: by 10.157.18.133 with SMTP id g5mr872352otg.8.1488659440700;
        Sat, 04 Mar 2017 12:30:40 -0800 (PST)
In-Reply-To: <8aec2d3e-60e3-4dbf-890d-3450a32ca6d3@isocpp.org>
X-Original-Sender: lev@compuserve.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:31424
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31424>

------=_Part_1002_1497323857.1488659440206
Content-Type: multipart/alternative; 
	boundary="----=_Part_1003_943666784.1488659440206"

------=_Part_1003_943666784.1488659440206
Content-Type: text/plain; charset=UTF-8

My initial line of thought was that const in this context would be 
equivalent to constexpr. This appears to be a gray area when it comes to 
implementations, so you are probably correct. Here is the revision:

namespace std {
constexpr long double PI = 3.14159265358979323846;      // pi
constexpr long double E = 2.71828182845904523536;      // e
constexpr long double LOG2E = 1.44269504088896340736;     // log2(e)
constexpr long double LOG10E = 0.434294481903251827651; // log10(e)
constexpr long double LN2 = 0.693147180559945309417;      // ln(2)
constexpr long double LN10 = 2.30258509299404568402;      // ln(10)
constexpr long double SQRT2 = 1.41421356237309504880;     // sqrt(2)
}

On Saturday, March 4, 2017 at 2:16:56 PM UTC-5, Vishal Oza wrote:
>
> I am not sure I would like these values written as manual constants but 
> rather as constexpr constants that are evaluated one during ethier 
> compilation or linking. This has the advantage of being as accurate at the 
> hardware allows while have the same runtime as a constant.

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/7327f25a-3d77-4d97-808e-678b3458ee52%40isocpp.org.

------=_Part_1003_943666784.1488659440206
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">My initial line of thought was that const in this context =
would be equivalent to constexpr. This appears to be a gray area when it co=
mes to implementations, so you are probably correct. Here is the revision:<=
div><br></div><div>namespace std {<br></div><div><div><span class=3D"Apple-=
tab-span" style=3D"white-space:pre">	</span>constexpr long double PI =3D 3.=
14159265358979323846;<span class=3D"Apple-tab-span" style=3D"white-space:pr=
e">	</span>=C2=A0 =C2=A0 =C2=A0// pi</div><div><span class=3D"Apple-tab-spa=
n" style=3D"white-space:pre">	</span>constexpr long double E =3D 2.71828182=
845904523536;<span class=3D"Apple-tab-span" style=3D"white-space:pre">		</s=
pan>=C2=A0 =C2=A0 =C2=A0// e</div><div><span class=3D"Apple-tab-span" style=
=3D"white-space:pre">	</span>constexpr long double LOG2E =3D 1.442695040888=
96340736; =C2=A0 =C2=A0 // log2(e)</div><div><span class=3D"Apple-tab-span"=
 style=3D"white-space:pre">	</span>constexpr long double LOG10E =3D 0.43429=
4481903251827651; // log10(e)</div><div><span class=3D"Apple-tab-span" styl=
e=3D"white-space:pre">	</span>constexpr long double LN2 =3D 0.6931471805599=
45309417;<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>=
=C2=A0 =C2=A0 =C2=A0// ln(2)</div><div><span class=3D"Apple-tab-span" style=
=3D"white-space:pre">	</span>constexpr long double LN10 =3D 2.3025850929940=
4568402;<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>=
=C2=A0 =C2=A0 =C2=A0// ln(10)</div><div><span class=3D"Apple-tab-span" styl=
e=3D"white-space:pre">	</span>constexpr long double SQRT2 =3D 1.41421356237=
309504880; =C2=A0 =C2=A0 // sqrt(2)</div><div>}</div><br>On Saturday, March=
 4, 2017 at 2:16:56 PM UTC-5, Vishal Oza wrote:<blockquote class=3D"gmail_q=
uote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;pad=
ding-left: 1ex;">I am not sure I would like these values written as manual =
constants but rather as constexpr constants that are evaluated one during e=
thier compilation or linking. This has the advantage of being as accurate a=
t the hardware allows while have the same runtime as a constant.</blockquot=
e></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/7327f25a-3d77-4d97-808e-678b3458ee52%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/7327f25a-3d77-4d97-808e-678b3458ee52=
%40isocpp.org</a>.<br />

------=_Part_1003_943666784.1488659440206--

------=_Part_1002_1497323857.1488659440206--

.
