octave-maintainers
[Top][All Lists]
Advanced

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

octave setround


From: jorn . amundsen
Subject: octave setround
Date: Sun, 21 Feb 2010 15:01:29 +0100 (MET)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

Could you consider including a setround function with Octave ? This is very useful with Interval Arithmetic. Matlab offers this in system dependent, to be made available with something like

    function setround(rnd)
        system dependent(’setround’,rnd);
    end

I know there have been several suggestions published earlier on the net. Please feel free to use my implementation as a starting point, available on http://folk.ntnu.no/joern/geilo-2010/setround.cc .

It looks like this when autoloaded into Octave:

help setround
`setround' is a function from the file /home/joern/src/setround.oct

 -- Loadable Function: OLD = setround (MODE)
     Set the processor floating-point rounding mode.  Returns the
     previous mode in OLD.

     The MODE argument specify how the results are rounded if not
     exactly representable, and may be one of:

    `-Inf'
          Round towards negative infinity (down).

    `0.'
          Round towards zero.

    `0.5'
          Round to nearest (default).

    `Inf'
          Round towards positive infinity (up).

     The return value is any of the above or -1 of not determinable.


Additional help for built-in functions and operators is
available in the on-line version of the manual.  Use the command
`doc <topic>' to search the manual index.

Help and information about Octave is also available on the WWW
at http://www.octave.org and via the address@hidden
mailing list.

Rgds --Jorn Amundsen

reply via email to

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