-
Notifications
You must be signed in to change notification settings - Fork 8k
Open
Labels
Description
Answers checklist.
- I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- I have searched the issue tracker for a similar issue and not found a similar issue.
IDF version.
5.5.1
Espressif SoC revision.
ESP32-C6 ESP32-C5
Operating System used.
Linux
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
None
Development Kit.
ESP32-C6-Zero ESP32-C5-DevKit
Power Supply used.
USB
What is the expected behavior?
I expected to have strtold working to convert text "14.5" to return long double 14.5000
What is the actual behavior?
Instead the function returns 912600713435735482836300403243281809408.000000
Steps to reproduce.
long double
read_float (void)
{
char temp[50] = "14.5endofstring";
char *end = NULL;
long double value = strtold (temp, &end);
if (end == temp) ESP_LOGE("read_float", "bad format for strtold");
float value2 = strtof (temp, &end);
ESP_LOGE("read_float", "temp=%s, value=%Lf, value2=%.1f", temp, value, value2);
return value;
}
Debug Logs.
read_float: temp=14.5endofstring, value=912600713435735482836300403243281809408.000000, value2=14.5
Diagnostic report archive.
No response
More Information.
strtof seems to be working fine to convert text to float.
Same issue on C5 and C6 boards.
I didn't found anything in documentation related to "long double" or strtold