Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123044 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 C23C11A009C for ; Mon, 8 Apr 2024 14:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712587833; bh=0VgL5bi0qMhwahLvlyDhIT6gxtUK/kK0D+QO+zCR8mg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=eKkGs/mypaMHh4WLO+RJLgMafAEgBM1/8PXhPS9H78wB6bclQTJdxaxZK/99cy4L6 LslsAY6OKuj0tfoDW3HuVRH/QGAEgmMtL5vfQ2a1CQbZyYy0iC4cc+s076rFRJHngn WS8Q8ySCNI5oUYZ5HwTRUagO0o8KEAVM7g8U7NYHqvojof1nnjCCqHIF1lEKpscWlC +ClDHCeeqAi+ticUn6xoU/Bddtaj4y/DUHK3PuD9tpki7ykgTi4xfmiqSoiltAdJbM GWHnwgBDBBwEdF9pgoaxfH5izQ6YYCKtxKQoooRPlnmoLSkxladBZeAfE9rF7/yuYE Kgn9a2P6vtmiA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4E581180084 for ; Mon, 8 Apr 2024 14:50:33 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 ; Mon, 8 Apr 2024 14:50:32 +0000 (UTC) Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-343f62d8124so2141748f8f.2 for ; Mon, 08 Apr 2024 07:50:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712587800; x=1713192600; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0VgL5bi0qMhwahLvlyDhIT6gxtUK/kK0D+QO+zCR8mg=; b=VxgNjsi8RimbmfuFT5tZsKMBOu3NGcxk+zwSqCPmJEs/zxCJoltLUWFPQNJFiF5R0A 2fCEE+3je/m992oYZMKDWKevAMmRiqEwobL7OEPklHzSUofBFtE74+MktDgdI5kd4aZo f3vtUCHCmdGu+PynXqKp9ofr0Swbgw6EcIv6eY7TLsEOGk3jryj99GI0M8qbynHInpu+ fMr7qsrs4s3xkrh7IQ+jlv1SqSHEvnxhcrehjj5uEFDdQX0EoKYu3G+oMroqbL/bIrJ4 Yrsv2Lbq94aBg6JG0nHst5yXqvlWzdI9QTBhhkz1nf2A9j3Ja+4h+m0+mI2vQiSTejh0 Mu7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712587800; x=1713192600; h=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=0VgL5bi0qMhwahLvlyDhIT6gxtUK/kK0D+QO+zCR8mg=; b=g/otGvFxh9wpM0kaYQtey2zoGudtU9oROL+qmJFlG2jbidxvTQpabesp7MW7Smnirv l/azawo9WGBX+BHplyUOOZcnKHE73rX3hM9E8fh978qPeDdzhQa5gI9tpCO5Q0jlVTfa hO/WbQAST2ouMHCWV9g2fcZffk3UHfUBrLRRw6lcub6Kyn9+suazrwxKDNBnMao+A0Af GdbVfKaoOPP+Zhi6bVEMI2Yd+pzUQg/7D4RiAfV4DWwzjF8gjrGvIZWQyjNjQ0jZrO+O szrQ1dFK/1JKr0U1UtBNL26tZyRsW3rnI0KQLpUkM9Bocm9Flx6Sui/0YJXZ4INWa09S +OPQ== X-Gm-Message-State: AOJu0YwfbYuqoCjp39EWJ1Zoou9Njsc6hWmvu4dJAzd/8R831P7UHWzr h1K/UzlRMb6mtMY3M514bYsNjBw2ZM4lfxuZWEHAlLJLeVvOALUzJ7MNhWyfCiwv4LyAKW2rB75 y3iJq1pQiKePvf8VVTWXoVKSIfpkhTj1T X-Google-Smtp-Source: AGHT+IEcPyE3zhEhNnlbeY/2OefgVJ4CvXeDTmTd5w+ouYBco24y8QdJqgP2wHMnLle7Wnq82SojQRXKfXgBuzwRQP4= X-Received: by 2002:a05:6000:174e:b0:343:3db9:6602 with SMTP id m14-20020a056000174e00b003433db96602mr5800108wrf.66.1712587799929; Mon, 08 Apr 2024 07:49:59 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <40553F28-2EC2-475A-BD8E-1D6517AA2A51@rwec.co.uk> <2B518F62-B774-45C9-82A2-EF6653AAE34E@sakiot.com> <57c268e9be57edad86155c461b0fd181@gliadin.co.uk> In-Reply-To: Date: Mon, 8 Apr 2024 17:49:48 +0300 Message-ID: Subject: Re: [PHP-DEV] Native decimal scalar support and object types in BcMath - do we want both? To: "Rowan Tommins [IMSoP]" Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000007631a8061596eb52" From: arvids.godjuks@gmail.com (Arvids Godjuks) --0000000000007631a8061596eb52 Content-Type: text/plain; charset="UTF-8" On Mon, Apr 8, 2024, 16:40 Rowan Tommins [IMSoP] wrote: > On Mon, 8 Apr 2024, at 13:42, Arvids Godjuks wrote: > > The ini setting I was considering would function similarly to what it does > for floats right now - I assume it changes the exponent, thereby increasing > their precision but reducing the integer range they can cover. > > > If you're thinking of the "precision" setting, it doesn't do anything > nearly that clever; it's purely about how many decimal digits should be > *displayed* when converting a binary float value to a decimal string. In > recent versions og PHP, it has a "-1" setting that automatically does the > right thing in most cases. > https://www.php.net/manual/en/ini.core.php#ini.precision > > The other way around - parsing a string to a float, including when > compiling source code - has a lot of different compile-time options, > presumably to optimise on different platforms; but no user options at all: > https://github.com/php/php-src/blob/master/Zend/zend_strtod.c > > Regards, > -- > Rowan Tommins > [IMSoP] > Thanks for the info. Then we just specify the value range for the decimal the same way it's done for integer and float and let developers decide if it fits their needs or they need to use BCMath/Decimal/GMP extensions. Develop for the common use case for the core, let extensions take the burden of the rest. > --0000000000007631a8061596eb52 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Mon, Apr 8, 2024, 16:40 Rowan Tommins [IMSoP] <<= a href=3D"mailto:imsop.php@rwec.co.uk">imsop.php@rwec.co.uk> wrote:<= br>
On Mon, 8 Apr 2024= , at 13:42, Arvids Godjuks wrote:
The ini setting= I was considering would function similarly to what it does for floats righ= t now - I assume it changes the exponent, thereby increasing their precisio= n but reducing the integer range they can cover.

If you're thinking of the "precision" s= etting, it doesn't do anything nearly that clever; it's purely abou= t how many decimal digits should be *displayed* when converting a binary fl= oat value to a decimal string. In recent versions og PHP, it has a "-1= " setting that automatically does the right thing in most cases. https://www.php.net/manual/en/ini.core.php#ini.pr= ecision

The other way around - parsing a s= tring to a float, including when compiling source code - has a lot of diffe= rent compile-time options, presumably to optimise on different platforms; b= ut no user options at all: https://gith= ub.com/php/php-src/blob/master/Zend/zend_strtod.c

Regards,
--
Rowan Tommins
[IMSoP]

Thanks for the info. Then we just specify the value range for the dec= imal the same way it's done for integer and float and let developers de= cide if it fits their needs or they need to use BCMath/Decimal/GMP extensio= ns.

Develop for the comm= on use case for the core, let extensions take the burden of the rest.
=
--0000000000007631a8061596eb52--