octave-maintainers
[Top][All Lists]
Advanced

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

Re: printf integer format compatibility


From: John W. Eaton
Subject: Re: printf integer format compatibility
Date: Wed, 16 Apr 2014 20:24:58 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131005 Icedove/17.0.9

On 04/16/2014 07:00 PM, Michael D. Godfrey wrote:

I suspect that there will be some other places where this change in the
behavior
of %d will reveal problems.

Yes, I'm sure it will.  I added the following text to the NEWS file:

   ** 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
      is currently switching to '%g'.

What do people think about using '%g' instead of '%e' as Matlab does?
Should we just go ahead and use '%e'?

jwe





reply via email to

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