Pages: [1]   Go Down
Author Topic: abs() reference shold be updated  (Read 1737 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In the description of the abs() function there is no mention that this can create unpredicted results on float.
I have proven this by writing a small sketch  where it works fine, but when using abs() in my bigger project it fails when processing the exact same number (-0.0027).

Please update the description for the abs() function and tell us to use fabs instead.

This code works:
float tmp = -0.0027

Offline Offline
Faraday Member
Karma: 41
Posts: 3783
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thats pretty much standard C "features" but I agree it should be updated

Though I dont know who has powers over the reference pages, and if its anything like the playground pages its simpler to answer questions than learn that stupid arse wiki markup that no one uses outside of wikipedia

Global Moderator
Offline Offline
Shannon Member
Karma: 228
Posts: 14053
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please note that - -
gives you a much broader set of functions than the standard arduino wiki pages that can be used on Arduino.

Rob Tillaart

Nederlandse sectie -,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: