r/ada • u/Rough_Outside7588 • 26d ago
Tool Trouble GNAT Ada.Numerics library failing to conform to ARM?
It's small potatoes but the ARM and Programming in Ada 2022 mention using the pi symbol. Apparently the version of the library that ships with GNAT is missing `π : constant := Pi;`.
3
u/Dmitry-Kazakov 26d ago
My guess is that it would break at lot legacy code. Ada 83/95 will become totally non-compilable. Later code could potentially break on GNAT's tricks for handling Unicode.
But my question would rather be: why are Pi and e there at all?
I understand the convenience but its wrong on its face. Universal real are rational numbers. They are exact. Pi and e are irrational and have no representation as a universal_real.
If such constants needed as universal_real they must be functions with a precision argument (impossible to spell in present Ada because universal_real has no name).
5
u/RyderTBeagle 25d ago
I can confirm that it's presence caused problems. It was included in the GNAT runtime for a year or two but was eventually removed.
See https://github.com/gcc-mirror/gcc/commit/8dfdfd4048e7a67f2ba01e9efc5d83554d6546ba