bugAVR C Runtime Library - Bugs: bug #38614, dtostrf - wrong behavior or wrong...

 
 

bug #38614: dtostrf - wrong behavior or wrong documentation

Submitted by:  Anton <demiurg_spb>
Submitted on:  Thu 28 Mar 2013 07:54:26 AM UTC  
 
Category: LibrarySeverity: 3 - Normal
Priority: 5 - NormalItem Group: libc code
Status: FixedPercent Complete: 0%
Assigned to: Joerg Wunsch <joerg_wunsch>Open/Closed: Closed
Release: 1.8.0Fixed Release: 1.8.1

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Mon 11 Aug 2014 09:51:20 PM UTC, comment #1:

I modified the documentation as suggested.

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Thu 28 Mar 2013 07:54:26 AM UTC, original submission:

I have next situation:
Code:
float value = 0.0f;
char buf[32];
static const int WIDTH = 3;
static const int PREC = 0;
dtostrf(value, WIDTH, PREC, buf);

I get {' ',' ','0'} // space, space, zero
but I expected {' ','0','.'} // space, zero, point
because of manual:
Quote:
The minimum field width of the output string (including the '.' and the possible sign for negative values) is given in width, and prec determines the number of digits after the decimal sign. width is signed value, negative for left adjustment.

I think manual sholud be corrected:
Quote:
The minimum field width of the output string (including the possible '.' and the possible sign for negative values) is given in width, and prec determines the number of digits after the decimal sign. width is signed value, negative for left adjustment.

Jörg Wunsch comment from avrfreaks:

That's debatable. It would seem reasonable to correct the function
itself, so it yields " 0." rather than " 0", to indicate this is
a floating-point number. Then, it would also be debatable how to
handle numbers where the absolute value is less than one: print
" .1", or better " 0.1"?

Anton <demiurg_spb>

 

(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 joerg_wunsch (Posted a comment)
  • -unavailable- added by demiurg_spb (Submitted the item)
  •  

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

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 11 Aug 2014 09:51:20 PM UTCjoerg_wunschStatusNone=>Fixed
      Assigned toNone=>joerg_wunsch
      Open/ClosedOpen=>Closed
      Fixed ReleaseNone=>1.8.1

    Back to the top


    Powered by Savane 3.1-cleanup