[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Save-load problem

From: Przemek Klosowski
Subject: Re: Save-load problem
Date: Tue, 29 Apr 2003 16:59:43 -0400 (EDT)

   ...they are off slightly, you can generate a different number of  elements.

   The following worked for me:

     save_precision = 16

For what it is worth, in my Linux 2.1.34 with RedHat glibc 2.2.5-34
save_precision equal to 15 is the default, and both 15 and 16 created
identical files. 17 generated a different file---however in all three
cases the vector, upon reading it back, had 128 elements, unlike JWE's.

The bottom line is we are in the realm of shimmering, a floating point
phenomenon, where the result depends strongly on the details of least
significant bits, and can change depending on interactions of the
versions of system library (the printf/scanf code), octave I/O
details, etc. It shouldn't be so, but it is.

The problem arises because the both step and end use high precision
numbers (pi/16 and 8*pi), and the result depends on exact relationship
between them.  It's sort of like expecting that sqrt(2)^2 is equal to
two: it should be, but it usually isn't; the programmer must
anticipate and work around such flaws in floating point arithmetic.

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]