220 40669 <5BCC2525.90805@gmx.net> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Jens Maurer <Jens.Maurer@gmx.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Function to compute the absolute value of any
 integral value including signed minimums
Date: Sun, 21 Oct 2018 09:05:09 +0200
Lines: 49
Approved: news@gmane.org
Message-ID: <5BCC2525.90805@gmx.net>
References: <3f8200be-918a-44a0-a412-6f8f43da1c51@isocpp.org> <CABPJVnS+UYT9Q-6X3Y_t043==ND38cyA5048c1HjbVkX8q3cEw@mail.gmail.com> <3a5821ae-c386-46b4-8e73-4bff8764679c@isocpp.org> <CABPJVnTNih2bKvp6rVCWBpnv06KYuXDs3M0HwZSU_JPV3oG=8g@mail.gmail.com> <956410ae-7e45-43a7-ae1d-52a92aec6217@isocpp.org> <9d74ddbb-cc68-412a-ae6b-4664660ff12c@isocpp.org> <CAP3wax_-GqPOxaDyd1QKx40Yvj6=MqDn6-1cYrtUw7ObzuJcMg@mail.gmail.com> <CACeCrotMrChHSoswwYpxqRfd9OR2Fsfoz05RwOm3w+aEBqEGQw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1540105387 22183 195.159.176.226 (21 Oct 2018 07:03:07 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 21 Oct 2018 07:03:07 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0.1) Gecko/20110830 Thunderbird/6.0.1
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDPMTYGK64JRBJ6KWDPAKGQEHW5G62A@isocpp.org Sun Oct 21 09:03:03 2018
Return-path: <std-proposals+bncBDPMTYGK64JRBJ6KWDPAKGQEHW5G62A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wr1-f71.google.com ([209.85.221.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDPMTYGK64JRBJ6KWDPAKGQEHW5G62A@isocpp.org>)
	id 1gE7lP-0005fy-0i
	for gclcip-std-proposals@m.gmane.org; Sun, 21 Oct 2018 09:03:03 +0200
Original-Received: by mail-wr1-f71.google.com with SMTP id 88-v6sf30905981wrp.21
        for <gclcip-std-proposals@m.gmane.org>; Sun, 21 Oct 2018 00:05:13 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1540105513; cv=pass;
        d=google.com; s=arc-20160816;
        b=AxsEaHHSy7qZdJ+sXcgSrzn9nzZKXMFEgWRRXbAqE/KCMtyf4amL4zdXiSrfD0uwPL
         a9O3zvO0fTmIpN3PmHGzDD6DvYKfVC0gKutcW/tX+JYX14KOc+HygfyQ0alzikdkM2f9
         N2d5tSx7/z8JtASX3IE1y21V2XX/yeCq6SMyrFUNWNa5GAcofL0Vs+/BQ0tsw+fHN3fQ
         Uqu/VjZUlnbY6rLGWNXr1HIufYbrUEUp7MVsPASqIACybSjMkrHHJ1/C/nMzCILjB+mQ
         yMbMI8SsuPCD9x/FcBnWo1tp2vzFBYfmb9MeI5bhpWKMCvNCxNJ0ZHMjr5PDCrNdMpYn
         9Big==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:content-transfer-encoding
         :in-reply-to:references:subject:to:mime-version:user-agent:from:date
         :message-id:dkim-signature;
        bh=F4+I1+xo/n28w7UG57zd3twourrUnFWMB6z2I2TRDiw=;
        b=vwQaZ13ed+mMGmLGtlwO8F7yTgu2XMfJv0MSBg+XOaICu5/SI80Z+hVp/lBaXkc3cA
         P5mz+CBNlIa3bRE+D3gO8uuITmOGVqY4ryiyI8vLj4gvWOMunxQ7xhoUdP42f7ZsQgKt
         27wilwkZVfYOjF/xwphCvU8QSjEIwT9sX6tdKq+YS+dZ5GoRryi3UFZRC9Haz0B4L1QL
         V/9IT5pOQHLhi2calx8ljt5Lzcipg3ukgPeNVcwK0XXOLfROulvFvb/sQY2LAkol3LLp
         i/gpfcZu+OcH/nMRFCxZ+LuB2/P7w1Kz6Y6PjjE/h8RV2yftjfPz0pRm63o7o09Nn1C3
         qtWQ==
ARC-Authentication-Results: i=2; mx.google.com;
       spf=pass (google.com: domain of jens.maurer@gmx.net designates 212.227.17.22 as permitted sender) smtp.mailfrom=Jens.Maurer@gmx.net
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=message-id:date:from:user-agent:mime-version:to:subject:references
         :in-reply-to:content-transfer-encoding:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=F4+I1+xo/n28w7UG57zd3twourrUnFWMB6z2I2TRDiw=;
        b=K0dEieHfb51GV0tsPzCB7XR+Fz6P3f9mkkjnPViX9E5bpCBe76b83Bcb3LMZYaBIsY
         vlE3d3su6t+F4cxY5OfPnvFhTHuZ1qc9an0QuIMq5e3zVoj3anqlC1Zj+FqtNLZrs92I
         3gYx/txMHj71ikkcSBjxzdmtIAA4uKRxNkCFqMFj9PVvnEAYQD0oktmAfjr8fIOLkGVm
         TWwkfGj0c0fF77KY5eC2gu3bZD8BtLoqpWtbpvZaZ+svkYsA89pG3hwRsuX/alScXtJi
         bKG0ErayvkbrF5UGV6VZ6CqeomPllj0vK7VVktF3JBBVwEWr/WC71vfj8gFmLoJoLsA5
         QW9A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to
         :subject:references:in-reply-to:content-transfer-encoding
         :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=F4+I1+xo/n28w7UG57zd3twourrUnFWMB6z2I2TRDiw=;
        b=NmUIrzdNiXoc2CJGwVamX+m40XYQEgnSHI4yBt9MjGldSMUH0M6/xZpy5siBFXB2Fv
         1TD3rY5K6/9HYSUr7rYDq/Pmi9ZqvsJ4RNwU6oZlHjhKZ5lgOhkybANp6VTvTyK/1Q+S
         xU4rg1fsRjwzMEu8KGrHshJnpbok3dgidM6qOe7nhslGZr6rNpK7jHfwlsIHPWOiK+JG
         NkDmDdT6K6BVGtGiLFlmeRGR5e8CQYY0Fe1V3izVW9i4LFzv49TDxabGD74GxR6A3qBl
         Mtadvhl2YQ6tcxrgESCbJHNWPEk5hMRAvuJczIuHQiZxmx4IxGinNjtYLuExB1tgvBPq
  
X-Gm-Message-State: ABuFfojhSFZZWdH9Sux/G/a9Kzsst15TOEugGT6BADKnZui1+TgZkxp6
	g7oMvH+FhUJZKyFVCEqTA9ISXw==
X-Google-Smtp-Source: ACcGV61JbQ/eCLR99dOM2S3D0Pw290TxMGZQG0mINqg/nyIUxx9/C3UGVub7Tr2I7zfdZW5oGcNbeA==
X-Received: by 2002:a1c:9655:: with SMTP id y82-v6mr1044597wmd.3.1540105513057;
        Sun, 21 Oct 2018 00:05:13 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a5d:4e85:: with SMTP id e5-v6ls4085349wru.26.gmail; Sun, 21
 Oct 2018 00:05:11 -0700 (PDT)
X-Received: by 2002:a5d:514d:: with SMTP id u13-v6mr13564541wrt.299.1540105511365;
        Sun, 21 Oct 2018 00:05:11 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1540105511; cv=none;
        d=google.com; s=arc-20160816;
        b=H8v+RZh9v35gvs1cV0VFcri5TRjC1l7pw5M89xhPMvaPE814CUY8Sqy/mD/RfcLAwa
         chtLVeK/fLIxyhS1ggnhYYXEHDIPXO3vu2xamPTCVtRE/vETn7NhVlAiyxqPKXV7uPD9
         ZLpTFichkhjszDS05AE/FQNPI36ZMPLm301jAkCZd4H8JrdEeRM7DB7L+zz5c2T6Qb/O
         pYBkEw2G0A94nAljwg66sovWU8x7u58GOb/AK0V0TDRmbMSPZxi2vrL0Iip3h62a5UiJ
         W9QE1Kz4SjINjQDRza3HCqKzgQHSBl9EDmiTnx08q3XDToDFkUsEwVmIaPg43LsEHEAB
         mFuA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:in-reply-to:references:subject:to
         :mime-version:user-agent:from:date:message-id;
        bh=v1j5j2FRCDJUXeVSjq/C3DQMHEy7lkCe328Q9yn0aMA=;
        b=IEHuWF7/5UioLVcJ4Ysekao7ZIr+lA9i5PE+R8RSArbOYsEsiT8x1xEZMHBmzNFOrO
         5NZW3ecpSy14jvmVN8iFPfyqKX8cokQ8/gktlxpErXD/WBwsYfid4BrN+YJmFI4thF/n
         cScI7Pr/Fc+aL3Ts1twHG/WzAHg7Bq5EI/p42/5SkYiwtCeirakBEFXC6UxCkUoNEbyz
         Fgd2S3jFw22e7dV5BkaN25LzD2nKhUhT+yoNXNjQRTsQTLozndou09jd5Y2jm1ALHspO
         khbOdP/OE3wT0n5QdqHgrCVuPcFJgIoDF9lp+TjqKbaLSx7v1bE3SXni8jJMO0hKBhzV
         RqZw==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of jens.maurer@gmx.net designates 212.227.17.22 as permitted sender) smtp.mailfrom=Jens.Maurer@gmx.net
Original-Received: from mout.gmx.net (mout.gmx.net. [212.227.17.22])
        by mx.google.com with ESMTPS id j204-v6si7107928wma.24.2018.10.21.00.05.11
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 21 Oct 2018 00:05:11 -0700 (PDT)
Received-SPF: pass (google.com: domain of jens.maurer@gmx.net designates 212.227.17.22 as permitted sender) client-ip=212.227.17.22;
Original-Received: from [192.168.2.101] ([92.208.230.11]) by mail.gmx.com (mrgmx101
 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MIzGn-1gCCvH1X6P-002bvt for
 <std-proposals@isocpp.org>; Sun, 21 Oct 2018 09:05:10 +0200
Original-Received: from [192.168.2.101] ([92.208.230.11]) by mail.gmx.com (mrgmx101
 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MIzGn-1gCCvH1X6P-002bvt for
 <std-proposals@isocpp.org>; Sun, 21 Oct 2018 09:05:10 +0200
In-Reply-To: <CACeCrotMrChHSoswwYpxqRfd9OR2Fsfoz05RwOm3w+aEBqEGQw@mail.gmail.com>
X-Provags-ID: V03:K1:i9RSKy0emyCn8KXF9/TlY7eSW+3eVmKccR76NVaL6ylvcEnGEft
 orHPXYSUq2OO9tNJLItquCVCEHom+Fkrp+vGWBb65uI45PjUy+eDhQQd3X+e0vLKyhmSq7V
 X9Sai+mCIgxx9SVHnUdWFLLoba1imx1TGeq0ZDEfFauhhvMGUfQJ8qoV2LcbB8tanPJrdu6
 EQLY24h3+djhWB0XW0NMQ==
X-UI-Out-Filterresults: notjunk:1;V01:K0:mzwpgKbzLfI=:gicQZz7hzZT7N6/UAnu/gw
 HvzedEqxrpF1ABZGJuGJf2XrD6r9qd6zG4vFTbYUNYYidOD6CNTru5li84s9n5k08uL4CK5q6
 w7Dt9+8Es/QY4RhTxKSHbCFLekcNJTKRwetH4lFIzBhNLsVtruqtxcTuIgemmuHaoyReyC6+y
 nnULbEuOKG000yZEq+zEyaOG6dihrjG1XUCtqd0ifUh7joDlvxvRkU5d7v7wKBukIghzEEKFl
 O2pcfRh15KRdx6DacN22uscjdlzuKJmltf0EqZjrtIAWv5EfOtxDA+A/f3G581ju4R45+4SNv
 QS37i1y4l/dU3SBYClNijHvNy5xz89nWSyeZX8rEimdyeX5J0bb1HAU6cP0/x35sYAhjRMjUg
 AeZ264/iY08XMSN2Fgmcl2GuxVKB4XDX+TZn+iLokXPJ/qswYHR7XQvTZdnzGwkFm2a9PusQQ
 NC+FUuVD2d++u0QC6iaYhG/q1wjjdOk9+TMszB0lXRhWyvfWfyRdLqOcoLtvj+KWRQvag9X+X
 hFDfR4d4EI7M8sJkSpuejZo9t7eV7VthMINJSD9iLqqgk/mHQHDqTInSi/0NUzJ5nFd0/IzSj
 Wv2FoA6aFPQMUevPaC4dmVL7lerPtaB07U945FjD8MOL9ahgkBJ+Tucxc2lBPMTlztahjCLhN
 JCufkBRx6U13ShsbICTP+5qO5TtasO3+6Tzy7/1TmCEC5jY1b8FbW7YOpHgxzshdHQFXQXbN+
 7fWYNmQ5wTgMfJYHNg82Jfhh3m8DbREOR+IjARDSRvig4hBdH0xvfm0LZf42m/uZbtzWEC8B 
X-Original-Sender: Jens.Maurer@gmx.net
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of jens.maurer@gmx.net designates 212.227.17.22 as permitted sender) smtp.mailfrom=Jens.Maurer@gmx.net
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:40669
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/40669>

On 10/21/2018 12:52 AM, JF Bastien wrote:
>=20
>=20
> On Sat, Oct 20, 2018 at 1:00 PM Bryce Adelstein Lelbach aka wash <brycele=
lbach@gmail.com <mailto:brycelelbach@gmail.com>> wrote:
>=20
>     JF? (See question below)
>=20
>     On Sat, Oct 20, 2018, 7:27 AM <burningorca@gmail.com <mailto:burningo=
rca@gmail.com>> wrote:
>=20
>         I recently read that their is a paper suggesting integers always =
being twos complement should be standardised. If this is the case, would th=
e call to the existing std::abs(std::numeric_limits<SignedType>::min()) bec=
ome well defined behaviour?
>=20
>=20
> http://wg21.link/p0907
>=20
>     /Status-quo/ If a signed operation would naturally produce a value th=
at is not within the range of the result type, the behavior is undefined. T=
he author had hoped to make this well-defined as wrapping (the operations p=
roduce the same value bits as for the corresponding unsigned type), but WG2=
1 had strong resistance against this.

In particular, the wording surrounding std::abs in the C++ standard is unch=
anged

"Effects: The abs functions have the semantics specified in the C standard =
library
for the functions abs, labs, llabs, fabsf, fabs, and fabsl."

and C says

"The abs, labs, and llabs functions compute the absolute value of an intege=
r j.
If the result cannot be represented, the behavior is undefined."

Jens

--=20
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 e=
mail 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/5BCC2525.90805%40gmx.net.

.
