Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120375 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90209 invoked from network); 21 May 2023 12:18:33 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 21 May 2023 12:18:33 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B94761804D7 for ; Sun, 21 May 2023 05:18:31 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 21 May 2023 05:18:31 -0700 (PDT) Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-3f42c865535so50332375e9.1 for ; Sun, 21 May 2023 05:18:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684671510; x=1687263510; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=B/NdVaGo7XUXo8XskwghUKwnBFmGJ17zs7scJTVR/J4=; b=bOxYWeL5u3WEFanYrybzxrRQpt4ol/iA9FZkhIAFrc3/ykk9IZGxXhqvK3eyRNuXY/ qSs66EpBSgTaEoJ+8ijXnT/L/OzWWE8vzdfS5dvUrBnd+2cFINVKQIF1mnxaL1DUEWTa Zdfru4Sdm7Tx8e9EDk3X8OmzGGGhdNEIN8HczXPSn5SxNYysA7zTJviXznHAKr0RMCxJ mH3kuDVADgf31JQ4TyZt3SSaaUzO3UP1s1czzjy8ynrf8M6dqyAyudXTYS/MibD0gh5e hxyPeRBJELLO4fOTKcwCUwljgFzlothW/T0m88GzYQXTRSTcy53aSPomLF7Z3Ah8ERgH RblA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684671510; x=1687263510; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=B/NdVaGo7XUXo8XskwghUKwnBFmGJ17zs7scJTVR/J4=; b=NHYYgp3F0LW2JwF8o3vdskebmg5dQxS9U64421NYUjbkrGaCgtrs0KbPic99gzIV8x sD2Z87TNea6d90Go7jdqXntto8TufJb9eRQVeElDdc4jKZJciUlqqc37F5/ep8L/XENw dydrCPE79NbTeNJCoUIaQQTtzMUrrdFD7FNHWth0yXCwyZAVP+3W2h0CRXjrchhHeUsI VPivrwigpQ0PPz1GLrDNQdIKQNJYMUfMWXDQsmsY3p2xz6d9Vrxezw9gk4wgUz4YW18t 5MVY4z1mq0iqPOfoyV+sBvzAac4w+vwX6obFxhoIhuUt/9zrEovMVRAFqdzWnIFz7/LP wcRQ== X-Gm-Message-State: AC+VfDyqiwWPyuRIxrXvP5gpZV91ZsxxXyIuWywSOwQBM614tWLZu2bT 0GIBclndrxLaIApl3TvntAw/yF+RGfM= X-Google-Smtp-Source: ACHHUZ6kazn+sAVF5rT4U5eLG0KR2C91W/P5a2mObMc4kWTdRJtMqqsS5psndpuy/jY1+UN0WnlwxA== X-Received: by 2002:a05:600c:299:b0:3f1:952a:4bf0 with SMTP id 25-20020a05600c029900b003f1952a4bf0mr5635567wmk.33.1684671509924; Sun, 21 May 2023 05:18:29 -0700 (PDT) Received: from [127.0.0.1] (cpc83311-brig21-2-0-cust191.3-3.cable.virginm.net. [86.20.40.192]) by smtp.gmail.com with ESMTPSA id c6-20020a5d4f06000000b002e5f6f8fc4fsm4532320wru.100.2023.05.21.05.18.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 21 May 2023 05:18:29 -0700 (PDT) Date: Sun, 21 May 2023 13:18:28 +0100 To: internals@lists.php.net User-Agent: K-9 Mail for Android In-Reply-To: References: <05b7e019-27d4-e6a9-2088-f712c22317a9@mabe.berlin> Message-ID: <4D8DE606-5E99-4D6F-962E-CBE1392C4B94@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] rounding integers From: rowan.collins@gmail.com (Rowan Tommins) On 21 May 2023 13:00:30 BST, Dan Ackroyd wrote: >On Sun, 21 May 2023 at 06:16, Marc wrote: >> >> Do you think this could be an acceptable BC-break > >No=2E Suggesting changing a 30 year old maths operations is a huge BC bre= ak=2E > >> or should this be a different function? > >Just make your own that does precisely what you want=2E=2E=2E I agree on the first point, but disagree on the second=2E It's far too lat= e to change round() itself, but the lack of built-in functions for converti= ng to int in a controlled way is frustrating, particularly as the fashion m= oves towards stronger typing in general=2E On the surface, it sounds like a trivial operation, but there's a lot of e= dge cases to think about (limits of FP precision, negatives including negat= ive zero, etc), and shipping a robust implementation of int_round, int_floo= r and int_ceil in core would save everyone having to rediscover them the ha= rd way=2E Regards, --=20 Rowan Tommins [IMSoP]