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: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #55682] round(X,N) and round(X,N,type)
Date: Sat, 23 Dec 2023 16:41:58 -0500 (EST)

Follow-up Comment #11, bug#55682 (group octave):

Came across this when looking to see if a round(X,N) report had been found.
Didn't realize how deep this issue was.

In any case. Just updating with the detail that since the last work on this
report MATLAB also made the following tweaks to the function in 2022a:


R2022a: Control tiebreak behavior
Specify how to break ties by using the TieBreaker name-value argument. For
example, round(X,TieBreaker="tozero") rounds ties towards zero.

R2022a: round returns consistent results for ties
Starting in R2022a, the round function always rounds ties away from zero to
the nearest multiple of 10—N with larger magnitude by default. For example:

X = 1.015:5.015;
N = 2;
Y = round(1.015:5.015,2)
Y =
    1.0200    2.0200    3.0200    4.0200    5.0200
In previous releases, the round function sometimes returned inconsistent
results for ties by default. In the previous example, for instance, the second
and third elements were rounded towards zero to 2.01 and 3.01, respectively.




    _______________________________________________________

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]