Go Down

Topic: abs() reference shold be updated (Read 1 time) previous topic - next topic

aaanekre

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: [Select]

float tmp = -0.0027
tmp=fabs(tmp);


Osgeld

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
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

robtillaart


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.
Rob Tillaart

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

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy