ESP32 calculates floats faultily opp. to my M4 and my M3/Due

Looks like projectgus's pull request on Github also solves the issue, just by calling on:

using std::abs;

...in the "Arduino.h" file and deleting the Arduino macro. This redefines abs() using the C++ standard library function.

MartinL:
Looks like projectgus's pull request on Github also solves the issue, just by calling on:

using std::abs;

...in the "Arduino.h" file and deleting the Arduino macro. This redefines abs() using the C++ standard library function.

yes, but my point was:
C++11 and C++14 also have std::abs just for ints and std::fabs and std::fabsf for floats !
Just C++17 has std::abs both for ints and fps...
but does Arduino actually use C++17 ...?

Arduino SAMD Boards is currently using C++11:

The toolchain version currently in use doesn't even support C++17. However, there are plans to update the toolchain and use C++17 in the near future:

The ESP32 core for Arduino is also using C++11:

C++11 and C++14 also have std::abs just for ints and std::fabs and std::fabsf for floats !
Just C++17 has std::abs both for ints and fps...
but does Arduino actually use C++17 ...?

Yes, it's really confusing. I was also wondering why simply adding the "using std::abs;" line, allows the abs() function to work with floats, although the ESP32 is using C++11 (and not C++17).

After some investigation, I believe that the C++11's file which is included in "Arduino.h", undefines the "abs" macro and redefines it as an overloaded function "std::abs" for a number of data types including floats.

The "using std::abs;" line allows "abs" to be used in lieu of any predefined macros, so that it isn't necessary to call "std::abs" in your sketch, but simply use "abs" instead.

MartinL:
Yes, it's really confusing. I was also wondering why simply adding the "using std::abs;" line, allows the abs() function to work with floats, although the ESP32 is using C++11 (and not C++17).

After some investigation, I believe that the C++11's file which is included in "Arduino.h", undefines the "abs" macro and redefines it as an overloaded function "std::abs" for a number of data types including floats.

The "using std::abs;" line allows "abs" to be used in lieu of any predefined macros, so that it isn't necessary to call "std::abs" in your sketch, but simply use "abs" instead.

it appears as if gpp already features the std::abs() for fp since C14 or even 11, opposite to C++ standards only since 17

https://en.cppreference.com/w/cpp/numeric/math/fabs

it appears as if gpp already features the std::abs() for fp since C14 or even 11, opposite to C++ standards only since 17
Compiler Explorer
std::abs(float), std::fabs, std::fabsf, std::fabsl - cppreference.com
float computations (fp32, fp64) evaluate differently vs. ARM Cortex M0+M3+M4 & Mega2560 (IDFGH-1084) · Issue #3405 · espressif/esp-idf · GitHub

Thanks for the links regarding the GCC and C++.

Yes, it appears to be a complex mix of Arduino, compiler and C/C++ standards. Thanks for flagging this up on Github. At least situation is now sorted, or a least will be once ESP32's "Arduino.h" is officially updated.