From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by sourceware.org (Postfix) with ESMTPS id D3F3C3858D1E for ; Sat, 30 Mar 2024 18:42:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D3F3C3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D3F3C3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=139.178.84.217 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711824149; cv=none; b=ZfSiJiXS7Hy1kg+Jnt9iqJ3Gp5+tOIef+Mewydk9j465DFLuM0/sP5l+mX2Hj1neMCkhzTphnVlNRKqrlnhFo/kTnMTL8J/Qgquclvc07+MzTKj81hs9Qo6p8v6/FbmgYDcPmaLJpgWkuWeMRl5DFcz9IsvHGkHdlUCATtq2QA8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711824149; c=relaxed/simple; bh=oGWLVkb5q5wGM1fIHJ3jdQ16a+BqQPMX/keXpi84MCc=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=gcLyNJv9FWYXVtPfg1MtUe7jFQy+tQFRt1lT1FTbL40l7nTm+haAUdXQeYeYvLxrAufo8u0CB5boUkqif9wnaKs/jhBJxDJ+4G8KfJ9huVaZtYWymEQmXmPJSgOOI/XSX7EOHqIodiVPcuT5sGSC7L9Hgr0fGZe6a7paoxQ2kQM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5FE4860AF3; Sat, 30 Mar 2024 18:42:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F68EC433F1; Sat, 30 Mar 2024 18:42:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711824147; bh=oGWLVkb5q5wGM1fIHJ3jdQ16a+BqQPMX/keXpi84MCc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AwF+qXUOLByXEcr/KX9RLId4TfIvlKOd/AmcQmqe6kXthz6TVUQDrfpJCpl6TqKuT m4BGjPwMgI9JsELS6BGSoQWzLdJKEL6Luym1+oTjwqoWnU4zWIf15gKzca4KFTU6ix X3ZsaXLF4kTBarexFdhLS/GH0zrIZzFBcls9TO0JzMIJMQPN4mvs9C6YRdABRPMdwR ltl6pHMvI/wkg5W8HFwAWF46girJOXqG6tRSNYqIMdAyTls3yhAvEnI3KXclYAiDtE reXlPeqLuvYipw8Y5HOg2iYYzRr7YuOlCQcEHAm8sXrDeHf19x2Nsc3CxKfIP3o9Fo M0JvKBBOyYrxw== Date: Sat, 30 Mar 2024 19:42:18 +0100 From: Alejandro Colomar To: DJ Delorie Cc: Paul Zimmermann , libc-alpha@sourceware.org Subject: Re: [PATCH v2 3/3] manual: Cube roots are rarely representable Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="JRnZhjFDr9WqCu88" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --JRnZhjFDr9WqCu88 Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Sat, 30 Mar 2024 19:42:18 +0100 From: Alejandro Colomar To: DJ Delorie Cc: Paul Zimmermann , libc-alpha@sourceware.org Subject: Re: [PATCH v2 3/3] manual: Cube roots are rarely representable Hi DJ, On Sat, Mar 30, 2024 at 12:51:35PM -0400, DJ Delorie wrote: > Paul Zimmermann writes: > >> From: DJ Delorie > >> Cc: libc-alpha@sourceware.org > >> Date: Fri, 29 Mar 2024 20:27:44 -0400 > >>=20 > >> Alejandro Colomar writes: > >>=20 > >> > -These functions return the cube root of @var{x}. They cannot > >> > -fail; every representable real value has a representable real cube = root. > >>=20 > >> > +These functions return the cube root of @var{x}. They cannot > >> > +fail; every representable real value has a real cube root, > >> > +and rounding it to a representable value > >> > +never causes overflow nor underflow. > >>=20 > >> Wording is OK but the $subject says the exact opposite... > > > > It is fine to me. The subject says that the cube root of a floating-poi= nt > > number is rarely a floating-point number, which is true: for a p-bit fo= rmat, > > only about 2^(p/3) numbers have an exact cube root. >=20 > Let me rephrase: The $subject does not convey the intent of the patch. > If the patch adds wording that "the result never errors" the subject > should reflect that change, not some other aspect of the issue. >=20 > Something like "Note why cube roots always give representable results." Hmmm. The rationale for the $subject was that the old text, which I'm removing, claimed that "every representable real value has a representable real cube root". I was confronting that claim with reality: cube roots are rarely representable, since they tend to be real numbers, which cannot be represented exactly. What you can do is approximate them to something that can be represented without failing. It's guaranteed that they won't overflow nor underflow, because a cube root is always closer to 1 in absolute value than the number it roots. If you can think of a better subject, please let me know. I have some comments on your suggested one ("Note why cube roots always give representable results"): - It's actually contrary to the intent of the commit, which is removing text that claims that cube roots are representable, which is false. - I admit my commit $subject didn't specify (nor imply) what the new text says. It only says what it does not say (what I'm removing). Also, if I read your intentions, not just your literal text, I think you wanted to say something like Note why cube roots are not always representable, but still these functions always succeed returning an approximation. While that text would not be lying mathematically: it doesn't claim that cube roots are representable while they aren't; it claims that I note _why_. I've explained why in this email: the root is closer to 1 (in absolute value) than the cube, and numbers closer to 1 (and in general, small integers) are the farthest from a float and double overflow or underflow (I won't give more details, as my knowledge of floating point numbers in C begins to end there :) ). But the commit doesn't actually introduce any text to clarify why that happens. It only notes _what_ happens. Have a lovely night! Alex =20 --=20 --JRnZhjFDr9WqCu88 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmYIXQoACgkQnowa+77/ 2zIXyw//S2DU2ffuwpwhyYAPztyrkwfr4h2uZo9W2QAzYNKn2lv8zjR2RyBwsHLS YsM8j5zplk2Ij1YEiVlU6VFh8iD6g66dS66ALBs2miiTNWZ52ufAp5HzK3UrhdZG EHVs7x8lVFvrIHMC/2I7qsh/Skl3jJMPCLUKgR3jnX21dLkEX3jrE5GfXW+QlNDl 8tucscaZFketEJZDmumRl8/LA5eQ14qo3hczIZ6D+2jcyX8vrPlUWkkoqpAryIZx ku830iC9RqVDBeN4pTS8q8Yf2kjKis9Byx/sgVwnl7Efi3hFz7V3d5pHjL7fu8QK ufz14ysbxf93pXimM5iGY7+gy2097jbyYY4s8re9P77Om4GOC6f9uApSdXnOG1qC 0DBvx/ffPWZc3aViPiy8TarNSC8F+o4Plslw79kU3HLUmNZAtvI1feDwwBu8KpyM Spn8rL9ker+a1ap8AkfP452UbbbDinq7/qXXUajK2OccGFkFd3bL5mDAVRSjoRZu dzQ3kRKvcOVR14fL6lPx6HjjB+jLJkV+fm1rHKc/Qs76KBD48PPioP+ABIs+Uape GVTzrorfzmxhxIvzNofUhpOIW88EQKiofgtNW8kzh6/pYlebg4crtAOK3QzAvM0L +u5KnQJU/AJykbpOxMuwbqG7JBrFPTGWY7tU/XtetBPEwGIDgiY= =omNv -----END PGP SIGNATURE----- --JRnZhjFDr9WqCu88--