Am Tue, May 06, 2025 at 09:26:51AM +0200 schrieb Ludovic Courtès:
> Do you have evidence that the problem is a leak like this?  Or could it
> be that the Python code being run is non-deterministic?
> If you run ‘guix shell -CN --no-cwd coreutils’, you can see with ‘ls’
> etc. that nothing leaks from the host OS (apart of course from the
> kernel).

Or maybe the hardware "leaks"? Are the two machines exactly identical,
in particular, do they have the exact same processor? Since the
differences involve floating point computations, I would not be
surprised if the precise processor architecture made a difference.

Someone mentioned the IEEE-754 standard in the thread, which mandates
that basic arithmetic operations follow a precise, deterministic
semantics, but not necessarily trigonometric functions.

Also, if I remember well, special flags are required to make GCC emit
IEEE conforming code; otherwise the old, but faster x86 80 bit extended
precision built into the processor is used. I have seen a case where
*printing* a variable changed its value, because this meant it would be
moved from an 80 bit processor register to a 64 bit memory location.
Otherwise said, something like the following code:
double x = ...;
if (x!=some value) {
   printf ("%f", x);
   if (x!=some value) // the same value as above, of course
      printf ("0");
   else
      printf ("1");
}
would print x, followed by "1"...

See this thread:
   https://lists.gnu.org/archive/html/guix-devel/2023-03/msg00277.html
and commit 098bd280f82350073e8280e37d56a14162eed09c .

If you want deterministic, reproducible floating point computations,
I am afraid you would need to use the (comparably slow in low precision)
GNU MPFR and GNU MPC libraries; or use interval arithmetic from FLINT
and replace exact comparisons by looking at intersections of intervals.

Andreas


Reply via email to