220 36871 <fc678dff-6bec-4f54-bb7b-22e140b54d71@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Alexander Zaitsev <zamazan4ik@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Prime test functions
Date: Sun, 11 Feb 2018 12:09:53 -0800 (PST)
Lines: 155
Approved: news@gmane.org
Message-ID: <fc678dff-6bec-4f54-bb7b-22e140b54d71@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_8253_62567644.1518379793706"
X-Trace: blaine.gmane.org 1518379689 27347 195.159.176.226 (11 Feb 2018 20:08:09 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 11 Feb 2018 20:08:09 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDGLZGV44EEBBEWGQLKAKGQEBJNDEZY@isocpp.org Sun Feb 11 21:08:05 2018
Return-path: <std-proposals+bncBDGLZGV44EEBBEWGQLKAKGQEBJNDEZY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f200.google.com ([209.85.217.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDGLZGV44EEBBEWGQLKAKGQEBJNDEZY@isocpp.org>)
	id 1ekxug-00060I-H9
	for gclcip-std-proposals@m.gmane.org; Sun, 11 Feb 2018 21:07:50 +0100
Original-Received: by mail-ua0-f200.google.com with SMTP id b45sf8904629uad.10
        for <gclcip-std-proposals@m.gmane.org>; Sun, 11 Feb 2018 12:09:56 -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:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=S4fKvx8JN7Ko/Qt94TZJNS5+PZBb0XNcF+IKM5a2qYE=;
        b=LrIm8dxaQszJzPwJSGXUMXowE7/PDIOQgl9la/vK1NuQ6TpWWEU7gxBYzCqadFg5Ei
         2sNkPhWq5upTW56vqOHC0PPXOIen209sAx4QbY4iNcm/UYlFkDFgtCt6KCwHVzlGKcW7
         8SJOWmHVsCktubdKpRvQrBITgp2WA2fVxPXwB0g06aNo0I2xSdqdG03Xbhn6spmDEcdH
         2w3BAF4lpKAclURjct/XfZaXe5MbYHGBNcU8LvRK0OrrSU0HhDgSHomAPg/RbrTnxGpI
         Pc8WczRaZQ+mMIowRH/T+nldd+X7xwl93myvqFVG8TFH7bd5Iu62jieoRiZDyAw0TGPz
         APpg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=S4fKvx8JN7Ko/Qt94TZJNS5+PZBb0XNcF+IKM5a2qYE=;
        b=B4av4jb//AYJmRB4cW4OEdfafl7VPIjugngDuL2dXKDFrv2Bni8icJvADKt5QV+RWY
         dL7B88/2yzNoOpJPWotlbBvjK/quGSmfpR5QvQZJYcpV7e8vDeemPm7HBb5aUPeccanS
         Rc9xBW3aD1YleByUsjKpdFlcHMWC6qfgFjpZnc789yw9I6JvMHCwuGMrm/UlmOSYRPBE
         H3DLAy3rEXuIfTqRpElJ8x/Z24fFuxC6OMZ2SvdIcx3BBg4aK6DEinjM6EcYJ1aq8JVE
         gHo4/wk/Hh0Bjzj+pMyil/dYavtlEMljoX1D8YDDZW3rTZFscickB+w7A1qlIRuBxlby
         BRsg==
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: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=S4fKvx8JN7Ko/Qt94TZJNS5+PZBb0XNcF+IKM5a2qYE=;
        b=ZbP/QGZ9U+8jiVz9XsmIcvm2jdlZ8mKifLNvZJjyA8O/EAx5yTeJhKoEo7Q++9kOt+
         PXym1b791nZ356qOoICI0q6Cc0hIJ3nbdyPu7NDDBcNzmdPv4T6hyblaHME2U63Hh/93
         st5eSYFCoZTSbng0YXZAfOv//JbQD3Cx3H6HP+fR35RRy5GhcotApBbdYErkLS4f1NZ9
         8GTr2PYOHrIC5NbT/XBz7TDiHgLntOCaBV0nmj2fVuMkIQfCxDqcmIswzsjdsB7SHiEJ
         eoBVFJQG4uI3Wtdb92GZTFaGRMxUhgPPQIORro22mr02eDznfmOyFrSJkWBeeUpRYYwj
         YjGw==
X-Gm-Message-State: APf1xPDxz0wP/HEArrVZ72HSsW9+Gk/dxORNlfr0Kfb0Kd93nEmzMeMH
	xEjcFIk9VvCt25mL7LSAiEF3LA==
X-Google-Smtp-Source: AH8x227CTX6eEiyqKSyNyrtB9e3xleWevSLQrQ6OB986UEZOBkM1i3Fcc8Uzvd2c0iS5UFxDKl0Aow==
X-Received: by 10.31.53.68 with SMTP id c65mr64594vka.11.1518379796013;
        Sun, 11 Feb 2018 12:09:56 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.67.196 with SMTP id q187ls6124222vka.21.gmail; Sun, 11 Feb
 2018 12:09:54 -0800 (PST)
X-Received: by 10.31.159.216 with SMTP id i207mr447087vke.12.1518379794312;
        Sun, 11 Feb 2018 12:09:54 -0800 (PST)
X-Original-Sender: zamazan4ik@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: 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:36871
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/36871>

------=_Part_8253_62567644.1518379793706
Content-Type: multipart/alternative; 
	boundary="----=_Part_8254_637615256.1518379793706"

------=_Part_8254_637615256.1518379793706
Content-Type: text/plain; charset="UTF-8"

Hello,

I want to get feedback about my proposal about adding prime test functions 
to C++. You can find it as an attached file.

Open questions:

   - I am not sure about interface for is_probable_prime interface. On the 
   one hand i don't want to see under the hood any specific imeplementation. 
   On the other hand i should guarantee something (I mean complexity and 
   probablity).


Do you have any suggestions?


-- 
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/fc678dff-6bec-4f54-bb7b-22e140b54d71%40isocpp.org.

------=_Part_8254_637615256.1518379793706
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello,<div><br></div><div>I want to get feedback about my =
proposal about adding prime test functions to C++. You can find it as an at=
tached file.</div><div><br></div><div>Open questions:</div><div><ul><li>I a=
m not sure about interface for is_probable_prime interface. On the one hand=
 i don&#39;t want to see under the hood any specific imeplementation. On th=
e other hand i should guarantee something (I mean complexity and probablity=
).</li></ul></div><div><br></div><div>Do you have any suggestions?</div><di=
v><br></div><div><br></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/fc678dff-6bec-4f54-bb7b-22e140b54d71%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/fc678dff-6bec-4f54-bb7b-22e140b54d71=
%40isocpp.org</a>.<br />

------=_Part_8254_637615256.1518379793706--

------=_Part_8253_62567644.1518379793706
Content-Type: text/html; charset=US-ASCII; 
	name="Proposal for PrimeTest functions.html"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; 
	filename="Proposal for PrimeTest functions.html"
X-Attachment-Id: d96f27ca-fee8-4529-a202-e366d6029277
Content-ID: <d96f27ca-fee8-4529-a202-e366d6029277>

<HTML><HEAD><TITLE>TODO, Proposal for Prime test functions</TITLE></HEAD><BODY>

<CENTER>
<H1><A NAME="TODO, Proposal for prime test functions">Proposal for Prime test functions</A></H1>
</CENTER>

<TABLE ALIGN="RIGHT" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD ALIGN="RIGHT"><B><I>Document number:</I></B></TD>
<TD>&nbsp; TODO</TD>
</TR>
<TR>
<TD ALIGN="RIGHT"><B><I>Date:</I></B></TD>
<TD>&nbsp; TODO</TD>
</TR>
<TR>
<TD ALIGN="RIGHT"><B><I>Project:</I></B></TD>
<TD>&nbsp; Programming Language C++</TD>
</TR>
<TR>
<TD ALIGN="RIGHT"><B><I>Reference:</I></B></TD>
<TD>&nbsp; ISO/IEC IS 14882:TODO(E)</TD>
</TR>
<TR>
<TD ALIGN="RIGHT"><B><I>Reply to:</I></B></TD>
<TD>&nbsp; Alexander Zaitsev</TD>
</TR>
<TR>
<TD></TD>
<TD>&nbsp; Solarwinds</TD>
</TR>
<TR>
<TD></TD>
<TD>&nbsp; zamazan4ik@tut.by</TD>
</TR>
</TABLE>
<BR CLEAR="ALL">

<HR>

<H2><A NAME="Overview">Overview</A></H2>

<p>Programmers sometimes need to check whether the number is prime or not. This task is especially common in cryptography. 
This proposal suggests extending the set of mathematical functions with functions to check whether the number is prime or not.</p>

<H2><A NAME="Design overview">Design overview</A></H2>

<p>This paper proposes two prime-test functions.

<H2><A NAME="cmath">Header <code>&lt;cmath&gt;</code>
synopsis</A></H2>

<pre><code>namespace std {
namespace experimental {

bool is_prime(Integral value) noexcept;

bool is_probable_prime(Integral value, Integral certainty) noexcept;

} /* namespace experimental */
} /* namespace std */
</code></pre>

<B><A NAME="std::is_prime">is_prime</A></B>

<code><pre>bool <b>is_prime</b>(Integral value) noexcept;
</pre></code>

<p>The function tests is a value prime or not. If a value is prime, returns true. Otherwise, false.</p>
<p>Complexity: at least O(sqrt(N)).</p>

<B><A NAME="std::is_probable_prime">is_probable_prime</A></B>

<code><pre>bool <b>is_probable_prime</b>(Integral value, Integral certainty) noexcept;
</pre></code>

<b>Parameters</b>:
<p>certainty - a measure of the uncertainty that the caller is willing to tolerate: if the call returns true the probability that value is prime exceeds (1 - 1/2^certainty).</p>

<p>Returns true if value is probably prime, false if it's definitely composite. If certainty is <= 0, true is returned.</p>
<p>Complexity: TODO</p>

</BODY></HTML>

------=_Part_8253_62567644.1518379793706--

.
