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

------------------------------------------------------------------------------
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

Reply via email to