On 26 May 2012 21:35, Andrej Lajovic <andrej.lajo...@guest.arnes.si> wrote: > Hi, > > there has recently been a mention of the "chop" function. I was not aware > of its existence until then and decided to give it a try. However, I have > found the documentation to be somewhat misleading. It says: > >> -- Function File: chop (X, NDIGITS, BASE) >> Truncate elements of X to a length of NDIGITS such that the >> resulting numbers are exactly divisible by BASE. If BASE is not >> specified it defaults to 10. > > To me, the last sentence clearly means that calling > >> chop(X, NDIGITS) > > should give an identical result to > >> chop(X, NDIGITS, 10) > > But this is not the case: > >> octave:1> chop(pi, 5) >> ans = 3.1416 > >> octave:2> chop(pi, 5, 10) >> ans = 3.1420 > > It seems that calling the function with two arguments rounds the number X to > NDIGITS significant figures in base 10, whereas calling it with three > arguments rounds the number X to NDIGITS significant figures in base 10 > while also making these NDIGITS significant figures divisible by BASE. These > two cases are not the same and the distinction is, in my opinion, not made > clearly enough in the documentation. > > What do you think? > > > Andrej
Hi Andrej the chop function belongs to octave core, not to an octave package, so you should mention this on the octave mailing list (I'm CC'ing it) Not sure if this is bug. Looking at the source of chop it looks like the base should default to 10. However, looking further down the code, if nargin != 2, it's value is completely ignored. You may need to report it on the octave bug tracker https://savannah.gnu.org/bugs/?group=octave Carnë ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Octave-dev mailing list Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev