[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #45639] Formatting float as integer is not wor
From: |
Mike Miller |
Subject: |
[Octave-bug-tracker] [bug #45639] Formatting float as integer is not working any more |
Date: |
Mon, 27 Jul 2015 17:38:45 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Firefox/38.0 |
Update of bug #45639 (project octave):
Status: None => Invalid
Open/Closed: Open => Closed
Operating System: Microsoft Windows => Any
_______________________________________________________
Follow-up Comment #1:
Hi, thanks for your bug report. I'm sorry that this change broke your existing
code, but this change was in fact necessary to be compatible with Matlab.
Matlab does in fact disregard the "%d" conversion specifier when the argument
is a floating point value.
See the following announcement on the developers list:
https://lists.gnu.org/archive/html/octave-maintainers/2014-04/msg00044.html
This change is also documented in the news for Octave 4.0.0:
> Integer formats used in the printf family of functions now work for
> 64-bit integers and are more compatible with Matlab when printing
> non-integer values. Now instead of truncating, Octave will switch
> the effective format to '%g' in the following circumstances:
>
> * the value of an integer type (int8, uint32, etc.) value exceeds
> the maximum for the format specifier. For '%d', the limit is
> intmax ('int64') and for '%u' it is intmax ('uint64').
>
> * round(x) != x or the value is outside the range allowed by the
> integer format specifier.
>
> There is still one difference: Matlab switches to '%e' and Octave
> switches to '%g'.
The best option for you to pursue is to make a point of ensuring that you
arguments are integers when you want them to be printed as integers, using one
of round, fix, floor, or ceil as appropriate.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?45639>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/