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

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

[Octave-bug-tracker] [bug #36121] num2str(2.4e9, 15) gives incorrect res


From: Sebastian Held
Subject: [Octave-bug-tracker] [bug #36121] num2str(2.4e9, 15) gives incorrect result
Date: Sat, 07 Apr 2012 10:31:40 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20100101 Firefox/9.0

URL:
  <http://savannah.gnu.org/bugs/?36121>

                 Summary: num2str(2.4e9,15) gives incorrect result
                 Project: GNU Octave
            Submitted by: sibbi77
            Submitted on: Sat 07 Apr 2012 10:31:39 AM GMT
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.6.1
        Operating System: GNU/Linux

    _______________________________________________________

Details:

the num2str() function has a flaw concerning large numbers.
If a number is smaller than 10^<given precision>, the sprintf format is '%d',
but this format is limited to intmax.

Example:

num2str(2.4e9,15)
ans = -1894967296


num2str.m should be fixed to include an additional check, if the number is
below intmax, otherwise %g or %f must be used.




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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