octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #55682] round(X,N) and round(X,N,type)


From: Michael Leitner
Subject: [Octave-bug-tracker] [bug #55682] round(X,N) and round(X,N,type)
Date: Sat, 9 Feb 2019 15:20:52 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux i686; rv:47.0) Gecko/20100101 Firefox/47.0

Follow-up Comment #1, bug #55682 (project octave):

What trivial problems make the guys at Mathworks feel the need to complexify
their API... If you only need this to solve a given problem right now, just
use


Y=round(X*10^N)/10^N;


But beware that these are then floating-point numbers, that is, if you get
let's say 1.3 in this way and 2.7, it is not guaranteed that their sum is
equal to a corresponding expression of 4.0 (different from proper rounding,
which gives you integer-valued doubles that conform to exact arithmetics as
long as you do not exceed bitmax()).

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55682>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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