Pages: [1]   Go Down
Author Topic: abs() reference shold be updated  (Read 1573 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
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:
Code:
float tmp = -0.0027
tmp=fabs(tmp);
Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 3783
@ssh0le
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
Logged


Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 170
Posts: 12482
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 - http://www.nongnu.org/avr-libc/user-manual/modules.html -
gives you a much broader set of functions than the standard arduino wiki pages that can be used on Arduino.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: