Skip to content

dtostrf() issue with value in range -1.0 < number_f < 0.0 #513

Closed
@fpistm

Description

@fpistm

Describe the bug
Issue firstly reported here:
http://stm32duino.com/viewtopic.php?f=49&t=4650&p=54273#p54273

dtostrf() implementation is loosing a negative sign, if the input "double" number falls in the
range -1.0 < number_f < 0.0.
Likely to this part of the code in the dtostrf.c

if (negative) {
int_part = -int_part;
}

since integer part is "0", negation doesn't have any meaning.

To Reproduce
Use dtostrf with number in range -1.0 < number_f < 0.0

Metadata

Metadata

Assignees

Labels

bug 🐛Something isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions