From help-octave-request at bevo dot che dot wisc dot edu Fri Nov 28 03:08:46 2003 Subject: Re: strange problem From: Tomer Altman To: Christoph Dalitz cc: Mike Miller , Octave Mailing List Date: Fri, 28 Nov 2003 01:08:35 -0800 (PST) I believe you can only overload user-defined ( read as: M-file functions ) functions. I'm not sure about OCT-file functions. And I can confidently say that you are not able to overload built-in functions. ~Tomer On Nov 28, 2003 at 10:00am, Christoph Dalitz wrote: christ >Date: Fri, 28 Nov 2003 10:00:36 +0100 christ >From: Christoph Dalitz christ >To: Mike Miller christ >Cc: Octave Mailing List christ >Subject: Re: strange problem christ >Resent-Date: Fri, 28 Nov 2003 03:03:09 -0600 christ >Resent-From: help-octave at bevo dot che dot wisc dot edu christ > christ >On Fri, 28 Nov 2003 02:34:07 -0600 (CST) christ >Mike Miller wrote: christ >> christ >> > > The number -2.0817e-17 is -0.000000000000000020817, which is very, very christ >> > > close to zero. christ >> > christ >> > Is there an Octave function that truncates/rounds such small numbers to christ >> > zero (like the Scilab function "clean")? christ >> > christ >> > I have tried "help round" and "help trunc", but found nothing christ >> > appropriate. christ >> christ >> Why not use 'round' but first multiply by a large number, then divide by christ >> that same number after round. christ >> christ >For some strange reason I believed that there was no "round" function because christ >it is not documented ("help round" gives "help: sorry, `round' is not documented"). christ > christ >> You could write a function that performs that operation on matrices. christ >> christ >Tried this with: christ > christ > function y = round(x,n) christ > y = round(x*10^n)/10^n; christ > endfunction christ > christ >It seems however that Octave does not support function overloading, because christ >I obtain the error christ > christ > octave:3> round(5.4,0) christ > error: round: too many arguments christ > christ >I am using Octave 2.1.35. Is function overloading supported in some later version? christ > christ >Thanks, christ > christ >Christoph christ > christ > christ > christ >------------------------------------------------------------- christ >Octave is freely available under the terms of the GNU GPL. christ > christ >Octave's home on the web: http://www.octave.org christ >How to fund new projects: http://www.octave.org/funding.html christ >Subscription information: http://www.octave.org/archive.html christ >------------------------------------------------------------- christ > christ > ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------