help-octave
[Top][All Lists]

Re: Uniform partition of an interval

 From: etienne grossmann Subject: Re: Uniform partition of an interval Date: Wed, 17 May 2000 10:27:45 +0100 (WEST)

```  Hello,

#  To: Octave users list <address@hidden>
#
#     What is the MAIN reason that 1.8:0.05:1.9 produces [1.8000 1.8500]
#     and not [1.8000 1.8500 1.9000]?
#
#  Finite precision of the machine's number representation.

Indeed, with 2.1.19,

octave:3> 1.8 + 0.05*2 - 1.9
ans =  2.2204e-16

So 1.8 + 0.05*2 is strictly greater than 1.9. Not a bug, but the
effect of floating point precision.

Cheers,

Etienne

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

Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
Subscription information:  http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------

```