Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

restore dtostrf when floats are disabled in printf/scanf + round fix#7093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
devyte merged 7 commits intoesp8266:masterfromd-a-v:dtostrfix2
Feb 22, 2020
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
fix
  • Loading branch information
@d-a-v
d-a-v committedFeb 19, 2020
commit390ca30a476c2e080fb5058d1df40a61d3686912
25 changes: 14 additions & 11 deletionscores/esp8266/core_esp8266_noniso.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,17 +41,6 @@ char* ultoa(unsigned long value, char* result, int base) {
return utoa((unsigned int)value, result, base);
}

char * dtostrf(double number, signed char width, unsigned char prec, char *s) {
if (!_printf_float) {
return __dtostrf(number, width, prec, s);
} else {
char fmt[32];
sprintf(fmt, "%%%d.%df", width, prec);
sprintf(s, fmt, number);
return s;
}
}

static char * __dtostrf(double number, signed char width, unsigned char prec, char *s) {
bool negative = false;

Expand DownExpand Up@@ -129,4 +118,18 @@ static char * __dtostrf(double number, signed char width, unsigned char prec, ch
return s;
}

// extern weak declaration (= function pointer) to check whether _printf_float is defined
extern int _printf_float () __attribute__((__weak__));

char * dtostrf(double number, signed char width, unsigned char prec, char *s) {
if (!_printf_float) {
return __dtostrf(number, width, prec, s);
} else {
char fmt[32];
sprintf(fmt, "%%%d.%df", width, prec);
sprintf(s, fmt, number);
return s;
}
}

};

[8]ページ先頭

©2009-2025 Movatter.jp