* [PATCH] [gdb/testsuite] Fix pi approximation
@ 2026-01-26 12:41 Tom de Vries
2026-02-02 17:29 ` Kevin Buettner
0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2026-01-26 12:41 UTC (permalink / raw)
To: gdb-patches
In gdb.dap/ada-non-ascii/prog.adb, I came across the following:
...
π : Integer := 3; -- The Indiana Approximation.
...
This article [1] explains the background behind the comment: the Indiana pi
bill.
Given that the common interpretation seems to be that the bill implies that
π == 3.2 [2]:
...
The bill ... has been claimed to imply a number of different values for π,
although the closest it comes to explicitly asserting one is the wording "the
ratio of the diameter and circumference is as five-fourths to four", which
would make π = 16⁄5 = 3.2, ... .
...
change the type to float, and set it to 3.2.
Luckily, in this particular case, changing the approximation of π has no
effect, so the test-case still passes :) .
Tested on x86_64-linux.
[1] https://en.wikipedia.org/wiki/Indiana_pi_bill
[2] https://en.wikipedia.org/wiki/Approximations_of_pi#Indiana_bill
---
gdb/testsuite/gdb.dap/ada-non-ascii/prog.adb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.dap/ada-non-ascii/prog.adb b/gdb/testsuite/gdb.dap/ada-non-ascii/prog.adb
index 7853be5eff8..b2885b3759e 100644
--- a/gdb/testsuite/gdb.dap/ada-non-ascii/prog.adb
+++ b/gdb/testsuite/gdb.dap/ada-non-ascii/prog.adb
@@ -16,7 +16,7 @@
with Pack; use Pack;
procedure Prog is
- π : Integer := 3; -- The Indiana Approximation.
+ π : Float := 3.2; -- The Indiana Approximation.
φ : constant := 7; -- Not even close.
begin
Do_Nothing (π'Address); -- BREAK
base-commit: 449035c35f2169e0c690d83f28306275ab7f7463
--
2.51.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] [gdb/testsuite] Fix pi approximation
2026-01-26 12:41 [PATCH] [gdb/testsuite] Fix pi approximation Tom de Vries
@ 2026-02-02 17:29 ` Kevin Buettner
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Buettner @ 2026-02-02 17:29 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches
On Mon, 26 Jan 2026 13:41:12 +0100
Tom de Vries <tdevries@suse.de> wrote:
> From: Tom de Vries <tdevries@suse.de>
> To: gdb-patches@sourceware.org
> Subject: [PATCH] [gdb/testsuite] Fix pi approximation
> Date: Mon, 26 Jan 2026 13:41:12 +0100
>
> In gdb.dap/ada-non-ascii/prog.adb, I came across the following:
> ...
> __ : Integer := 3; -- The Indiana Approximation.
> ...
>
> This article [1] explains the background behind the comment: the Indiana
> pi bill.
>
> Given that the common interpretation seems to be that the bill implies
> that __ == 3.2 [2]:
> ...
> The bill ... has been claimed to imply a number of different values for
> __, although the closest it comes to explicitly asserting one is the
> wording "the ratio of the diameter and circumference is as five-fourths
> to four", which would make __ = 16___5 = 3.2, ... .
> ...
> change the type to float, and set it to 3.2.
>
> Luckily, in this particular case, changing the approximation of __ has no
> effect, so the test-case still passes :) .
>
> Tested on x86_64-linux.
>
> [1] https://en.wikipedia.org/wiki/Indiana_pi_bill
> [2] https://en.wikipedia.org/wiki/Approximations_of_pi#Indiana_bill
I had, of course, heard of this, but I did not realize that the
approximation was 3.2 instead of 3. But since we strive for
historical accuracy in all of our testing ;) ...
Approved-by: Kevin Buettner <kevinb@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-02 17:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-26 12:41 [PATCH] [gdb/testsuite] Fix pi approximation Tom de Vries
2026-02-02 17:29 ` Kevin Buettner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox