220 26351 <CABPJVnRchMhpJ31FjGo9NW5tvwJUP8KuExBRtc_yXNJGsqU7hA@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: John McFarlane <mcfarlane.john@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: On P0037 - Fixed-Point Real Numbers
Date: Mon, 20 Jun 2016 13:17:02 -0700
Lines: 127
Approved: news@gmane.org
Message-ID: <CABPJVnRchMhpJ31FjGo9NW5tvwJUP8KuExBRtc_yXNJGsqU7hA@mail.gmail.com>
References: <navth1$67p$1@ger.gmane.org> <201606200924.36959.marc.mutz@kdab.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=94eb2c128ec233d31c0535bb630b
X-Trace: ger.gmane.org 1466453837 5475 80.91.229.3 (20 Jun 2016 20:17:17 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 20 Jun 2016 20:17:17 +0000 (UTC)
Cc: std-proposals@isocpp.org, Robert Ramey <ramey@rrsd.com>, 
	mcfarlane.john+fixed-point@gmail.com
To: Marc Mutz <marc.mutz@kdab.com>
Original-X-From: std-proposals+bncBDS7B7WQUYOBBP46UG5QKGQEPMOJQZI@isocpp.org Mon Jun 20 22:17:10 2016
Return-path: <std-proposals+bncBDS7B7WQUYOBBP46UG5QKGQEPMOJQZI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f198.google.com ([209.85.161.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDS7B7WQUYOBBP46UG5QKGQEPMOJQZI@isocpp.org>)
	id 1bF5d3-0006BI-7I
	for gclcip-std-proposals@m.gmane.org; Mon, 20 Jun 2016 22:17:05 +0200
Original-Received: by mail-yw0-f198.google.com with SMTP id v77sf46995083ywg.1
        for <gclcip-std-proposals@m.gmane.org>; Mon, 20 Jun 2016 13:17:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :cc:x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=IS8BRrRNWpVJ8PZOSqkuYweDV/5Ft9eeo2agtAksRF4=;
        b=ZvXFTXbp1mRA28qlrJuktJCtt6gjs25xXkrJ6GVT+ldxklvbj3EpvvWSdcFU/j2mLb
         05Yb3ob0ANHXCmIC5U3Ll77aObpGa6rvfy22+VC7lWz8wlpwT/jzvvofsHA5e1xexo5I
         IXec6pL3S/Lupc2Y1u3vc1ybQmtzmdUI4uKLvmz1oLeiAwXmVCUzvx7X1H6MUcEMvXs8
         PzCDUSIc6u3dd3WBJ6Da2B8g16DWTZH7rz21ZOj142TSawYNBFT86Z2OIFI+uXlaTYgC
         DFbc2Q54kdGmM/6VQhmbNV409wY9Zp9cDfwuToWJqauXEzhf/cn6Nju+MP7PvtTx588K
         M8LQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:cc:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=IS8BRrRNWpVJ8PZOSqkuYweDV/5Ft9eeo2agtAksRF4=;
        b=hiYqMX/ZtjXg67r8tLLl00kZfbkEmlkDpzhZutcckMmxhHq8xhKv26/xH1kF428vSq
         k0uywsLf+RC2/ZPxVxPzQgNjiw9G8Olol9FUbRWbh/O0sC1KLelVyabMpDk4rrxtTUEZ
         4Z6YUZJJb0h2VKsz2rj99wDp45+UlpF2JPYMVOXjtAHNds5VVQqT36Z6Lrr5pfGO4w1L
         S2Ar4kp/HxRNtFu3k32kZ8rAq4cjoW7rEo+PGM7sBQhOFexOBn2GeOjUwSGM8Jwk5wKH
         Clg3DxtE+uyFrUgiTaH3CIx3j1iyr5emaGBQaNFPZB0xd1E0IJKEkixWVxJt0Y/X7ZET
         rnOg==
X-Gm-Message-State: ALyK8tK0JhPDQOeuAt5qV+Al0PFuvFDb07T/F5xsaqpM8y0zsmJYYjyPxgtqifBIhOXCRA==
X-Received: by 10.237.36.121 with SMTP id s54mr20872092qtc.12.1466453824200;
        Mon, 20 Jun 2016 13:17:04 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.43.181 with SMTP id u50ls2794957ota.58.gmail; Mon, 20 Jun
 2016 13:17:03 -0700 (PDT)
X-Received: by 10.129.109.147 with SMTP id i141mr2268121ywc.220.1466453823250;
        Mon, 20 Jun 2016 13:17:03 -0700 (PDT)
Original-Received: from mail-yw0-x22e.google.com (mail-yw0-x22e.google.com. [2607:f8b0:4002:c05::22e])
        by mx.google.com with ESMTPS id a5si7083453ywg.369.2016.06.20.13.17.03
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 20 Jun 2016 13:17:03 -0700 (PDT)
Received-SPF: pass (google.com: domain of mcfarlane.john@gmail.com designates 2607:f8b0:4002:c05::22e as permitted sender) client-ip=2607:f8b0:4002:c05::22e;
Original-Received: by mail-yw0-x22e.google.com with SMTP id b72so22956842ywa.3
        for <std-proposals@isocpp.org>; Mon, 20 Jun 2016 13:17:03 -0700 (PDT)
X-Received: by 10.129.164.145 with SMTP id b139mr10706087ywh.171.1466453823047;
 Mon, 20 Jun 2016 13:17:03 -0700 (PDT)
Original-Received: by 10.37.15.133 with HTTP; Mon, 20 Jun 2016 13:17:02 -0700 (PDT)
In-Reply-To: <201606200924.36959.marc.mutz@kdab.com>
X-Original-Sender: mcfarlane.john@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 mcfarlane.john@gmail.com designates 2607:f8b0:4002:c05::22e as permitted
 sender) smtp.mailfrom=mcfarlane.john@gmail.com;       dmarc=pass (p=NONE
 dis=NONE) header.from=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:26351
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26351>

--94eb2c128ec233d31c0535bb630b
Content-Type: text/plain; charset=UTF-8

If `fixed_point` took a `ratio` object, its range would be reduced to the
range of `maxint_t`. Here's an example of functionality what would not be
possible with such a limitation: [
https://github.com/johnmcfarlane/fixed_point/blob/5d1a016b865ecbcf8479059fdabae9406cff984a/src/test/index.cpp#L94
].

On Mon, Jun 20, 2016 at 12:24 AM, Marc Mutz <marc.mutz@kdab.com> wrote:

> On Sunday 28 February 2016 23:49:04 Robert Ramey wrote:
> > integer part + fractional part where fraction part is any integer.
>
> ... or a std::ratio<>. I don't quite like that we'll have two independent
> fixed-point implementations in the standard: duration and fixed_point.
>
> I'm sure this has been discussed, but P0037R2 doesn't contain anything
> about
> <ratio>.
>
> So I'd like to ask why a fixed_point is represented by an exponent, and
> not a
> std::ratio object:
>
>    using dollars = fixed_point<int, ratio<1,100>>; // in units of cents
>
> Though maybe then the fixed_point name is no longer so good, and something
> containing "discrete" might be better.
>
> If the answer is "we want to restrict to an integer number of bits for
> performance", then the counter-argument would be that that can be done
> using
> specialisation of the operations based on whether the std::ratio is of the
> form 2^-N for some N.
>
> Thanks,
> Marc
>
> --
> Marc Mutz <marc.mutz@kdab.com> | Senior Software Engineer
> KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
> Tel: +49-30-521325470
> KDAB - Qt, C++ and OpenGL Experts
>

-- 
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/CABPJVnRchMhpJ31FjGo9NW5tvwJUP8KuExBRtc_yXNJGsqU7hA%40mail.gmail.com.

--94eb2c128ec233d31c0535bb630b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">If `=
fixed_point` took a `ratio` object, its range would be reduced to the range=
 of `maxint_t`. Here&#39;s an example of functionality what would not be po=
ssible with such a limitation: [<a href=3D"https://github.com/johnmcfarlane=
/fixed_point/blob/5d1a016b865ecbcf8479059fdabae9406cff984a/src/test/index.c=
pp#L94">https://github.com/johnmcfarlane/fixed_point/blob/5d1a016b865ecbcf8=
479059fdabae9406cff984a/src/test/index.cpp#L94</a>].<br></div><div class=3D=
"gmail_quote"><br>On Mon, Jun 20, 2016 at 12:24 AM, Marc Mutz <span dir=3D"=
ltr">&lt;<a href=3D"mailto:marc.mutz@kdab.com" target=3D"_blank">marc.mutz@=
kdab.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex">On Sunday 28 February 2016 23:49:04 Robert Ramey wrote:<br>
&gt; integer part + fractional part where fraction part is any integer.<br>
<br>
.... or a std::ratio&lt;&gt;. I don&#39;t quite like that we&#39;ll have two=
 independent<br>
fixed-point implementations in the standard: duration and fixed_point.<br>
<br>
I&#39;m sure this has been discussed, but P0037R2 doesn&#39;t contain anyth=
ing about<br>
&lt;ratio&gt;.<br>
<br>
So I&#39;d like to ask why a fixed_point is represented by an exponent, and=
 not a<br>
std::ratio object:<br>
<br>
=C2=A0 =C2=A0using dollars =3D fixed_point&lt;int, ratio&lt;1,100&gt;&gt;; =
// in units of cents<br>
<br>
Though maybe then the fixed_point name is no longer so good, and something<=
br>
containing &quot;discrete&quot; might be better.<br>
<br>
If the answer is &quot;we want to restrict to an integer number of bits for=
<br>
performance&quot;, then the counter-argument would be that that can be done=
 using<br>
specialisation of the operations based on whether the std::ratio is of the<=
br>
form 2^-N for some N.<br>
<br>
Thanks,<br>
Marc<br>
<span class=3D""><font color=3D"#888888"><br>
--<br>
Marc Mutz &lt;<a href=3D"mailto:marc.mutz@kdab.com">marc.mutz@kdab.com</a>&=
gt; | Senior Software Engineer<br>
KDAB (Deutschland) GmbH &amp; Co.KG, a KDAB Group Company<br>
Tel: <a href=3D"tel:%2B49-30-521325470" value=3D"+4930521325470">+49-30-521=
325470</a><br>
KDAB - Qt, C++ and OpenGL Experts<br>
</font></span></blockquote></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/CABPJVnRchMhpJ31FjGo9NW5tvwJUP8KuExBR=
tc_yXNJGsqU7hA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CABPJVnRchMhpJ31F=
jGo9NW5tvwJUP8KuExBRtc_yXNJGsqU7hA%40mail.gmail.com</a>.<br />

--94eb2c128ec233d31c0535bb630b--

.
