mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1608] implicit conversion from 'float' to 'double' [-Wdouble-promotion] #1370
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#1370
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fixus971 on GitHub (May 16, 2023).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1608
Hardware
WiFimanager Branch/Release: Master
Esp32
Problem description:
warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
Line 2269:
p.replace(FPSTR(T_2),(String)((temperatureRead()+32)*1.8));
*1.8 Issue at end of line
Solution
replace with *1.8f
@fixus971 commented on GitHub (May 17, 2023):
Hi. Is warning of compiler in c17 version.
even if normally this warning is not signaled.. it is still a problem for
32 bit CPUs.
I corrected many similar arithmetic calculations because I saw the
explanation and I tested it: the 32bit CPUs of the Arduino world suffer a
lot from double counts that go beyond 32bit. Needed .. but just put an "f"
and everything falls into place
Il mer 17 mag 2023, 03:11 Shawn A @.***> ha scritto:
@fixus971 commented on GitHub (May 17, 2023):
Some info about double calc on arduino hardware:
https://forum.arduino.cc/t/8bit-vs-32bit-floating-point-calculations/543123/11
I see that int and a float is 4 bytes and a double is 8 bytes.
after that i read and tested that double require more software time. (Double)
I used platformio with:
[env:Esp32]
framework = arduino
platform = espressif32
board = az-delivery-devkit-v4
upload_speed = 921600
monitor_speed = 115200
monitor_filters = direct ;EscChar to console wo filtering = colors
build_unflags =
-std=c++11
-std=gnu++11
-Os
build_flags =
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG ;=4
-O3
-std=c++17
-std=gnu++17
-Wall ;en warnings questionable constructions that are easy to avoid
-Wextra ;en extra warning flags that are not enabled by -Wall.
-Wdouble-promotion ; warn double soft64b:.9(def=double)->.9f
-Wimplicit-fallthrough ; warn if switch case without break
-Wreturn-type -Werror=return-type ; no return(x) -> CPU Exception hard to found
@tablatronix commented on GitHub (May 17, 2023):
Thanks for that!