Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123061 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 0A4211A009C for ; Tue, 9 Apr 2024 15:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712678180; bh=GIlt4BszgW9jqFmARHLkz7HI1U9Hoxjlp0F/I+UYyRw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=aM5I57CxGOXmc3AHLg62bcnRxM8JblRU3Uficrz7VPkdUlFPDlBmt7nwp9YLhi9s6 Uz++uwuVIs48Gm+mCEYyEYhi5aqczmohAutGk5e/wbqb9/X++fZOStoavkOdVhQN0s Vp+ynpFx4NzMXVCK5/y0AWlyXEuqlq6gclfdEOLD1zNgcXtsre9XI9Mk7L3c4nOoW5 1G4mCSRPuCoRghYGaFulJYTNUAXGiR8nR8NYiJDCFUgJ5gHxHk4rlRY+6nx2tOftwV rwyaqznDp+eThq2z2E1f0gRbKpIBRlQ8vRVvJOO2WU7bKwcUQJo3A/Qy9G2ci84+f3 s/zDpe/z6qN1g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BF9ED18068B for ; Tue, 9 Apr 2024 15:56:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 9 Apr 2024 15:56:19 +0000 (UTC) Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-6153d85053aso50223667b3.0 for ; Tue, 09 Apr 2024 08:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=interi-co.20230601.gappssmtp.com; s=20230601; t=1712678146; x=1713282946; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=GIlt4BszgW9jqFmARHLkz7HI1U9Hoxjlp0F/I+UYyRw=; b=bzbV/pBbMwDVKoALycutEMTApomfeGMx9OeUBuGL42v1Od+fqnfZBiqDBlIeqkemmY oI2sElT7auQ0iids2HmWJkz0FntOKTDd1Yab8H09XW2nVxepbPfUUtoYzinKjLIRAZaw MVB8q4VeAtSDPngXdcbWVNA0Ix5f/DPk+Yq3jCMe3M04yQ3v202+4E5FLvwV01n2OW2k wVoKLSBMhJLDMtUDHB9/QlRyjAj4LcmTCkFushmAx/00jaLSjhhDrDC0A8iXb9M+m4ov VRTosPS9OmwN1qaNh16dkivPBuU9cdqashMKgnNi3dsPbmshVbojJAj/J6ZXq3TBIdpW ETBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712678146; x=1713282946; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GIlt4BszgW9jqFmARHLkz7HI1U9Hoxjlp0F/I+UYyRw=; b=hlfUXvm8Zm2uT0arKdwUykB69RtUTR60Yhsna1uYmrXWqsydQqT2EIQQI4q/Q2uLVp kopquO0IqCePOo9smBbYT+65HJJUv9M1eiDR5CIPyXPRbHldB4r50mRjvx1yzUVAO00c aHznwVyxoA6PAAxGe9mE5gYJTQFY0UADJZgeThfrEHngYkEcHBy9hG8crWDP1/tJsFEm cFzhBVwVLdOF+lbWA97XL4N6CQ2G+Ea9YQ8sXcyz813q5gTG2VpRsPwzTp9c9Wv6hhtA wvnko0SYxLVIBfC9l7M66Z5gfNihg+9YUuTHMIszpVu4hixrvFWXT9zHBXDvlkb8jfYM i6kA== X-Gm-Message-State: AOJu0YwSAHRw9MWEtC8fhHG5rJHJgT46xaXwbk091+Fgs9ugnLrdFTKj bpxAtsPY/m8RJTu2I3R/ldaRTyDG1t/nm0yBRgTBn6HlKD1ee7HG9UuLtC4dsOFfheqRG6QzOh+ l+yhWf1P5hDLsAjc42U8Kw/FMoaLKaZ+3YsOsh1CsI67D24uF X-Google-Smtp-Source: AGHT+IGaL8G6dXWAzjyddXlASW88EpH2NLFaaxe//dnYHbgKQBZD3iSPP50CYeKsVV34cNft85VABXPA/wxlIj/eIfg= X-Received: by 2002:a25:e811:0:b0:dc7:1d:5db4 with SMTP id k17-20020a25e811000000b00dc7001d5db4mr132183ybd.34.1712678146242; Tue, 09 Apr 2024 08:55:46 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <18c42fdbb30.2831.17a3710df6d58f02ca570cc47e197a63@interi.co> <0f64523d-d949-75ed-682b-789fc33fa3b2@php.net> In-Reply-To: <0f64523d-d949-75ed-682b-789fc33fa3b2@php.net> Date: Wed, 10 Apr 2024 00:55:34 +0900 Message-ID: Subject: Re: [PHP-DEV] Proposal: Arbitrary precision native scalar type To: Derick Rethans Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: alex.pravdin@interi.co (Alexander Pravdin) On Tue, Apr 9, 2024 at 7:52=E2=80=AFPM Derick Rethans wrot= e: > Adding a new native type to PHP will create a large change. Not only is > it "just" adding a new native type, it also means all of the conversions > between types need to be added. This is not a small task. I understand this :) > If you want to use arbitrary precision natives, then a precision and > scale as defined in php.ini defeats the purpose. Every installation can > then potentially calculate things in a different way. > > The only way how to prevent that, is to have *actual* Decimal type, such > as the Decimal type in MongoDB uses (the IEEE 754 decimal128 type): > > - https://www.mongodb.com/docs/mongodb-shell/reference/data-types/#std-la= bel-shell-type-decimal > - https://en.wikipedia.org/wiki/Decimal128_floating-point_format If PHP core experts think that 128-bit decimal will cover the vast majority of cases and is worth implementing, I'm totally for it. If we can implement something standardized then fine. The current thread is not an RFC candidate, but a kinda discussion board to formulate the design principles and strategy. On another note, is it possible to make zval variable size - 64 or 128 bits? So the 128-bit decimal can be a struct that will be held in the stack instead of pointer manipulations. Can it be achieved with the help of macroses? --=20 Best, Alexander