bugGNU Octave - Bugs: bug #44709, sprintf('%03g', 10) returns only 2...

 
 

bug #44709: sprintf('%03g', 10) returns only 2 char

Submitted by:  None
Submitted on:  Fri 03 Apr 2015 03:08:31 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: Wont FixAssigned to: None
Originator Name: Xiangrui LiOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.8.2
Operating System: Microsoft Windows

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Tue 07 Apr 2015 11:52:32 AM UTC, comment #10:

Pushed http://hg.octave.org/mxe-octave/rev/d7b2bb282421

John Donoghue <lostbard>
Project Member
Mon 06 Apr 2015 02:10:51 PM UTC, comment #9:

I believe I found the issue in mingw-w64 and have submitted a patch to mingw-w64. [1]

In the mean time, I will probally add a patch to mxe-octave when compiling mingw-w64.

[1] http://sourceforge.net/p/mingw-w64/mailman/message/33732797/

John Donoghue <lostbard>
Project Member
Sat 04 Apr 2015 06:53:08 PM UTC, comment #8:

Someone can report the bug upstream to gnulib. For Octave, marking this as 'Won't Fix" and closing.

Rik <rik5>
Project Administrator
Sat 04 Apr 2015 06:36:02 PM UTC, comment #7:

I think we should just report the problem to the gnulib maintainers and let them decide whether they want to try to provide a workaround for it. It makes sense for the fix to go in gnulib since that's the whole purpose of gnulib. But they may not be particularly interested in mingw-w64.

John W. Eaton <jwe>
Project Administrator
Sat 04 Apr 2015 03:55:54 PM UTC, comment #6:

Do we need to do anything at all? Or can we mark this as an upstream bug?

Rik <rik5>
Project Administrator
Fri 03 Apr 2015 11:39:44 PM UTC, comment #5:

If we decide to try to work around this problem, then it seems like something that should be done in gnulib, not directly in Octave.

John W. Eaton <jwe>
Project Administrator
Fri 03 Apr 2015 03:00:19 PM UTC, comment #4:

An report issue with mingw-w64 printf:

http://sourceforge.net/p/mingw-w64/bugs/362/

John Donoghue <lostbard>
Project Member
Fri 03 Apr 2015 02:07:53 PM UTC, comment #3:

Creating a small c++ program:

With define _GNU_SOURCE, in Linux prints 3 characters, in windows prints 2.
With the undef, prints 3 characters for both Linux and windows.

John Donoghue <lostbard>
Project Member
Fri 03 Apr 2015 12:15:52 PM UTC, comment #2:

I see the same on my windows build - cant remember what hg id it was, but am building a new one now to verify it is still an issue.

John Donoghue <lostbard>
Project Member
Fri 03 Apr 2015 09:40:00 AM UTC, comment #1:

works fine with rc2

hg id
cf9b94a89620 tip

>> sprintf('%03g', 20)

ans = 020

>> sprintf('%03g', 30)

ans = 030

Doug Stewart <dastew>
Fri 03 Apr 2015 03:08:31 AM UTC, original submission:

sprintf('%03g', 1)
ans = 001

sprintf('%03g', 20) % only 2-char for 10, 20, 30 etc
ans = 20

sprintf('%03g', 21)
ans = 021

The same problem exists for printf and fprintf.

sprintf('%03.0f', 20) % work fine
ans = 020

I tested this under Windows only, so don't know the behavior under Linux.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by lostbard (Posted a comment)
  • -unavailable- added by dastew (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 04 Apr 2015 06:53:08 PM UTCrik5StatusConfirmed=>Wont Fix
      Open/ClosedOpen=>Closed
    Fri 03 Apr 2015 08:37:27 PM UTClostbardStatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1