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

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

[Octave-bug-tracker] [bug #51515] sprintf not rounding as Matlab does


From: Rik
Subject: [Octave-bug-tracker] [bug #51515] sprintf not rounding as Matlab does
Date: Thu, 20 Jul 2017 19:23:50 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0

Update of bug #51515 (project octave):

                Severity:              3 - Normal => 2 - Minor              
                Priority:              5 - Normal => 3 - Low                

    _______________________________________________________

Follow-up Comment #5:

Thanks for testing.  Hopefully someone else can try a different platform just
to be sure.  For example, this article from Stack Overflow
(https://stackoverflow.com/questions/31142600/c-rounding-behavior-consistency-for-ties-with-sprintf)
shows that Windows Visual Studio and GCC perform different rounding in exactly
the way you are experiencing.

The simplest thing, for the moment, would be to call round() yourself on any
data you want formatted in a particular fashion.

The rounding mode could be set as a whole for the C math library by using
fsetround.  But that might be overkill for this.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51515>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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